From 747224b2ec7b633ad9417aefd44a33131587e266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20R=C3=B3g?= Date: Thu, 12 Sep 2024 16:39:01 +0200 Subject: [PATCH] v3.0.0 (#85) * generated 3.0.0 * update * version * regenerated php sdks * remove old * all passed tests * regenerated models and tests adjusted * correct tests * fix refs * tests > __tests__, tests dir to gitignore * remove generated tests --- .gitignore | 41 +- .php-cs-fixer.dist.php | 29 + .phplint.yml | 11 + ENDPOINTS-COVERAGE.md | 352 + README.md | 2063 ++- __tests__/Support/AcceptanceTester.php | 29 + __tests__/Support/Data/.gitkeep | 0 __tests__/Support/FunctionalTester.php | 29 + __tests__/Support/UnitTester.php | 29 + __tests__/Support/_generated/.gitignore | 2 + __tests__/Unit.suite.yml | 9 + __tests__/Unit/01_ProductsTest.php | 152 + __tests__/Unit/02_CampaignsTest.php | 141 + __tests__/Unit/03_CustomersTest.php | 48 + __tests__/Unit/04_PublicationsTest.php | 32 + __tests__/Unit/05_QualificationsTest.php | 34 + __tests__/Unit/06_ValidationsTest.php | 52 + __tests__/Unit/07_VouchersTest.php | 65 + __tests__/Unit/08_EventsTest.php | 28 + __tests__/Unit/09_RedemptionsTest.php | 48 + __tests__/Unit/10_OdersTest.php | 54 + __tests__/Unit/11_LoyaltiesTest.php | 43 + __tests__/Unit/12_ValidationRulesTest.php | 32 + __tests__/_generated/UnitTesterActions.php | 1701 ++ __tests__/lib/campaigns.php | 188 + __tests__/lib/config.php | 110 + __tests__/lib/customers.php | 41 + __tests__/lib/events.php | 29 + __tests__/lib/loyalties.php | 32 + __tests__/lib/orders.php | 70 + __tests__/lib/products.php | 158 + __tests__/lib/publications.php | 29 + __tests__/lib/qualifications.php | 43 + __tests__/lib/redemptions.php | 46 + __tests__/lib/utils.php | 130 + __tests__/lib/validationRules.php | 21 + __tests__/lib/validations.php | 68 + __tests__/lib/voucherify.php | 153 + __tests__/lib/vouchers.php | 55 + .../campaigns/addedVoucherToCampaign.json | 82 + .../campaigns/createdBundleOfVouchers.json | 27 + ...tedDiscountCampaignWithValidationRule.json | 79 + .../campaigns/createdLoyaltyCampaign.json | 54 + .../campaigns/createdLoyaltyCard.json | 58 + .../campaigns/createdPromotionCampaign.json | 33 + .../createdValidationRuleApplicableTo.json | 34 + .../createdValidationRuleMoreThan.json | 22 + .../snapshots/customers/createdCustomer.json | 58 + .../customers/deletedCustomerPermanently.json | 17 + __tests__/snapshots/events/createdEvent.json | 14 + .../listedLoyaltyMemberCardTransactions.json | 75 + ...dLoyaltyMemberCardBalanceBy1000Points.json | 12 + __tests__/snapshots/orders/createdOrder.json | 87 + __tests__/snapshots/orders/getOrder.json | 85 + __tests__/snapshots/orders/updatedOrder.json | 87 + .../snapshots/products/createdProduct.json | 12 + .../snapshots/products/createdProduct2.json | 12 + __tests__/snapshots/products/createdSku.json | 18 + __tests__/snapshots/products/getSku.json | 18 + .../products/listedSkusInProducts.json | 25 + .../snapshots/products/updatedProduct.json | 12 + __tests__/snapshots/products/updatedSku.json | 18 + .../publications/createdPublication.json | 93 + .../qualifications/checkedEligibility.json | 406 + .../redeemedStackedApplicableDiscounts.json | 133 + .../redeemedStackedSkippedDiscounts.json | 876 + .../createdValidationRule.json | 8 + .../validatedStackedApplicableDiscounts.json | 186 + ...validatedStackedInapplicableDiscounts.json | 65 + .../snapshots/vouchers/disabledVoucher.json | 81 + .../vouchers/updatedLoyaltyCardBalance.json | 12 + __tests__/snapshots/vouchers/voucher.json | 81 + codeception.yml | 12 + composer.json | 50 +- composer.lock | 1199 -- docs/Api/AsyncActionsApi.md | 145 + docs/Api/CampaignsApi.md | 779 + docs/Api/CategoriesApi.md | 345 + docs/Api/ClientSideApi.md | 361 + docs/Api/CustomersApi.md | 941 + docs/Api/EventsApi.md | 75 + docs/Api/ExportsApi.md | 341 + docs/Api/LoyaltiesApi.md | 3141 ++++ docs/Api/OrdersApi.md | 421 + docs/Api/ProductCollectionsApi.md | 358 + docs/Api/ProductsApi.md | 989 ++ docs/Api/PromotionsApi.md | 985 ++ docs/Api/PublicationsApi.md | 243 + docs/Api/QualificationsApi.md | 75 + docs/Api/RedemptionsApi.md | 441 + docs/Api/RewardsApi.md | 705 + docs/Api/SegmentsApi.md | 210 + docs/Api/ValidationRulesApi.md | 647 + docs/Api/ValidationsApi.md | 75 + docs/Api/VouchersApi.md | 1129 ++ .../AccessSettingsCampaignAssignmentsList.md | 12 + docs/Model/ApplicableTo.md | 25 + docs/Model/ApplicableToResultList.md | 12 + docs/Model/AreaStoreCampaignAssignment.md | 13 + docs/Model/AsyncActionBase.md | 18 + docs/Model/AsyncActionGetResponseBody.md | 19 + docs/Model/AsyncActionsListResponseBody.md | 11 + docs/Model/BusValRuleAssignment.md | 17 + docs/Model/CampaignBase.md | 37 + docs/Model/CampaignLoyaltyCard.md | 10 + .../CampaignLoyaltyCardExpirationRules.md | 12 + docs/Model/CampaignLoyaltyVoucher.md | 12 + .../Model/CampaignLoyaltyVoucherRedemption.md | 9 + docs/Model/CampaignVoucher.md | 20 + docs/Model/CampaignVoucherRedemption.md | 9 + docs/Model/CampaignsCreateRequestBody.md | 30 + .../CampaignsCreateRequestBodyPromotion.md | 9 + .../CampaignsCreateRequestBodyVoucher.md | 15 + ...aignsCreateRequestBodyVoucherRedemption.md | 9 + docs/Model/CampaignsCreateResponseBody.md | 40 + docs/Model/CampaignsDeleteResponseBody.md | 9 + docs/Model/CampaignsGetResponseBody.md | 40 + .../CampaignsImportCreateResponseBody.md | 9 + .../CampaignsImportCsvCreateResponseBody.md | 9 + docs/Model/CampaignsImportVoucherItem.md | 22 + .../CampaignsImportVoucherItemRedemption.md | 9 + docs/Model/CampaignsListResponseBody.md | 12 + docs/Model/CampaignsUpdateRequestBody.md | 30 + .../CampaignsUpdateRequestBodyOptions.md | 9 + docs/Model/CampaignsUpdateResponseBody.md | 40 + ...aignsVouchersCreateCombinedResponseBody.md | 38 + ...sVouchersCreateCombinedResponseBodyGift.md | 11 + ...rsCreateCombinedResponseBodyLoyaltyCard.md | 12 + ...uchersCreateCombinedResponseBodyPublish.md | 11 + ...ersCreateCombinedResponseBodyRedemption.md | 13 + ...ampaignsVouchersCreateInBulkRequestBody.md | 16 + ...uchersCreateInBulkRequestBodyRedemption.md | 9 + .../CampaignsVouchersCreateRequestBody.md | 14 + ...ignsVouchersCreateRequestBodyRedemption.md | 9 + .../CampaignsVouchersCreateResponseBody.md | 37 + ...CampaignsVouchersCreateResponseBodyGift.md | 11 + ...nsVouchersCreateResponseBodyLoyaltyCard.md | 12 + ...paignsVouchersCreateResponseBodyPublish.md | 11 + ...gnsVouchersCreateResponseBodyRedemption.md | 13 + docs/Model/CategoriesCreateRequestBody.md | 10 + docs/Model/CategoriesCreateResponseBody.md | 13 + docs/Model/CategoriesGetResponseBody.md | 15 + docs/Model/CategoriesListResponseBody.md | 12 + docs/Model/CategoriesUpdateRequestBody.md | 10 + docs/Model/CategoriesUpdateResponseBody.md | 14 + docs/Model/Category.md | 15 + docs/Model/ClientEventsCreateRequestBody.md | 13 + .../ClientEventsCreateRequestBodyLoyalty.md | 9 + .../ClientEventsCreateRequestBodyReferral.md | 10 + docs/Model/ClientEventsCreateResponseBody.md | 14 + .../ClientPromotionsTiersListResponseBody.md | 13 + ...alificationsCheckEligibilityRequestBody.md | 14 + ...lificationsCheckEligibilityResponseBody.md | 12 + ...ationsCheckEligibilityResponseBodyOrder.md | 20 + .../ClientRedemptionsRedeemRequestBody.md | 15 + ...ientRedemptionsRedeemRequestBodyOptions.md | 9 + ...mptionsRedeemRequestBodyRedeemablesItem.md | 12 + ...onsRedeemRequestBodyRedeemablesItemGift.md | 9 + ...sRedeemRequestBodyRedeemablesItemReward.md | 10 + .../ClientRedemptionsRedeemResponseBody.md | 13 + .../ClientValidationsValidateRequestBody.md | 15 + ...ntValidationsValidateRequestBodyOptions.md | 9 + ...tionsValidateRequestBodyRedeemablesItem.md | 12 + ...sValidateRequestBodyRedeemablesItemGift.md | 9 + ...alidateRequestBodyRedeemablesItemReward.md | 10 + .../ClientValidationsValidateResponseBody.md | 16 + ...ionsValidateResponseBodyRedeemablesItem.md | 17 + ...lidateResponseBodyRedeemablesItemResult.md | 13 + ...esponseBodyRedeemablesItemResultDetails.md | 10 + ...sponseBodyRedeemablesItemResultDiscount.md | 25 + ...odyRedeemablesItemResultDiscountProduct.md | 11 + ...teResponseBodyRedeemablesItemResultGift.md | 9 + ...nseBodyRedeemablesItemResultLoyaltyCard.md | 9 + docs/Model/CodeConfig.md | 14 + docs/Model/CreatePublicationCampaign.md | 10 + docs/Model/Customer.md | 18 + docs/Model/CustomerActivity.md | 13 + docs/Model/CustomerAddress.md | 14 + docs/Model/CustomerId.md | 10 + docs/Model/CustomerLoyalty.md | 11 + docs/Model/CustomerLoyaltyCampaignsEntry.md | 11 + docs/Model/CustomerRedeemable.md | 18 + docs/Model/CustomerRedeemableRedeemable.md | 11 + docs/Model/CustomerReferrals.md | 10 + docs/Model/CustomerReferralsCampaignsItem.md | 13 + docs/Model/CustomerSummary.md | 10 + docs/Model/CustomerSummaryOrders.md | 13 + docs/Model/CustomerSummaryRedemptions.md | 16 + docs/Model/CustomerSummaryRedemptionsGift.md | 10 + .../CustomerSummaryRedemptionsLoyaltyCard.md | 10 + .../CustomerWithSummaryLoyaltyReferrals.md | 26 + ...tomerWithSummaryLoyaltyReferralsAddress.md | 14 + ...stomerWithSummaryLoyaltyReferralsAssets.md | 9 + .../CustomersActivitiesListResponseBody.md | 12 + .../CustomersActivityListResponseBody.md | 13 + docs/Model/CustomersCreateRequestBody.md | 18 + .../CustomersCreateRequestBodyAddress.md | 14 + docs/Model/CustomersCreateResponseBody.md | 26 + .../CustomersCreateResponseBodyAddress.md | 14 + .../CustomersCreateResponseBodyAssets.md | 9 + docs/Model/CustomersGetResponseBody.md | 26 + docs/Model/CustomersGetResponseBodyAddress.md | 14 + docs/Model/CustomersGetResponseBodyAssets.md | 9 + .../CustomersImportCsvCreateResponseBody.md | 9 + docs/Model/CustomersListResponseBody.md | 13 + ...ustomersMetadataUpdateInBulkRequestBody.md | 10 + ...stomersMetadataUpdateInBulkResponseBody.md | 9 + ...mersPermanentDeletionCreateResponseBody.md | 15 + ...anentDeletionCreateResponseBodyDataJson.md | 15 + .../CustomersRedeemablesListResponseBody.md | 14 + .../CustomersSegmentsListResponseBody.md | 12 + .../Model/CustomersUpdateInBulkRequestBody.md | 17 + ...CustomersUpdateInBulkRequestBodyAddress.md | 14 + .../CustomersUpdateInBulkResponseBody.md | 9 + docs/Model/CustomersUpdateRequestBody.md | 16 + .../CustomersUpdateRequestBodyAddress.md | 14 + docs/Model/CustomersUpdateResponseBody.md | 26 + .../CustomersUpdateResponseBodyAddress.md | 14 + .../CustomersUpdateResponseBodyAssets.md | 9 + docs/Model/Discount.md | 25 + docs/Model/DiscountUnitMultipleOneUnit.md | 14 + docs/Model/EarningRule.md | 27 + docs/Model/EarningRuleCustomEvent.md | 9 + docs/Model/EarningRuleLoyalty.md | 15 + docs/Model/EarningRuleLoyaltyCustomEvent.md | 9 + .../EarningRuleLoyaltyCustomEventMetadata.md | 11 + docs/Model/EarningRuleLoyaltyCustomer.md | 9 + .../EarningRuleLoyaltyCustomerMetadata.md | 11 + docs/Model/EarningRuleLoyaltyOrder.md | 11 + docs/Model/EarningRuleLoyaltyOrderAmount.md | 10 + docs/Model/EarningRuleLoyaltyOrderItems.md | 11 + .../EarningRuleLoyaltyOrderItemsAmount.md | 12 + .../EarningRuleLoyaltyOrderItemsQuantity.md | 12 + ...ningRuleLoyaltyOrderItemsSubtotalAmount.md | 12 + docs/Model/EarningRuleLoyaltyOrderMetadata.md | 11 + .../EarningRuleLoyaltyOrderTotalAmount.md | 10 + docs/Model/EarningRuleLoyaltyTier.md | 9 + docs/Model/EarningRuleSegment.md | 9 + docs/Model/EarningRuleSource.md | 11 + docs/Model/Error.md | 15 + docs/Model/EventsCreateRequestBody.md | 13 + docs/Model/EventsCreateRequestBodyLoyalty.md | 9 + docs/Model/EventsCreateRequestBodyReferral.md | 10 + docs/Model/EventsCreateResponseBody.md | 14 + docs/Model/Export.md | 17 + docs/Model/ExportParameters.md | 11 + docs/Model/ExportParametersFilters.md | 12 + docs/Model/ExportResult.md | 9 + .../Model/ExportVoucherTransactionsFilters.md | 12 + docs/Model/ExportsCreateRequestBody.md | 10 + .../ExportsCreateRequestBodyParameters.md | 11 + ...portsCreateRequestBodyParametersFilters.md | 12 + docs/Model/ExportsCreateResponseBody.md | 17 + .../ExportsCreateResponseBodyParameters.md | 11 + ...ortsCreateResponseBodyParametersFilters.md | 12 + docs/Model/ExportsGetResponseBody.md | 17 + .../Model/ExportsGetResponseBodyParameters.md | 11 + ...ExportsGetResponseBodyParametersFilters.md | 12 + docs/Model/ExportsGetResponseBodyResult.md | 9 + docs/Model/ExportsListResponseBody.md | 12 + docs/Model/FieldConditions.md | 9 + docs/Model/FilterConditionsDateTime.md | 9 + .../FilterConditionsDateTimeConditions.md | 14 + docs/Model/FilterConditionsString.md | 16 + docs/Model/FiltersCondition.md | 33 + docs/Model/Gift.md | 11 + docs/Model/InapplicableTo.md | 25 + docs/Model/InapplicableToResultList.md | 12 + docs/Model/ListPublicationsItemVoucher.md | 15 + .../LoyaltiesCreateCampaignRequestBody.md | 27 + .../LoyaltiesCreateCampaignResponseBody.md | 38 + docs/Model/LoyaltiesDeleteResponseBody.md | 9 + ...arningRulesCreateCustomEventRequestBody.md | 20 + ...CreateCustomEventRequestBodyCustomEvent.md | 9 + ...ulesCreateCustomEventRequestBodyLoyalty.md | 12 + ...ustomEventRequestBodyLoyaltyCustomEvent.md | 9 + ...ntRequestBodyLoyaltyCustomEventMetadata.md | 11 + ...RulesCreateCustomEventRequestBodySource.md | 9 + ...ingRulesCreateEnteredSegmentRequestBody.md | 20 + ...sCreateEnteredSegmentRequestBodyLoyalty.md | 12 + ...nteredSegmentRequestBodyLoyaltyCustomer.md | 9 + ...gmentRequestBodyLoyaltyCustomerMetadata.md | 11 + ...sCreateEnteredSegmentRequestBodySegment.md | 9 + ...esCreateEnteredSegmentRequestBodySource.md | 9 + ...sEarningRulesCreateOrderPaidRequestBody.md | 19 + ...gRulesCreateOrderPaidRequestBodyLoyalty.md | 13 + ...sCreateOrderPaidRequestBodyLoyaltyOrder.md | 11 + ...eOrderPaidRequestBodyLoyaltyOrderAmount.md | 10 + ...teOrderPaidRequestBodyLoyaltyOrderItems.md | 11 + ...rPaidRequestBodyLoyaltyOrderItemsAmount.md | 12 + ...aidRequestBodyLoyaltyOrderItemsQuantity.md | 12 + ...uestBodyLoyaltyOrderItemsSubtotalAmount.md | 12 + ...rderPaidRequestBodyLoyaltyOrderMetadata.md | 11 + ...rPaidRequestBodyLoyaltyOrderTotalAmount.md | 10 + ...ngRulesCreateOrderPaidRequestBodySource.md | 9 + ...altiesEarningRulesCreateRequestBodyItem.md | 22 + ...ngRulesCreateRequestBodyItemCustomEvent.md | 9 + ...arningRulesCreateRequestBodyItemLoyalty.md | 15 + ...CreateRequestBodyItemLoyaltyCustomEvent.md | 9 + ...questBodyItemLoyaltyCustomEventMetadata.md | 11 + ...lesCreateRequestBodyItemLoyaltyCustomer.md | 9 + ...eRequestBodyItemLoyaltyCustomerMetadata.md | 11 + ...gRulesCreateRequestBodyItemLoyaltyOrder.md | 11 + ...CreateRequestBodyItemLoyaltyOrderAmount.md | 10 + ...sCreateRequestBodyItemLoyaltyOrderItems.md | 11 + ...eRequestBodyItemLoyaltyOrderItemsAmount.md | 12 + ...equestBodyItemLoyaltyOrderItemsQuantity.md | 12 + ...BodyItemLoyaltyOrderItemsSubtotalAmount.md | 12 + ...eateRequestBodyItemLoyaltyOrderMetadata.md | 11 + ...eRequestBodyItemLoyaltyOrderTotalAmount.md | 10 + ...ngRulesCreateRequestBodyItemLoyaltyTier.md | 9 + ...arningRulesCreateRequestBodyItemSegment.md | 9 + ...EarningRulesCreateRequestBodyItemSource.md | 9 + ...LoyaltiesEarningRulesCreateResponseBody.md | 27 + ...rningRulesCreateResponseBodyCustomEvent.md | 9 + ...esEarningRulesCreateResponseBodyLoyalty.md | 15 + ...lesCreateResponseBodyLoyaltyCustomEvent.md | 9 + ...eResponseBodyLoyaltyCustomEventMetadata.md | 11 + ...gRulesCreateResponseBodyLoyaltyCustomer.md | 9 + ...eateResponseBodyLoyaltyCustomerMetadata.md | 11 + ...ningRulesCreateResponseBodyLoyaltyOrder.md | 11 + ...lesCreateResponseBodyLoyaltyOrderAmount.md | 10 + ...ulesCreateResponseBodyLoyaltyOrderItems.md | 11 + ...eateResponseBodyLoyaltyOrderItemsAmount.md | 12 + ...teResponseBodyLoyaltyOrderItemsQuantity.md | 12 + ...onseBodyLoyaltyOrderItemsSubtotalAmount.md | 12 + ...sCreateResponseBodyLoyaltyOrderMetadata.md | 11 + ...eateResponseBodyLoyaltyOrderTotalAmount.md | 10 + ...rningRulesCreateResponseBodyLoyaltyTier.md | 9 + ...esEarningRulesCreateResponseBodySegment.md | 9 + ...iesEarningRulesCreateResponseBodySource.md | 11 + ...EarningRulesCreateTierChangeRequestBody.md | 20 + ...RulesCreateTierChangeRequestBodyLoyalty.md | 10 + ...sCreateTierChangeRequestBodyLoyaltyTier.md | 9 + ...gRulesCreateTierChangeRequestBodySource.md | 9 + ...oyaltiesEarningRulesDisableResponseBody.md | 26 + ...ningRulesDisableResponseBodyCustomEvent.md | 9 + ...sEarningRulesDisableResponseBodyLoyalty.md | 15 + ...esDisableResponseBodyLoyaltyCustomEvent.md | 9 + ...eResponseBodyLoyaltyCustomEventMetadata.md | 11 + ...RulesDisableResponseBodyLoyaltyCustomer.md | 9 + ...ableResponseBodyLoyaltyCustomerMetadata.md | 11 + ...ingRulesDisableResponseBodyLoyaltyOrder.md | 11 + ...esDisableResponseBodyLoyaltyOrderAmount.md | 10 + ...lesDisableResponseBodyLoyaltyOrderItems.md | 11 + ...ableResponseBodyLoyaltyOrderItemsAmount.md | 12 + ...leResponseBodyLoyaltyOrderItemsQuantity.md | 12 + ...onseBodyLoyaltyOrderItemsSubtotalAmount.md | 12 + ...DisableResponseBodyLoyaltyOrderMetadata.md | 11 + ...ableResponseBodyLoyaltyOrderTotalAmount.md | 10 + ...ningRulesDisableResponseBodyLoyaltyTier.md | 9 + ...sEarningRulesDisableResponseBodySegment.md | 9 + ...esEarningRulesDisableResponseBodySource.md | 11 + ...LoyaltiesEarningRulesEnableResponseBody.md | 26 + ...rningRulesEnableResponseBodyCustomEvent.md | 9 + ...esEarningRulesEnableResponseBodyLoyalty.md | 15 + ...lesEnableResponseBodyLoyaltyCustomEvent.md | 9 + ...eResponseBodyLoyaltyCustomEventMetadata.md | 11 + ...gRulesEnableResponseBodyLoyaltyCustomer.md | 9 + ...ableResponseBodyLoyaltyCustomerMetadata.md | 11 + ...ningRulesEnableResponseBodyLoyaltyOrder.md | 11 + ...lesEnableResponseBodyLoyaltyOrderAmount.md | 10 + ...ulesEnableResponseBodyLoyaltyOrderItems.md | 11 + ...ableResponseBodyLoyaltyOrderItemsAmount.md | 12 + ...leResponseBodyLoyaltyOrderItemsQuantity.md | 12 + ...onseBodyLoyaltyOrderItemsSubtotalAmount.md | 12 + ...sEnableResponseBodyLoyaltyOrderMetadata.md | 11 + ...ableResponseBodyLoyaltyOrderTotalAmount.md | 10 + ...rningRulesEnableResponseBodyLoyaltyTier.md | 9 + ...esEarningRulesEnableResponseBodySegment.md | 9 + ...iesEarningRulesEnableResponseBodySource.md | 11 + .../LoyaltiesEarningRulesGetResponseBody.md | 27 + ...sEarningRulesGetResponseBodyCustomEvent.md | 9 + ...ltiesEarningRulesGetResponseBodyLoyalty.md | 15 + ...gRulesGetResponseBodyLoyaltyCustomEvent.md | 9 + ...tResponseBodyLoyaltyCustomEventMetadata.md | 11 + ...ningRulesGetResponseBodyLoyaltyCustomer.md | 9 + ...sGetResponseBodyLoyaltyCustomerMetadata.md | 11 + ...EarningRulesGetResponseBodyLoyaltyOrder.md | 11 + ...gRulesGetResponseBodyLoyaltyOrderAmount.md | 10 + ...ngRulesGetResponseBodyLoyaltyOrderItems.md | 11 + ...sGetResponseBodyLoyaltyOrderItemsAmount.md | 12 + ...etResponseBodyLoyaltyOrderItemsQuantity.md | 12 + ...onseBodyLoyaltyOrderItemsSubtotalAmount.md | 12 + ...ulesGetResponseBodyLoyaltyOrderMetadata.md | 11 + ...sGetResponseBodyLoyaltyOrderTotalAmount.md | 10 + ...sEarningRulesGetResponseBodyLoyaltyTier.md | 9 + ...ltiesEarningRulesGetResponseBodySegment.md | 9 + ...altiesEarningRulesGetResponseBodySource.md | 11 + .../LoyaltiesEarningRulesListResponseBody.md | 12 + .../LoyaltiesEarningRulesUpdateRequestBody.md | 18 + ...iesEarningRulesUpdateRequestBodyLoyalty.md | 15 + ...ulesUpdateRequestBodyLoyaltyCustomEvent.md | 9 + ...teRequestBodyLoyaltyCustomEventMetadata.md | 11 + ...ngRulesUpdateRequestBodyLoyaltyCustomer.md | 9 + ...pdateRequestBodyLoyaltyCustomerMetadata.md | 11 + ...rningRulesUpdateRequestBodyLoyaltyOrder.md | 11 + ...ulesUpdateRequestBodyLoyaltyOrderAmount.md | 10 + ...RulesUpdateRequestBodyLoyaltyOrderItems.md | 11 + ...pdateRequestBodyLoyaltyOrderItemsAmount.md | 12 + ...ateRequestBodyLoyaltyOrderItemsQuantity.md | 12 + ...uestBodyLoyaltyOrderItemsSubtotalAmount.md | 12 + ...esUpdateRequestBodyLoyaltyOrderMetadata.md | 11 + ...pdateRequestBodyLoyaltyOrderTotalAmount.md | 10 + ...tiesEarningRulesUpdateRequestBodySource.md | 9 + ...LoyaltiesEarningRulesUpdateResponseBody.md | 27 + ...rningRulesUpdateResponseBodyCustomEvent.md | 9 + ...esEarningRulesUpdateResponseBodyLoyalty.md | 15 + ...lesUpdateResponseBodyLoyaltyCustomEvent.md | 9 + ...eResponseBodyLoyaltyCustomEventMetadata.md | 11 + ...gRulesUpdateResponseBodyLoyaltyCustomer.md | 9 + ...dateResponseBodyLoyaltyCustomerMetadata.md | 11 + ...ningRulesUpdateResponseBodyLoyaltyOrder.md | 11 + ...lesUpdateResponseBodyLoyaltyOrderAmount.md | 10 + ...ulesUpdateResponseBodyLoyaltyOrderItems.md | 11 + ...dateResponseBodyLoyaltyOrderItemsAmount.md | 12 + ...teResponseBodyLoyaltyOrderItemsQuantity.md | 12 + ...onseBodyLoyaltyOrderItemsSubtotalAmount.md | 12 + ...sUpdateResponseBodyLoyaltyOrderMetadata.md | 11 + ...dateResponseBodyLoyaltyOrderTotalAmount.md | 10 + ...rningRulesUpdateResponseBodyLoyaltyTier.md | 9 + ...esEarningRulesUpdateResponseBodySegment.md | 9 + ...iesEarningRulesUpdateResponseBodySource.md | 11 + .../Model/LoyaltiesGetCampaignResponseBody.md | 38 + .../LoyaltiesListCampaignsResponseBody.md | 12 + .../Model/LoyaltiesListMembersResponseBody.md | 12 + docs/Model/LoyaltiesLoyaltyTierReward.md | 11 + ...LoyaltiesMemberActivityListResponseBody.md | 13 + ...oyaltiesMembersBalanceUpdateRequestBody.md | 13 + ...yaltiesMembersBalanceUpdateResponseBody.md | 15 + ...sBalanceUpdateResponseBodyRelatedObject.md | 10 + .../LoyaltiesMembersCreateRequestBody.md | 13 + .../LoyaltiesMembersCreateResponseBody.md | 34 + ...iesMembersCreateResponseBodyLoyaltyCard.md | 12 + ...yaltiesMembersCreateResponseBodyPublish.md | 11 + ...tiesMembersCreateResponseBodyRedemption.md | 13 + docs/Model/LoyaltiesMembersGetResponseBody.md | 34 + ...altiesMembersGetResponseBodyLoyaltyCard.md | 12 + .../LoyaltiesMembersGetResponseBodyPublish.md | 11 + ...yaltiesMembersGetResponseBodyRedemption.md | 13 + ...MembersPointsExpirationListResponseBody.md | 12 + ...ointsExpirationListResponseBodyDataItem.md | 17 + ...xpirationListResponseBodyDataItemBucket.md | 9 + ...ltiesMembersRedemptionRedeemRequestBody.md | 11 + ...embersRedemptionRedeemRequestBodyReward.md | 10 + ...tiesMembersRedemptionRedeemResponseBody.md | 31 + ...bersRedemptionRedeemResponseBodyChannel.md | 10 + ...MembersRedemptionRedeemResponseBodyGift.md | 9 + ...RedemptionRedeemResponseBodyLoyaltyCard.md | 9 + ...ionRedeemResponseBodyRelatedRedemptions.md | 10 + ...seBodyRelatedRedemptionsRedemptionsItem.md | 10 + ...onseBodyRelatedRedemptionsRollbacksItem.md | 10 + ...bersRedemptionRedeemResponseBodyVoucher.md | 38 + ...RedemptionRedeemResponseBodyVoucherGift.md | 11 + ...ionRedeemResponseBodyVoucherLoyaltyCard.md | 12 + ...emptionRedeemResponseBodyVoucherPublish.md | 11 + ...tionRedeemResponseBodyVoucherRedemption.md | 13 + ...LoyaltiesMembersRewardsListResponseBody.md | 12 + ...sMembersRewardsListResponseBodyDataItem.md | 11 + .../LoyaltiesMembersTiersListResponseBody.md | 12 + ...bersTransactionsExportCreateRequestBody.md | 9 + ...ctionsExportCreateRequestBodyParameters.md | 11 + ...ersTransactionsExportCreateResponseBody.md | 17 + ...tionsExportCreateResponseBodyParameters.md | 11 + ...tiesMembersTransactionsListResponseBody.md | 12 + ...ltiesMembersTransfersCreateResponseBody.md | 32 + ...embersTransfersCreateResponseBodyAssets.md | 10 + ...ransfersCreateResponseBodyAssetsBarcode.md | 10 + ...bersTransfersCreateResponseBodyAssetsQr.md | 10 + ...sTransfersCreateResponseBodyLoyaltyCard.md | 12 + ...mbersTransfersCreateResponseBodyPublish.md | 12 + ...rsTransfersCreateResponseBodyRedemption.md | 13 + ...PointsExpirationExportCreateRequestBody.md | 9 + ...rationExportCreateRequestBodyParameters.md | 11 + ...xportCreateRequestBodyParametersFilters.md | 11 + ...eRequestBodyParametersFiltersCampaignId.md | 9 + ...dyParametersFiltersCampaignIdConditions.md | 12 + ...teRequestBodyParametersFiltersVoucherId.md | 9 + ...odyParametersFiltersVoucherIdConditions.md | 12 + ...ointsExpirationExportCreateResponseBody.md | 17 + ...ationExportCreateResponseBodyParameters.md | 11 + ...portCreateResponseBodyParametersFilters.md | 11 + ...ResponseBodyParametersFiltersCampaignId.md | 9 + ...dyParametersFiltersCampaignIdConditions.md | 12 + ...eResponseBodyParametersFiltersVoucherId.md | 9 + ...odyParametersFiltersVoucherIdConditions.md | 12 + ...yaltiesRewardAssignmentsGetResponseBody.md | 16 + ...ardAssignmentsGetResponseBodyParameters.md | 9 + ...gnmentsGetResponseBodyParametersLoyalty.md | 9 + ...altiesRewardAssignmentsListResponseBody.md | 12 + ...sRewardAssignmentsRewardGetResponseBody.md | 19 + ...ignmentsRewardGetResponseBodyAttributes.md | 10 + ...sRewardsCreateAssignmentItemRequestBody.md | 11 + ...eateAssignmentItemRequestBodyParameters.md | 9 + ...ignmentItemRequestBodyParametersLoyalty.md | 9 + ...tiesRewardsCreateAssignmentResponseBody.md | 16 + ...sCreateAssignmentResponseBodyParameters.md | 9 + ...AssignmentResponseBodyParametersLoyalty.md | 9 + docs/Model/LoyaltiesRewardsGetResponseBody.md | 16 + ...yaltiesRewardsGetResponseBodyParameters.md | 9 + ...RewardsGetResponseBodyParametersLoyalty.md | 9 + ...ltiesRewardsListAssignmentsResponseBody.md | 12 + ...ltiesRewardsUpdateAssignmentRequestBody.md | 9 + ...dsUpdateAssignmentRequestBodyParameters.md | 9 + ...eAssignmentRequestBodyParametersLoyalty.md | 9 + ...tiesRewardsUpdateAssignmentResponseBody.md | 16 + ...sUpdateAssignmentResponseBodyParameters.md | 9 + ...AssignmentResponseBodyParametersLoyalty.md | 9 + ...yaltiesTiersCreateInBulkRequestBodyItem.md | 13 + ...altiesTiersEarningRulesListResponseBody.md | 12 + docs/Model/LoyaltiesTiersGetResponseBody.md | 20 + .../LoyaltiesTiersGetResponseBodyConfig.md | 9 + ...yaltiesTiersGetResponseBodyConfigPoints.md | 10 + .../LoyaltiesTiersGetResponseBodyPoints.md | 10 + docs/Model/LoyaltiesTiersListResponseBody.md | 12 + .../LoyaltiesTiersRewardsListResponseBody.md | 12 + docs/Model/LoyaltiesTransferPoints.md | 12 + .../LoyaltiesUpdateCampaignRequestBody.md | 24 + ...yaltiesUpdateCampaignRequestBodyOptions.md | 9 + .../LoyaltiesUpdateCampaignResponseBody.md | 38 + docs/Model/LoyaltyCampaign.md | 38 + docs/Model/LoyaltyCampaignVoucher.md | 18 + .../Model/LoyaltyCampaignVoucherRedemption.md | 9 + docs/Model/LoyaltyCardTransaction.md | 18 + docs/Model/LoyaltyCardTransactionDetails.md | 21 + .../LoyaltyCardTransactionDetailsBalance.md | 14 + ...dTransactionDetailsBalanceRelatedObject.md | 10 + ...oyaltyCardTransactionDetailsCustomEvent.md | 10 + ...oyaltyCardTransactionDetailsEarningRule.md | 10 + ...CardTransactionDetailsEarningRuleSource.md | 9 + .../LoyaltyCardTransactionDetailsEvent.md | 10 + ...oyaltyCardTransactionDetailsEventSchema.md | 10 + ...oyaltyCardTransactionDetailsLoyaltyTier.md | 10 + .../LoyaltyCardTransactionDetailsOrder.md | 10 + ...LoyaltyCardTransactionDetailsRedemption.md | 9 + .../LoyaltyCardTransactionDetailsReward.md | 10 + .../LoyaltyCardTransactionDetailsRollback.md | 9 + .../LoyaltyCardTransactionDetailsSegment.md | 10 + docs/Model/LoyaltyMember.md | 34 + docs/Model/LoyaltyMemberLoyaltyCard.md | 12 + docs/Model/LoyaltyMemberPublish.md | 11 + docs/Model/LoyaltyMemberRedemption.md | 13 + docs/Model/LoyaltyTier.md | 20 + docs/Model/LoyaltyTierBase.md | 12 + docs/Model/LoyaltyTierBasePoints.md | 10 + docs/Model/LoyaltyTierConfig.md | 9 + docs/Model/LoyaltyTierConfigPoints.md | 10 + docs/Model/LoyaltyTierExpiration.md | 15 + docs/Model/LoyaltyTierPoints.md | 10 + docs/Model/LoyaltyTiersExpirationAll.md | 12 + ...LoyaltyTiersExpirationAllExpirationDate.md | 11 + ...iersExpirationAllExpirationDateRounding.md | 12 + .../LoyaltyTiersExpirationAllStartDate.md | 9 + docs/Model/LuckyDraw.md | 11 + docs/Model/MappingPoints.md | 11 + docs/Model/MemberActivity.md | 13 + docs/Model/Order.md | 16 + docs/Model/OrderCalculated.md | 30 + docs/Model/OrderCalculatedCustomer.md | 18 + docs/Model/OrderCalculatedCustomerAddress.md | 14 + docs/Model/OrderCalculatedEssential.md | 18 + docs/Model/OrderCalculatedItem.md | 29 + docs/Model/OrderCalculatedItemProduct.md | 14 + docs/Model/OrderCalculatedItemSku.md | 13 + docs/Model/OrderCalculatedNoCustomerData.md | 30 + docs/Model/OrderCalculatedReferrer.md | 18 + docs/Model/OrderCalculatedReferrerAddress.md | 14 + docs/Model/OrderCreateBase.md | 18 + docs/Model/OrderItem.md | 22 + docs/Model/OrderItemCalculated.md | 28 + docs/Model/OrderItemCalculatedProduct.md | 14 + docs/Model/OrderItemCalculatedSku.md | 13 + docs/Model/OrderItemProduct.md | 14 + docs/Model/OrderItemSku.md | 13 + docs/Model/OrderRedemptions.md | 16 + docs/Model/OrderRedemptionsEntry.md | 16 + docs/Model/OrdersCreateRequestBody.md | 20 + docs/Model/OrdersCreateResponseBody.md | 30 + .../Model/OrdersCreateResponseBodyCustomer.md | 18 + ...OrdersCreateResponseBodyCustomerAddress.md | 14 + .../Model/OrdersCreateResponseBodyReferrer.md | 18 + ...OrdersCreateResponseBodyReferrerAddress.md | 14 + docs/Model/OrdersExportCreateRequestBody.md | 9 + ...OrdersExportCreateRequestBodyParameters.md | 11 + docs/Model/OrdersExportCreateResponseBody.md | 17 + ...rdersExportCreateResponseBodyParameters.md | 11 + docs/Model/OrdersGetResponseBody.md | 30 + .../OrdersImportCreateRequestBodyItem.md | 20 + docs/Model/OrdersImportCreateResponseBody.md | 9 + docs/Model/OrdersListResponseBody.md | 12 + docs/Model/OrdersUpdateRequestBody.md | 19 + docs/Model/OrdersUpdateResponseBody.md | 30 + .../Model/OrdersUpdateResponseBodyCustomer.md | 18 + ...OrdersUpdateResponseBodyCustomerAddress.md | 14 + .../Model/OrdersUpdateResponseBodyReferrer.md | 18 + ...OrdersUpdateResponseBodyReferrerAddress.md | 14 + docs/Model/ParameterActivityCategory.md | 8 + docs/Model/ParameterCampaignType.md | 8 + docs/Model/ParameterCreatedBeforeAfter.md | 10 + docs/Model/ParameterExpandListCampaigns.md | 8 + ...ParameterFiltersListCustomerRedeemables.md | 16 + ...iltersListCustomerRedeemablesCampaignId.md | 10 + ...tersListCustomerRedeemablesCampaignType.md | 10 + ...stomerRedeemablesCampaignTypeConditions.md | 16 + ...FiltersListCustomerRedeemablesCreatedAt.md | 10 + ...tCustomerRedeemablesCreatedAtConditions.md | 14 + ...iltersListCustomerRedeemablesHolderRole.md | 10 + ...CustomerRedeemablesHolderRoleConditions.md | 16 + ...rameterFiltersListCustomerRedeemablesId.md | 10 + ...tersListCustomerRedeemablesRedeemableId.md | 10 + ...ListCustomerRedeemablesRedeemableObject.md | 10 + ...erRedeemablesRedeemableObjectConditions.md | 16 + ...ltersListCustomerRedeemablesVoucherType.md | 10 + ...ustomerRedeemablesVoucherTypeConditions.md | 16 + docs/Model/ParameterFiltersListRedemptions.md | 18 + ...meterFiltersListRedemptionsCampaignName.md | 10 + ...rameterFiltersListRedemptionsCustomerId.md | 10 + ...ameterFiltersListRedemptionsFailureCode.md | 10 + .../ParameterFiltersListRedemptionsObject.md | 10 + ...iltersListRedemptionsParentRedemptionId.md | 10 + ...erFiltersListRedemptionsRelatedObjectId.md | 10 + ...ersListRedemptionsRelatedObjectParentId.md | 10 + .../ParameterFiltersListRedemptionsResult.md | 10 + ...arameterFiltersListRedemptionsUserLogin.md | 10 + ...ameterFiltersListRedemptionsVoucherCode.md | 10 + docs/Model/ParameterOrder.md | 8 + docs/Model/ParameterOrderCreatedAt.md | 8 + .../ParameterOrderListAllPromotionStacks.md | 8 + docs/Model/ParameterOrderListCampaigns.md | 8 + docs/Model/ParameterOrderListCustomers.md | 8 + docs/Model/ParameterOrderListEarningRules.md | 8 + docs/Model/ParameterOrderListExports.md | 8 + docs/Model/ParameterOrderListLoyaltyTiers.md | 8 + docs/Model/ParameterOrderListOrders.md | 8 + .../Model/ParameterOrderListPromotionTiers.md | 8 + ...ameterOrderListPromotionTiersClientSide.md | 8 + docs/Model/ParameterOrderListPublications.md | 8 + docs/Model/ParameterOrderListRedeemables.md | 8 + docs/Model/ParameterOrderListRedemptions.md | 8 + ...meterOrderListValidationRuleAssignments.md | 8 + .../ParameterOrderListValidationRules.md | 8 + docs/Model/ParameterOrderVouchers.md | 8 + docs/Model/ParameterResultListPublications.md | 8 + docs/Model/ParameterUpdatedBeforeAfter.md | 10 + .../ParameterVoucherTypeListPublications.md | 8 + docs/Model/Product.md | 19 + .../ProductCollectionsCreateRequestBody.md | 12 + ...oductCollectionsCreateRequestBodyFilter.md | 21 + ...ollectionsCreateRequestBodyProductsItem.md | 11 + .../ProductCollectionsCreateResponseBody.md | 15 + ...ductCollectionsCreateResponseBodyFilter.md | 21 + ...llectionsCreateResponseBodyProductsItem.md | 11 + .../ProductCollectionsGetResponseBody.md | 15 + ...ProductCollectionsGetResponseBodyFilter.md | 21 + ...tCollectionsGetResponseBodyProductsItem.md | 11 + docs/Model/ProductCollectionsItem.md | 15 + docs/Model/ProductCollectionsItemFilter.md | 21 + .../ProductCollectionsItemProductsItem.md | 11 + .../ProductCollectionsListResponseBody.md | 12 + ...ductCollectionsProductsListResponseBody.md | 12 + ...ectionsProductsListResponseBodyDataItem.md | 22 + docs/Model/ProductWithoutSkus.md | 18 + docs/Model/ProductsCreateRequestBody.md | 15 + docs/Model/ProductsCreateResponseBody.md | 19 + docs/Model/ProductsGetResponseBody.md | 19 + .../ProductsImportCsvCreateResponseBody.md | 9 + docs/Model/ProductsListResponseBody.md | 12 + ...ProductsMetadataUpdateInBulkRequestBody.md | 10 + ...roductsMetadataUpdateInBulkResponseBody.md | 9 + docs/Model/ProductsSkusCreateRequestBody.md | 16 + docs/Model/ProductsSkusCreateResponseBody.md | 20 + docs/Model/ProductsSkusListResponseBody.md | 12 + docs/Model/ProductsSkusUpdateRequestBody.md | 14 + docs/Model/ProductsSkusUpdateResponseBody.md | 20 + docs/Model/ProductsUpdateInBulkRequestBody.md | 14 + .../Model/ProductsUpdateInBulkResponseBody.md | 9 + docs/Model/ProductsUpdateRequestBody.md | 13 + docs/Model/ProductsUpdateResponseBody.md | 19 + docs/Model/PromotionStack.md | 17 + docs/Model/PromotionStackBase.md | 10 + docs/Model/PromotionStackBaseTiers.md | 10 + docs/Model/PromotionStackTiers.md | 10 + docs/Model/PromotionTier.md | 30 + docs/Model/PromotionTierAction.md | 9 + docs/Model/PromotionTierCampaign.md | 17 + docs/Model/PromotionTierCreateParams.md | 22 + docs/Model/PromotionTierCreateParamsAction.md | 9 + docs/Model/PromotionTierSummary.md | 10 + docs/Model/PromotionTierSummaryOrders.md | 10 + docs/Model/PromotionTierSummaryRedemptions.md | 9 + docs/Model/PromotionTiersList.md | 13 + .../PromotionsStacksCreateRequestBody.md | 11 + .../PromotionsStacksCreateRequestBodyTiers.md | 10 + .../PromotionsStacksCreateResponseBody.md | 16 + ...PromotionsStacksCreateResponseBodyTiers.md | 10 + docs/Model/PromotionsStacksGetResponseBody.md | 17 + .../PromotionsStacksGetResponseBodyTiers.md | 10 + .../Model/PromotionsStacksListResponseBody.md | 12 + .../PromotionsStacksUpdateRequestBody.md | 11 + .../PromotionsStacksUpdateRequestBodyTiers.md | 10 + .../PromotionsStacksUpdateResponseBody.md | 17 + ...PromotionsStacksUpdateResponseBodyTiers.md | 10 + .../Model/PromotionsTiersCreateRequestBody.md | 22 + .../PromotionsTiersCreateRequestBodyAction.md | 9 + .../PromotionsTiersCreateResponseBody.md | 30 + ...PromotionsTiersCreateResponseBodyAction.md | 9 + ...omotionsTiersCreateResponseBodyCampaign.md | 17 + ...romotionsTiersCreateResponseBodySummary.md | 10 + ...onsTiersCreateResponseBodySummaryOrders.md | 10 + ...ersCreateResponseBodySummaryRedemptions.md | 9 + .../PromotionsTiersDisableResponseBody.md | 30 + ...romotionsTiersDisableResponseBodyAction.md | 9 + ...motionsTiersDisableResponseBodyCampaign.md | 17 + ...omotionsTiersDisableResponseBodySummary.md | 10 + ...nsTiersDisableResponseBodySummaryOrders.md | 10 + ...rsDisableResponseBodySummaryRedemptions.md | 9 + .../PromotionsTiersEnableResponseBody.md | 30 + ...PromotionsTiersEnableResponseBodyAction.md | 9 + ...omotionsTiersEnableResponseBodyCampaign.md | 17 + ...romotionsTiersEnableResponseBodySummary.md | 10 + ...onsTiersEnableResponseBodySummaryOrders.md | 10 + ...ersEnableResponseBodySummaryRedemptions.md | 9 + docs/Model/PromotionsTiersGetResponseBody.md | 30 + .../PromotionsTiersGetResponseBodyAction.md | 9 + .../PromotionsTiersGetResponseBodyCampaign.md | 17 + .../PromotionsTiersGetResponseBodySummary.md | 10 + ...otionsTiersGetResponseBodySummaryOrders.md | 10 + ...sTiersGetResponseBodySummaryRedemptions.md | 9 + docs/Model/PromotionsTiersListResponseBody.md | 13 + .../Model/PromotionsTiersUpdateRequestBody.md | 21 + .../PromotionsTiersUpdateRequestBodyAction.md | 9 + .../PromotionsTiersUpdateResponseBody.md | 30 + ...PromotionsTiersUpdateResponseBodyAction.md | 9 + ...omotionsTiersUpdateResponseBodyCampaign.md | 17 + ...romotionsTiersUpdateResponseBodySummary.md | 10 + ...onsTiersUpdateResponseBodySummaryOrders.md | 10 + ...ersUpdateResponseBodySummaryRedemptions.md | 9 + docs/Model/PublicationsCreateRequestBody.md | 14 + .../PublicationsCreateRequestBodyCustomer.md | 18 + ...cationsCreateRequestBodyCustomerAddress.md | 14 + docs/Model/PublicationsCreateResponseBody.md | 21 + docs/Model/PublicationsListResponseBody.md | 12 + ...cationsListResponseBodyPublicationsItem.md | 23 + ...istResponseBodyPublicationsItemMetadata.md | 11 + ...alificationsCheckEligibilityRequestBody.md | 14 + ...lificationsCheckEligibilityResponseBody.md | 12 + ...ationsCheckEligibilityResponseBodyOrder.md | 20 + docs/Model/QualificationsFieldConditions.md | 9 + docs/Model/QualificationsFiltersCondition.md | 14 + docs/Model/QualificationsOption.md | 13 + docs/Model/QualificationsOptionFilters.md | 17 + ...QualificationsOptionFiltersCampaignType.md | 9 + ...ionsOptionFiltersCampaignTypeConditions.md | 12 + .../QualificationsOptionFiltersHolderRole.md | 9 + ...ationsOptionFiltersHolderRoleConditions.md | 12 + ...QualificationsOptionFiltersResourceType.md | 9 + ...ionsOptionFiltersResourceTypeConditions.md | 12 + docs/Model/QualificationsRedeemable.md | 24 + docs/Model/QualificationsRedeemableBase.md | 23 + docs/Model/QualificationsRedeemables.md | 14 + docs/Model/RedeemableGift.md | 10 + docs/Model/RedeemableLoyaltyCard.md | 13 + docs/Model/RedeemableResult.md | 12 + docs/Model/RedeemableVoucher.md | 36 + docs/Model/RedeemableVoucherGift.md | 11 + docs/Model/RedeemableVoucherLoyaltyCard.md | 12 + docs/Model/RedeemableVoucherPublish.md | 11 + docs/Model/RedeemableVoucherRedemption.md | 13 + docs/Model/Redemption.md | 31 + docs/Model/RedemptionChannel.md | 10 + docs/Model/RedemptionEntry.md | 32 + docs/Model/RedemptionEntryChannel.md | 10 + docs/Model/RedemptionEntryCustomer.md | 14 + docs/Model/RedemptionEntryGift.md | 9 + docs/Model/RedemptionEntryLoyaltyCard.md | 9 + docs/Model/RedemptionEntryOrder.md | 30 + docs/Model/RedemptionEntryOrderCustomer.md | 10 + docs/Model/RedemptionEntryOrderReferrer.md | 10 + docs/Model/RedemptionEntryPromotionTier.md | 30 + .../RedemptionEntryPromotionTierAction.md | 9 + .../RedemptionEntryPromotionTierCampaign.md | 17 + .../RedemptionEntryPromotionTierSummary.md | 10 + ...demptionEntryPromotionTierSummaryOrders.md | 10 + ...ionEntryPromotionTierSummaryRedemptions.md | 9 + .../RedemptionEntryRelatedRedemptions.md | 10 + ...nEntryRelatedRedemptionsRedemptionsItem.md | 10 + ...ionEntryRelatedRedemptionsRollbacksItem.md | 10 + docs/Model/RedemptionEntryVoucher.md | 38 + docs/Model/RedemptionEntryVoucherGift.md | 11 + .../RedemptionEntryVoucherLoyaltyCard.md | 12 + docs/Model/RedemptionEntryVoucherPublish.md | 11 + .../Model/RedemptionEntryVoucherRedemption.md | 13 + docs/Model/RedemptionGift.md | 9 + docs/Model/RedemptionLoyaltyCard.md | 9 + docs/Model/RedemptionRelatedRedemptions.md | 10 + ...mptionRelatedRedemptionsRedemptionsItem.md | 10 + ...demptionRelatedRedemptionsRollbacksItem.md | 10 + docs/Model/RedemptionRewardResult.md | 22 + .../Model/RedemptionRewardResultParameters.md | 11 + ...edemptionRewardResultParametersCampaign.md | 11 + .../RedemptionRewardResultParametersCoin.md | 10 + ...RedemptionRewardResultParametersProduct.md | 10 + docs/Model/RedemptionRollback.md | 32 + docs/Model/RedemptionRollbackChannel.md | 10 + docs/Model/RedemptionRollbackGift.md | 9 + docs/Model/RedemptionRollbackLoyaltyCard.md | 9 + .../RedemptionRollbackRelatedRedemptions.md | 10 + ...llbackRelatedRedemptionsRedemptionsItem.md | 10 + ...RollbackRelatedRedemptionsRollbacksItem.md | 10 + docs/Model/RedemptionVoucher.md | 38 + docs/Model/RedemptionVoucherGift.md | 11 + docs/Model/RedemptionVoucherLoyaltyCard.md | 12 + docs/Model/RedemptionVoucherPublish.md | 11 + docs/Model/RedemptionVoucherRedemption.md | 13 + docs/Model/RedemptionsGetResponseBody.md | 32 + .../RedemptionsGetResponseBodyChannel.md | 10 + .../RedemptionsGetResponseBodyCustomer.md | 14 + docs/Model/RedemptionsGetResponseBodyGift.md | 9 + .../RedemptionsGetResponseBodyLoyaltyCard.md | 9 + docs/Model/RedemptionsGetResponseBodyOrder.md | 30 + ...RedemptionsGetResponseBodyOrderCustomer.md | 10 + ...RedemptionsGetResponseBodyOrderReferrer.md | 10 + ...RedemptionsGetResponseBodyPromotionTier.md | 30 + ...tionsGetResponseBodyPromotionTierAction.md | 9 + ...onsGetResponseBodyPromotionTierCampaign.md | 17 + ...ionsGetResponseBodyPromotionTierSummary.md | 10 + ...tResponseBodyPromotionTierSummaryOrders.md | 10 + ...onseBodyPromotionTierSummaryRedemptions.md | 9 + ...ptionsGetResponseBodyRelatedRedemptions.md | 10 + ...seBodyRelatedRedemptionsRedemptionsItem.md | 10 + ...onseBodyRelatedRedemptionsRollbacksItem.md | 10 + .../RedemptionsGetResponseBodyVoucher.md | 38 + .../RedemptionsGetResponseBodyVoucherGift.md | 11 + ...ptionsGetResponseBodyVoucherLoyaltyCard.md | 12 + ...edemptionsGetResponseBodyVoucherPublish.md | 11 + ...mptionsGetResponseBodyVoucherRedemption.md | 13 + docs/Model/RedemptionsListResponseBody.md | 12 + ...emptionsListResponseBodyRedemptionsItem.md | 32 + ...sListResponseBodyRedemptionsItemChannel.md | 10 + ...ListResponseBodyRedemptionsItemCustomer.md | 14 + ...ionsListResponseBodyRedemptionsItemGift.md | 9 + ...tResponseBodyRedemptionsItemLoyaltyCard.md | 9 + ...onsListResponseBodyRedemptionsItemOrder.md | 30 + ...esponseBodyRedemptionsItemOrderCustomer.md | 10 + ...esponseBodyRedemptionsItemOrderReferrer.md | 10 + ...esponseBodyRedemptionsItemPromotionTier.md | 30 + ...eBodyRedemptionsItemPromotionTierAction.md | 9 + ...odyRedemptionsItemPromotionTierCampaign.md | 17 + ...BodyRedemptionsItemPromotionTierSummary.md | 10 + ...demptionsItemPromotionTierSummaryOrders.md | 10 + ...ionsItemPromotionTierSummaryRedemptions.md | 9 + ...seBodyRedemptionsItemRelatedRedemptions.md | 10 + ...nsItemRelatedRedemptionsRedemptionsItem.md | 10 + ...ionsItemRelatedRedemptionsRollbacksItem.md | 10 + ...sListResponseBodyRedemptionsItemVoucher.md | 38 + ...tResponseBodyRedemptionsItemVoucherGift.md | 11 + ...seBodyRedemptionsItemVoucherLoyaltyCard.md | 12 + ...sponseBodyRedemptionsItemVoucherPublish.md | 11 + ...nseBodyRedemptionsItemVoucherRedemption.md | 13 + docs/Model/RedemptionsRedeemRequestBody.md | 15 + .../RedemptionsRedeemRequestBodyOptions.md | 9 + ...mptionsRedeemRequestBodyRedeemablesItem.md | 12 + ...onsRedeemRequestBodyRedeemablesItemGift.md | 9 + ...sRedeemRequestBodyRedeemablesItemReward.md | 10 + docs/Model/RedemptionsRedeemResponseBody.md | 13 + .../RedemptionsRollbackCreateRequestBody.md | 13 + .../RedemptionsRollbackCreateResponseBody.md | 32 + ...ptionsRollbackCreateResponseBodyChannel.md | 10 + ...demptionsRollbackCreateResponseBodyGift.md | 9 + ...nsRollbackCreateResponseBodyLoyaltyCard.md | 9 + ...ackCreateResponseBodyRelatedRedemptions.md | 10 + ...seBodyRelatedRedemptionsRedemptionsItem.md | 10 + ...onseBodyRelatedRedemptionsRollbacksItem.md | 10 + .../RedemptionsRollbacksCreateRequestBody.md | 13 + .../RedemptionsRollbacksCreateResponseBody.md | 11 + docs/Model/ReferralProgram.md | 11 + docs/Model/ReferralProgramCustomEvent.md | 10 + docs/Model/ReferralProgramRefereeReward.md | 11 + ...ProgramRefereeRewardRelatedObjectParent.md | 11 + docs/Model/Referrer.md | 18 + docs/Model/ReferrerAddress.md | 14 + docs/Model/ReferrerId.md | 10 + docs/Model/Reward.md | 19 + docs/Model/RewardAssignment.md | 16 + docs/Model/RewardAssignmentParameters.md | 9 + .../RewardAssignmentParametersLoyalty.md | 9 + docs/Model/RewardAttributes.md | 10 + docs/Model/RewardType.md | 11 + docs/Model/RewardTypeCampaign.md | 11 + docs/Model/RewardTypeCoin.md | 10 + docs/Model/RewardTypeProduct.md | 10 + .../RewardsAssignmentsCreateRequestBody.md | 11 + ...sAssignmentsCreateRequestBodyParameters.md | 9 + ...mentsCreateRequestBodyParametersLoyalty.md | 9 + .../RewardsAssignmentsCreateResponseBody.md | 16 + ...AssignmentsCreateResponseBodyParameters.md | 9 + ...entsCreateResponseBodyParametersLoyalty.md | 9 + .../RewardsAssignmentsGetResponseBody.md | 16 + ...rdsAssignmentsGetResponseBodyParameters.md | 9 + ...gnmentsGetResponseBodyParametersLoyalty.md | 9 + .../RewardsAssignmentsListResponseBody.md | 12 + .../RewardsAssignmentsUpdateRequestBody.md | 9 + ...sAssignmentsUpdateRequestBodyParameters.md | 9 + ...mentsUpdateRequestBodyParametersLoyalty.md | 9 + .../RewardsAssignmentsUpdateResponseBody.md | 16 + ...AssignmentsUpdateResponseBodyParameters.md | 9 + ...entsUpdateResponseBodyParametersLoyalty.md | 9 + docs/Model/RewardsCreateRequestBody.md | 13 + .../RewardsCreateRequestBodyAttributes.md | 10 + .../RewardsCreateRequestBodyParameters.md | 11 + ...ardsCreateRequestBodyParametersCampaign.md | 10 + .../RewardsCreateRequestBodyParametersCoin.md | 10 + ...wardsCreateRequestBodyParametersProduct.md | 10 + docs/Model/RewardsCreateResponseBody.md | 19 + .../RewardsCreateResponseBodyAttributes.md | 10 + docs/Model/RewardsListResponseBody.md | 12 + docs/Model/RewardsUpdateRequestBody.md | 13 + .../RewardsUpdateRequestBodyAttributes.md | 10 + .../RewardsUpdateRequestBodyParameters.md | 11 + ...ardsUpdateRequestBodyParametersCampaign.md | 10 + .../RewardsUpdateRequestBodyParametersCoin.md | 10 + ...wardsUpdateRequestBodyParametersProduct.md | 10 + docs/Model/RewardsUpdateResponseBody.md | 19 + .../RewardsUpdateResponseBodyAttributes.md | 10 + docs/Model/SegmentsCreateRequestBody.md | 12 + docs/Model/SegmentsCreateResponseBody.md | 15 + docs/Model/SegmentsGetResponseBody.md | 15 + docs/Model/Session.md | 12 + docs/Model/SimpleCustomer.md | 14 + .../Model/SimpleCustomerRequiredObjectType.md | 14 + docs/Model/SimpleLoyaltyCard.md | 12 + docs/Model/SimpleProductDiscountUnit.md | 11 + docs/Model/SimpleSegment.md | 11 + docs/Model/SimpleSkuDiscountUnit.md | 11 + docs/Model/SimpleVoucher.md | 29 + docs/Model/SimpleVoucherLoyaltyCard.md | 12 + docs/Model/SimpleVoucherRedemption.md | 10 + docs/Model/Sku.md | 20 + docs/Model/SkusGetResponseBody.md | 20 + docs/Model/SkusImportCsvCreateResponseBody.md | 9 + docs/Model/SkusListForProduct.md | 12 + docs/Model/StackingRules.md | 19 + docs/Model/ValidationRule.md | 19 + docs/Model/ValidationRuleApplicableTo.md | 11 + docs/Model/ValidationRuleAssignment.md | 14 + docs/Model/ValidationRuleAssignmentsList.md | 12 + docs/Model/ValidationRuleError.md | 9 + ...dationRulesAssignmentsCreateRequestBody.md | 10 + ...ationRulesAssignmentsCreateResponseBody.md | 14 + docs/Model/ValidationRulesAssignmentsList.md | 12 + ...idationRulesAssignmentsListResponseBody.md | 12 + .../Model/ValidationRulesCreateRequestBody.md | 14 + ...ationRulesCreateRequestBodyApplicableTo.md | 11 + .../ValidationRulesCreateRequestBodyError.md | 9 + .../ValidationRulesCreateResponseBody.md | 19 + ...tionRulesCreateResponseBodyApplicableTo.md | 11 + .../ValidationRulesCreateResponseBodyError.md | 9 + docs/Model/ValidationRulesGetResponseBody.md | 19 + ...idationRulesGetResponseBodyApplicableTo.md | 11 + .../ValidationRulesGetResponseBodyError.md | 9 + docs/Model/ValidationRulesListResponseBody.md | 12 + .../Model/ValidationRulesUpdateRequestBody.md | 14 + ...ationRulesUpdateRequestBodyApplicableTo.md | 11 + .../ValidationRulesUpdateRequestBodyError.md | 9 + .../ValidationRulesUpdateResponseBody.md | 19 + ...tionRulesUpdateResponseBodyApplicableTo.md | 11 + .../ValidationRulesUpdateResponseBodyError.md | 9 + .../ValidationsRedeemableInapplicable.md | 14 + ...ValidationsRedeemableInapplicableResult.md | 10 + ...ionsRedeemableInapplicableResultDetails.md | 10 + docs/Model/ValidationsRedeemableSkipped.md | 14 + .../ValidationsRedeemableSkippedResult.md | 9 + ...lidationsRedeemableSkippedResultDetails.md | 10 + docs/Model/ValidationsValidateRequestBody.md | 15 + .../ValidationsValidateRequestBodyOptions.md | 9 + ...tionsValidateRequestBodyRedeemablesItem.md | 12 + ...sValidateRequestBodyRedeemablesItemGift.md | 9 + ...alidateRequestBodyRedeemablesItemReward.md | 10 + docs/Model/ValidationsValidateResponseBody.md | 16 + ...ionsValidateResponseBodyRedeemablesItem.md | 17 + ...lidateResponseBodyRedeemablesItemResult.md | 13 + ...esponseBodyRedeemablesItemResultDetails.md | 10 + ...sponseBodyRedeemablesItemResultDiscount.md | 25 + ...odyRedeemablesItemResultDiscountProduct.md | 11 + ...teResponseBodyRedeemablesItemResultGift.md | 9 + ...nseBodyRedeemablesItemResultLoyaltyCard.md | 9 + docs/Model/ValidityHours.md | 9 + docs/Model/ValidityHoursDailyItem.md | 11 + docs/Model/ValidityTimeframe.md | 10 + docs/Model/Voucher.md | 37 + docs/Model/VoucherAssets.md | 10 + docs/Model/VoucherAssetsBarcode.md | 10 + docs/Model/VoucherAssetsQr.md | 10 + docs/Model/VoucherGift.md | 11 + docs/Model/VoucherLoyaltyCard.md | 12 + docs/Model/VoucherPublish.md | 11 + docs/Model/VoucherRedemption.md | 13 + docs/Model/VoucherTransaction.md | 18 + docs/Model/VoucherTransactionDetails.md | 21 + .../Model/VoucherTransactionDetailsBalance.md | 14 + ...rTransactionDetailsBalanceRelatedObject.md | 10 + .../VoucherTransactionDetailsCustomEvent.md | 10 + .../VoucherTransactionDetailsEarningRule.md | 10 + ...cherTransactionDetailsEarningRuleSource.md | 9 + docs/Model/VoucherTransactionDetailsEvent.md | 10 + .../VoucherTransactionDetailsEventSchema.md | 10 + .../VoucherTransactionDetailsLoyaltyTier.md | 10 + docs/Model/VoucherTransactionDetailsOrder.md | 10 + .../VoucherTransactionDetailsRedemption.md | 9 + docs/Model/VoucherTransactionDetailsReward.md | 10 + .../VoucherTransactionDetailsRollback.md | 9 + .../Model/VoucherTransactionDetailsSegment.md | 10 + ...ucherTransactionsExportFilterConditions.md | 9 + ...sactionsExportFilterConditionsVoucherId.md | 9 + ...portFilterConditionsVoucherIdConditions.md | 9 + .../VoucherTransactionsExportParameters.md | 10 + docs/Model/VoucherTransactionsFilters.md | 11 + docs/Model/VoucherWithCategories.md | 36 + docs/Model/VoucherWithCategoriesGift.md | 11 + .../Model/VoucherWithCategoriesLoyaltyCard.md | 12 + docs/Model/VoucherWithCategoriesPublish.md | 11 + docs/Model/VoucherWithCategoriesRedemption.md | 13 + .../Model/VouchersBalanceUpdateRequestBody.md | 11 + .../VouchersBalanceUpdateResponseBody.md | 15 + ...sBalanceUpdateResponseBodyRelatedObject.md | 10 + docs/Model/VouchersCreateResponseBody.md | 37 + docs/Model/VouchersCreateResponseBodyGift.md | 11 + .../VouchersCreateResponseBodyLoyaltyCard.md | 12 + .../VouchersCreateResponseBodyPublish.md | 11 + .../VouchersCreateResponseBodyRedemption.md | 13 + ...uchersCreateWithSpecificCodeRequestBody.md | 26 + ...teWithSpecificCodeRequestBodyRedemption.md | 9 + docs/Model/VouchersDisableResponseBody.md | 37 + docs/Model/VouchersDisableResponseBodyGift.md | 11 + .../VouchersDisableResponseBodyLoyaltyCard.md | 12 + .../VouchersDisableResponseBodyPublish.md | 11 + .../VouchersDisableResponseBodyRedemption.md | 13 + docs/Model/VouchersEnableResponseBody.md | 37 + docs/Model/VouchersEnableResponseBodyGift.md | 11 + .../VouchersEnableResponseBodyLoyaltyCard.md | 12 + .../VouchersEnableResponseBodyPublish.md | 11 + .../VouchersEnableResponseBodyRedemption.md | 13 + docs/Model/VouchersGetResponseBody.md | 37 + docs/Model/VouchersGetResponseBodyGift.md | 11 + .../VouchersGetResponseBodyLoyaltyCard.md | 12 + docs/Model/VouchersGetResponseBodyPublish.md | 11 + .../VouchersGetResponseBodyRedemption.md | 13 + .../VouchersImportCreateItemRequestBody.md | 21 + ...rsImportCreateItemRequestBodyRedemption.md | 9 + .../Model/VouchersImportCreateResponseBody.md | 9 + .../VouchersImportCsvCreateResponseBody.md | 9 + docs/Model/VouchersListResponseBody.md | 12 + ...VouchersMetadataUpdateInBulkRequestBody.md | 10 + ...ouchersMetadataUpdateInBulkResponseBody.md | 9 + .../VouchersRedemptionGetResponseBody.md | 15 + ...hersTransactionsExportCreateRequestBody.md | 9 + ...ersTransactionsExportCreateResponseBody.md | 17 + ...nsactionsExportCreateResponseBodyResult.md | 9 + .../VouchersTransactionsListResponseBody.md | 12 + .../VouchersUpdateInBulkItemRequestBody.md | 10 + .../Model/VouchersUpdateInBulkResponseBody.md | 9 + docs/Model/VouchersUpdateRequestBody.md | 22 + docs/Model/VouchersUpdateResponseBody.md | 37 + docs/Model/VouchersUpdateResponseBodyGift.md | 11 + .../VouchersUpdateResponseBodyLoyaltyCard.md | 12 + .../VouchersUpdateResponseBodyPublish.md | 11 + .../VouchersUpdateResponseBodyRedemption.md | 13 + phpunit.xml | 19 - phpunit.xml.dist | 18 + src/Api/AsyncActionsApi.php | 749 + src/Api/CampaignsApi.php | 3577 ++++ src/Api/CategoriesApi.php | 1553 ++ src/Api/ClientSideApi.php | 1703 ++ src/Api/CustomersApi.php | 4268 +++++ src/Api/EventsApi.php | 430 + src/Api/ExportsApi.php | 1602 ++ src/Api/LoyaltiesApi.php | 14320 ++++++++++++++++ src/Api/OrdersApi.php | 1946 +++ src/Api/ProductCollectionsApi.php | 1669 ++ src/Api/ProductsApi.php | 4415 +++++ src/Api/PromotionsApi.php | 4408 +++++ src/Api/PublicationsApi.php | 1270 ++ src/Api/QualificationsApi.php | 430 + src/Api/RedemptionsApi.php | 2108 +++ src/Api/RewardsApi.php | 3164 ++++ src/Api/SegmentsApi.php | 968 ++ src/Api/ValidationRulesApi.php | 2942 ++++ src/Api/ValidationsApi.php | 430 + src/Api/VouchersApi.php | 5055 ++++++ src/ApiClient.php | 251 - src/ApiException.php | 120 + src/AsyncActions.php | 46 - src/Campaigns.php | 87 - src/ClientException.php | 85 - src/Configuration.php | 546 + src/CustomEvents.php | 53 - src/CustomerBuilder.php | 42 - src/Customers.php | 93 - src/Distributions.php | 88 - src/HeaderSelector.php | 246 + .../AccessSettingsCampaignAssignmentsList.php | 614 + src/Model/ApplicableTo.php | 1145 ++ src/Model/ApplicableToResultList.php | 613 + src/Model/AreaStoreCampaignAssignment.php | 614 + src/Model/AsyncActionBase.php | 873 + src/Model/AsyncActionGetResponseBody.php | 914 + src/Model/AsyncActionsListResponseBody.php | 564 + src/Model/BusValRuleAssignment.php | 814 + src/Model/CampaignBase.php | 1721 ++ src/Model/CampaignLoyaltyCard.php | 459 + .../CampaignLoyaltyCardExpirationRules.php | 612 + src/Model/CampaignLoyaltyVoucher.php | 562 + .../CampaignLoyaltyVoucherRedemption.php | 418 + src/Model/CampaignVoucher.php | 864 + src/Model/CampaignVoucherRedemption.php | 418 + src/Model/CampaignsCreateRequestBody.php | 1368 ++ .../CampaignsCreateRequestBodyPromotion.php | 417 + .../CampaignsCreateRequestBodyVoucher.php | 671 + ...ignsCreateRequestBodyVoucherRedemption.php | 417 + src/Model/CampaignsCreateResponseBody.php | 1823 ++ src/Model/CampaignsDeleteResponseBody.php | 418 + src/Model/CampaignsGetResponseBody.php | 1823 ++ .../CampaignsImportCreateResponseBody.php | 418 + .../CampaignsImportCsvCreateResponseBody.php | 418 + src/Model/CampaignsImportVoucherItem.php | 992 ++ .../CampaignsImportVoucherItemRedemption.php | 417 + src/Model/CampaignsListResponseBody.php | 541 + src/Model/CampaignsUpdateRequestBody.php | 1313 ++ .../CampaignsUpdateRequestBodyOptions.php | 417 + src/Model/CampaignsUpdateResponseBody.php | 1823 ++ ...ignsVouchersCreateCombinedResponseBody.php | 1641 ++ ...VouchersCreateCombinedResponseBodyGift.php | 534 + ...sCreateCombinedResponseBodyLoyaltyCard.php | 541 + ...chersCreateCombinedResponseBodyPublish.php | 500 + ...rsCreateCombinedResponseBodyRedemption.php | 582 + ...mpaignsVouchersCreateInBulkRequestBody.php | 698 + ...chersCreateInBulkRequestBodyRedemption.php | 418 + .../CampaignsVouchersCreateRequestBody.php | 623 + ...gnsVouchersCreateRequestBodyRedemption.php | 418 + .../CampaignsVouchersCreateResponseBody.php | 1601 ++ ...ampaignsVouchersCreateResponseBodyGift.php | 534 + ...sVouchersCreateResponseBodyLoyaltyCard.php | 541 + ...aignsVouchersCreateResponseBodyPublish.php | 500 + ...nsVouchersCreateResponseBodyRedemption.php | 582 + src/Model/CategoriesCreateRequestBody.php | 459 + src/Model/CategoriesCreateResponseBody.php | 614 + src/Model/CategoriesGetResponseBody.php | 730 + src/Model/CategoriesListResponseBody.php | 605 + src/Model/CategoriesUpdateRequestBody.php | 459 + src/Model/CategoriesUpdateResponseBody.php | 655 + src/Model/Category.php | 730 + src/Model/ClientEventsCreateRequestBody.php | 593 + .../ClientEventsCreateRequestBodyLoyalty.php | 418 + .../ClientEventsCreateRequestBodyReferral.php | 459 + src/Model/ClientEventsCreateResponseBody.php | 651 + .../ClientPromotionsTiersListResponseBody.php | 582 + ...lificationsCheckEligibilityRequestBody.php | 648 + ...ificationsCheckEligibilityResponseBody.php | 520 + .../ClientRedemptionsRedeemRequestBody.php | 643 + ...entRedemptionsRedeemRequestBodyOptions.php | 446 + ...ptionsRedeemRequestBodyRedeemablesItem.php | 562 + ...nsRedeemRequestBodyRedeemablesItemGift.php | 418 + ...RedeemRequestBodyRedeemablesItemReward.php | 459 + .../ClientRedemptionsRedeemResponseBody.php | 568 + .../ClientValidationsValidateRequestBody.php | 643 + ...tValidationsValidateRequestBodyOptions.php | 446 + ...ionsValidateRequestBodyRedeemablesItem.php | 562 + ...ValidateRequestBodyRedeemablesItemGift.php | 418 + ...lidateRequestBodyRedeemablesItemReward.php | 459 + .../ClientValidationsValidateResponseBody.php | 687 + ...onsValidateResponseBodyRedeemablesItem.php | 773 + ...idateResponseBodyRedeemablesItemResult.php | 553 + ...sponseBodyRedeemablesItemResultDetails.php | 444 + ...ponseBodyRedeemablesItemResultDiscount.php | 1129 ++ ...dyRedeemablesItemResultDiscountProduct.php | 499 + ...eResponseBodyRedeemablesItemResultGift.php | 418 + ...seBodyRedeemablesItemResultLoyaltyCard.php | 417 + src/Model/CodeConfig.php | 623 + src/Model/CreatePublicationCampaign.php | 475 + src/Model/Customer.php | 786 + src/Model/CustomerActivity.php | 582 + src/Model/CustomerAddress.php | 623 + src/Model/CustomerId.php | 490 + src/Model/CustomerLoyalty.php | 499 + src/Model/CustomerLoyaltyCampaignsEntry.php | 479 + src/Model/CustomerRedeemable.php | 903 + src/Model/CustomerRedeemableRedeemable.php | 538 + src/Model/CustomerReferrals.php | 459 + src/Model/CustomerReferralsCampaignsItem.php | 562 + src/Model/CustomerSummary.php | 450 + src/Model/CustomerSummaryOrders.php | 581 + src/Model/CustomerSummaryRedemptions.php | 704 + src/Model/CustomerSummaryRedemptionsGift.php | 459 + .../CustomerSummaryRedemptionsLoyaltyCard.php | 459 + .../CustomerWithSummaryLoyaltyReferrals.php | 1125 ++ ...omerWithSummaryLoyaltyReferralsAddress.php | 623 + ...tomerWithSummaryLoyaltyReferralsAssets.php | 418 + .../CustomersActivityListResponseBody.php | 614 + src/Model/CustomersCreateRequestBody.php | 787 + .../CustomersCreateRequestBodyAddress.php | 623 + src/Model/CustomersCreateResponseBody.php | 1126 ++ .../CustomersCreateResponseBodyAddress.php | 623 + .../CustomersCreateResponseBodyAssets.php | 418 + src/Model/CustomersGetResponseBody.php | 1126 ++ src/Model/CustomersGetResponseBodyAddress.php | 623 + src/Model/CustomersGetResponseBodyAssets.php | 418 + .../CustomersImportCsvCreateResponseBody.php | 418 + src/Model/CustomersListResponseBody.php | 582 + ...stomersMetadataUpdateInBulkRequestBody.php | 459 + ...tomersMetadataUpdateInBulkResponseBody.php | 418 + ...ersPermanentDeletionCreateResponseBody.php | 664 + ...nentDeletionCreateResponseBodyDataJson.php | 664 + .../CustomersRedeemablesListResponseBody.php | 623 + .../CustomersSegmentsListResponseBody.php | 541 + .../CustomersUpdateInBulkRequestBody.php | 746 + ...ustomersUpdateInBulkRequestBodyAddress.php | 623 + .../CustomersUpdateInBulkResponseBody.php | 418 + src/Model/CustomersUpdateRequestBody.php | 705 + .../CustomersUpdateRequestBodyAddress.php | 623 + src/Model/CustomersUpdateResponseBody.php | 1126 ++ .../CustomersUpdateResponseBodyAddress.php | 623 + .../CustomersUpdateResponseBodyAssets.php | 418 + src/Model/Discount.php | 1143 ++ src/Model/DiscountUnitMultipleOneUnit.php | 642 + src/Model/EarningRule.php | 1207 ++ src/Model/EarningRuleCustomEvent.php | 418 + src/Model/EarningRuleLoyalty.php | 743 + src/Model/EarningRuleLoyaltyCustomEvent.php | 417 + .../EarningRuleLoyaltyCustomEventMetadata.php | 500 + src/Model/EarningRuleLoyaltyCustomer.php | 417 + .../EarningRuleLoyaltyCustomerMetadata.php | 500 + src/Model/EarningRuleLoyaltyOrder.php | 499 + src/Model/EarningRuleLoyaltyOrderAmount.php | 459 + src/Model/EarningRuleLoyaltyOrderItems.php | 499 + .../EarningRuleLoyaltyOrderItemsAmount.php | 577 + .../EarningRuleLoyaltyOrderItemsQuantity.php | 577 + ...ingRuleLoyaltyOrderItemsSubtotalAmount.php | 577 + src/Model/EarningRuleLoyaltyOrderMetadata.php | 500 + .../EarningRuleLoyaltyOrderTotalAmount.php | 459 + src/Model/EarningRuleLoyaltyTier.php | 418 + src/Model/EarningRuleSegment.php | 418 + src/Model/EarningRuleSource.php | 532 + src/Model/Error.php | 664 + src/Model/EventsCreateRequestBody.php | 593 + src/Model/EventsCreateRequestBodyLoyalty.php | 418 + src/Model/EventsCreateRequestBodyReferral.php | 459 + src/Model/EventsCreateResponseBody.php | 651 + src/Model/Export.php | 859 + src/Model/ExportParameters.php | 779 + src/Model/ExportParametersFilters.php | 553 + src/Model/ExportResult.php | 417 + .../ExportVoucherTransactionsFilters.php | 553 + src/Model/ExportsCreateRequestBody.php | 502 + .../ExportsCreateRequestBodyParameters.php | 779 + ...ortsCreateRequestBodyParametersFilters.php | 553 + src/Model/ExportsCreateResponseBody.php | 853 + .../ExportsCreateResponseBodyParameters.php | 779 + ...rtsCreateResponseBodyParametersFilters.php | 553 + src/Model/ExportsGetResponseBody.php | 860 + .../ExportsGetResponseBodyParameters.php | 779 + ...xportsGetResponseBodyParametersFilters.php | 553 + src/Model/ExportsGetResponseBodyResult.php | 417 + src/Model/ExportsListResponseBody.php | 605 + src/Model/FieldConditions.php | 410 + src/Model/FilterConditionsString.php | 705 + src/Model/FiltersCondition.php | 1401 ++ src/Model/Gift.php | 534 + src/Model/InapplicableTo.php | 1145 ++ src/Model/InapplicableToResultList.php | 613 + src/Model/ListPublicationsItemVoucher.php | 681 + .../LoyaltiesCreateCampaignRequestBody.php | 1243 ++ .../LoyaltiesCreateCampaignResponseBody.php | 1745 ++ src/Model/LoyaltiesDeleteResponseBody.php | 418 + ...ltiesEarningRulesCreateRequestBodyItem.php | 942 + ...gRulesCreateRequestBodyItemCustomEvent.php | 418 + ...rningRulesCreateRequestBodyItemLoyalty.php | 715 + ...reateRequestBodyItemLoyaltyCustomEvent.php | 417 + ...uestBodyItemLoyaltyCustomEventMetadata.php | 500 + ...esCreateRequestBodyItemLoyaltyCustomer.php | 417 + ...RequestBodyItemLoyaltyCustomerMetadata.php | 500 + ...RulesCreateRequestBodyItemLoyaltyOrder.php | 499 + ...reateRequestBodyItemLoyaltyOrderAmount.php | 459 + ...CreateRequestBodyItemLoyaltyOrderItems.php | 499 + ...RequestBodyItemLoyaltyOrderItemsAmount.php | 577 + ...questBodyItemLoyaltyOrderItemsQuantity.php | 577 + ...odyItemLoyaltyOrderItemsSubtotalAmount.php | 577 + ...ateRequestBodyItemLoyaltyOrderMetadata.php | 500 + ...RequestBodyItemLoyaltyOrderTotalAmount.php | 459 + ...gRulesCreateRequestBodyItemLoyaltyTier.php | 418 + ...rningRulesCreateRequestBodyItemSegment.php | 418 + ...arningRulesCreateRequestBodyItemSource.php | 417 + ...oyaltiesEarningRulesCreateResponseBody.php | 1208 ++ ...ningRulesCreateResponseBodyCustomEvent.php | 418 + ...sEarningRulesCreateResponseBodyLoyalty.php | 743 + ...esCreateResponseBodyLoyaltyCustomEvent.php | 417 + ...ResponseBodyLoyaltyCustomEventMetadata.php | 500 + ...RulesCreateResponseBodyLoyaltyCustomer.php | 417 + ...ateResponseBodyLoyaltyCustomerMetadata.php | 500 + ...ingRulesCreateResponseBodyLoyaltyOrder.php | 499 + ...esCreateResponseBodyLoyaltyOrderAmount.php | 459 + ...lesCreateResponseBodyLoyaltyOrderItems.php | 499 + ...ateResponseBodyLoyaltyOrderItemsAmount.php | 577 + ...eResponseBodyLoyaltyOrderItemsQuantity.php | 577 + ...nseBodyLoyaltyOrderItemsSubtotalAmount.php | 577 + ...CreateResponseBodyLoyaltyOrderMetadata.php | 500 + ...ateResponseBodyLoyaltyOrderTotalAmount.php | 459 + ...ningRulesCreateResponseBodyLoyaltyTier.php | 418 + ...sEarningRulesCreateResponseBodySegment.php | 418 + ...esEarningRulesCreateResponseBodySource.php | 532 + ...yaltiesEarningRulesDisableResponseBody.php | 1167 ++ ...ingRulesDisableResponseBodyCustomEvent.php | 418 + ...EarningRulesDisableResponseBodyLoyalty.php | 743 + ...sDisableResponseBodyLoyaltyCustomEvent.php | 417 + ...ResponseBodyLoyaltyCustomEventMetadata.php | 500 + ...ulesDisableResponseBodyLoyaltyCustomer.php | 417 + ...bleResponseBodyLoyaltyCustomerMetadata.php | 500 + ...ngRulesDisableResponseBodyLoyaltyOrder.php | 499 + ...sDisableResponseBodyLoyaltyOrderAmount.php | 459 + ...esDisableResponseBodyLoyaltyOrderItems.php | 499 + ...bleResponseBodyLoyaltyOrderItemsAmount.php | 577 + ...eResponseBodyLoyaltyOrderItemsQuantity.php | 577 + ...nseBodyLoyaltyOrderItemsSubtotalAmount.php | 577 + ...isableResponseBodyLoyaltyOrderMetadata.php | 500 + ...bleResponseBodyLoyaltyOrderTotalAmount.php | 459 + ...ingRulesDisableResponseBodyLoyaltyTier.php | 418 + ...EarningRulesDisableResponseBodySegment.php | 418 + ...sEarningRulesDisableResponseBodySource.php | 532 + ...oyaltiesEarningRulesEnableResponseBody.php | 1167 ++ ...ningRulesEnableResponseBodyCustomEvent.php | 418 + ...sEarningRulesEnableResponseBodyLoyalty.php | 743 + ...esEnableResponseBodyLoyaltyCustomEvent.php | 417 + ...ResponseBodyLoyaltyCustomEventMetadata.php | 500 + ...RulesEnableResponseBodyLoyaltyCustomer.php | 417 + ...bleResponseBodyLoyaltyCustomerMetadata.php | 500 + ...ingRulesEnableResponseBodyLoyaltyOrder.php | 499 + ...esEnableResponseBodyLoyaltyOrderAmount.php | 459 + ...lesEnableResponseBodyLoyaltyOrderItems.php | 499 + ...bleResponseBodyLoyaltyOrderItemsAmount.php | 577 + ...eResponseBodyLoyaltyOrderItemsQuantity.php | 577 + ...nseBodyLoyaltyOrderItemsSubtotalAmount.php | 577 + ...EnableResponseBodyLoyaltyOrderMetadata.php | 500 + ...bleResponseBodyLoyaltyOrderTotalAmount.php | 459 + ...ningRulesEnableResponseBodyLoyaltyTier.php | 418 + ...sEarningRulesEnableResponseBodySegment.php | 418 + ...esEarningRulesEnableResponseBodySource.php | 532 + .../LoyaltiesEarningRulesGetResponseBody.php | 1208 ++ ...EarningRulesGetResponseBodyCustomEvent.php | 418 + ...tiesEarningRulesGetResponseBodyLoyalty.php | 743 + ...RulesGetResponseBodyLoyaltyCustomEvent.php | 417 + ...ResponseBodyLoyaltyCustomEventMetadata.php | 500 + ...ingRulesGetResponseBodyLoyaltyCustomer.php | 417 + ...GetResponseBodyLoyaltyCustomerMetadata.php | 500 + ...arningRulesGetResponseBodyLoyaltyOrder.php | 499 + ...RulesGetResponseBodyLoyaltyOrderAmount.php | 459 + ...gRulesGetResponseBodyLoyaltyOrderItems.php | 499 + ...GetResponseBodyLoyaltyOrderItemsAmount.php | 577 + ...tResponseBodyLoyaltyOrderItemsQuantity.php | 577 + ...nseBodyLoyaltyOrderItemsSubtotalAmount.php | 577 + ...lesGetResponseBodyLoyaltyOrderMetadata.php | 500 + ...GetResponseBodyLoyaltyOrderTotalAmount.php | 459 + ...EarningRulesGetResponseBodyLoyaltyTier.php | 418 + ...tiesEarningRulesGetResponseBodySegment.php | 418 + ...ltiesEarningRulesGetResponseBodySource.php | 532 + .../LoyaltiesEarningRulesListResponseBody.php | 573 + ...LoyaltiesEarningRulesUpdateRequestBody.php | 806 + ...esEarningRulesUpdateRequestBodyLoyalty.php | 743 + ...lesUpdateRequestBodyLoyaltyCustomEvent.php | 417 + ...eRequestBodyLoyaltyCustomEventMetadata.php | 500 + ...gRulesUpdateRequestBodyLoyaltyCustomer.php | 417 + ...dateRequestBodyLoyaltyCustomerMetadata.php | 500 + ...ningRulesUpdateRequestBodyLoyaltyOrder.php | 499 + ...lesUpdateRequestBodyLoyaltyOrderAmount.php | 459 + ...ulesUpdateRequestBodyLoyaltyOrderItems.php | 499 + ...dateRequestBodyLoyaltyOrderItemsAmount.php | 577 + ...teRequestBodyLoyaltyOrderItemsQuantity.php | 577 + ...estBodyLoyaltyOrderItemsSubtotalAmount.php | 577 + ...sUpdateRequestBodyLoyaltyOrderMetadata.php | 500 + ...dateRequestBodyLoyaltyOrderTotalAmount.php | 459 + ...iesEarningRulesUpdateRequestBodySource.php | 418 + ...oyaltiesEarningRulesUpdateResponseBody.php | 1208 ++ ...ningRulesUpdateResponseBodyCustomEvent.php | 418 + ...sEarningRulesUpdateResponseBodyLoyalty.php | 743 + ...esUpdateResponseBodyLoyaltyCustomEvent.php | 417 + ...ResponseBodyLoyaltyCustomEventMetadata.php | 500 + ...RulesUpdateResponseBodyLoyaltyCustomer.php | 417 + ...ateResponseBodyLoyaltyCustomerMetadata.php | 500 + ...ingRulesUpdateResponseBodyLoyaltyOrder.php | 499 + ...esUpdateResponseBodyLoyaltyOrderAmount.php | 459 + ...lesUpdateResponseBodyLoyaltyOrderItems.php | 499 + ...ateResponseBodyLoyaltyOrderItemsAmount.php | 577 + ...eResponseBodyLoyaltyOrderItemsQuantity.php | 577 + ...nseBodyLoyaltyOrderItemsSubtotalAmount.php | 577 + ...UpdateResponseBodyLoyaltyOrderMetadata.php | 500 + ...ateResponseBodyLoyaltyOrderTotalAmount.php | 459 + ...ningRulesUpdateResponseBodyLoyaltyTier.php | 418 + ...sEarningRulesUpdateResponseBodySegment.php | 418 + ...esEarningRulesUpdateResponseBodySource.php | 532 + .../LoyaltiesGetCampaignResponseBody.php | 1745 ++ .../LoyaltiesListCampaignsResponseBody.php | 573 + .../LoyaltiesListMembersResponseBody.php | 573 + src/Model/LoyaltiesLoyaltyTierReward.php | 520 + ...oyaltiesMemberActivityListResponseBody.php | 614 + ...yaltiesMembersBalanceUpdateRequestBody.php | 618 + ...altiesMembersBalanceUpdateResponseBody.php | 782 + ...BalanceUpdateResponseBodyRelatedObject.php | 491 + .../LoyaltiesMembersCreateRequestBody.php | 575 + .../LoyaltiesMembersCreateResponseBody.php | 1488 ++ ...esMembersCreateResponseBodyLoyaltyCard.php | 541 + ...altiesMembersCreateResponseBodyPublish.php | 500 + ...iesMembersCreateResponseBodyRedemption.php | 582 + src/Model/LoyaltiesMembersGetResponseBody.php | 1488 ++ ...ltiesMembersGetResponseBodyLoyaltyCard.php | 541 + ...LoyaltiesMembersGetResponseBodyPublish.php | 500 + ...altiesMembersGetResponseBodyRedemption.php | 582 + ...embersPointsExpirationListResponseBody.php | 623 + ...intsExpirationListResponseBodyDataItem.php | 747 + ...pirationListResponseBodyDataItemBucket.php | 414 + ...tiesMembersRedemptionRedeemRequestBody.php | 493 + ...mbersRedemptionRedeemRequestBodyReward.php | 459 + ...iesMembersRedemptionRedeemResponseBody.php | 1430 ++ ...ersRedemptionRedeemResponseBodyChannel.php | 493 + ...embersRedemptionRedeemResponseBodyGift.php | 418 + ...edemptionRedeemResponseBodyLoyaltyCard.php | 418 + ...onRedeemResponseBodyRelatedRedemptions.php | 458 + ...eBodyRelatedRedemptionsRedemptionsItem.php | 444 + ...nseBodyRelatedRedemptionsRollbacksItem.php | 444 + ...ersRedemptionRedeemResponseBodyVoucher.php | 1635 ++ ...edemptionRedeemResponseBodyVoucherGift.php | 534 + ...onRedeemResponseBodyVoucherLoyaltyCard.php | 541 + ...mptionRedeemResponseBodyVoucherPublish.php | 500 + ...ionRedeemResponseBodyVoucherRedemption.php | 582 + ...oyaltiesMembersRewardsListResponseBody.php | 614 + ...MembersRewardsListResponseBodyDataItem.php | 510 + .../LoyaltiesMembersTiersListResponseBody.php | 605 + ...ersTransactionsExportCreateRequestBody.php | 418 + ...tionsExportCreateRequestBodyParameters.php | 571 + ...rsTransactionsExportCreateResponseBody.php | 842 + ...ionsExportCreateResponseBodyParameters.php | 571 + ...iesMembersTransactionsListResponseBody.php | 623 + ...tiesMembersTransfersCreateResponseBody.php | 1416 ++ ...mbersTransfersCreateResponseBodyAssets.php | 459 + ...ansfersCreateResponseBodyAssetsBarcode.php | 459 + ...ersTransfersCreateResponseBodyAssetsQr.php | 459 + ...TransfersCreateResponseBodyLoyaltyCard.php | 541 + ...bersTransfersCreateResponseBodyPublish.php | 573 + ...sTransfersCreateResponseBodyRedemption.php | 614 + ...ointsExpirationExportCreateRequestBody.php | 411 + ...ationExportCreateRequestBodyParameters.php | 559 + ...portCreateRequestBodyParametersFilters.php | 534 + ...RequestBodyParametersFiltersCampaignId.php | 418 + ...yParametersFiltersCampaignIdConditions.php | 541 + ...eRequestBodyParametersFiltersVoucherId.php | 418 + ...dyParametersFiltersVoucherIdConditions.php | 541 + ...intsExpirationExportCreateResponseBody.php | 869 + ...tionExportCreateResponseBodyParameters.php | 559 + ...ortCreateResponseBodyParametersFilters.php | 534 + ...esponseBodyParametersFiltersCampaignId.php | 418 + ...yParametersFiltersCampaignIdConditions.php | 541 + ...ResponseBodyParametersFiltersVoucherId.php | 418 + ...dyParametersFiltersVoucherIdConditions.php | 541 + ...altiesRewardAssignmentsGetResponseBody.php | 769 + ...rdAssignmentsGetResponseBodyParameters.php | 418 + ...nmentsGetResponseBodyParametersLoyalty.php | 418 + ...ltiesRewardAssignmentsListResponseBody.php | 573 + ...RewardAssignmentsRewardGetResponseBody.php | 885 + ...gnmentsRewardGetResponseBodyAttributes.php | 459 + ...RewardsCreateAssignmentItemRequestBody.php | 499 + ...ateAssignmentItemRequestBodyParameters.php | 418 + ...gnmentItemRequestBodyParametersLoyalty.php | 418 + ...iesRewardsCreateAssignmentResponseBody.php | 769 + ...CreateAssignmentResponseBodyParameters.php | 418 + ...ssignmentResponseBodyParametersLoyalty.php | 418 + src/Model/LoyaltiesRewardsGetResponseBody.php | 769 + ...altiesRewardsGetResponseBodyParameters.php | 418 + ...ewardsGetResponseBodyParametersLoyalty.php | 418 + ...tiesRewardsListAssignmentsResponseBody.php | 573 + ...tiesRewardsUpdateAssignmentRequestBody.php | 418 + ...sUpdateAssignmentRequestBodyParameters.php | 418 + ...AssignmentRequestBodyParametersLoyalty.php | 418 + ...iesRewardsUpdateAssignmentResponseBody.php | 769 + ...UpdateAssignmentResponseBodyParameters.php | 418 + ...ssignmentResponseBodyParametersLoyalty.php | 418 + ...altiesTiersCreateInBulkRequestBodyItem.php | 574 + ...ltiesTiersEarningRulesListResponseBody.php | 605 + src/Model/LoyaltiesTiersGetResponseBody.php | 894 + .../LoyaltiesTiersGetResponseBodyConfig.php | 418 + ...altiesTiersGetResponseBodyConfigPoints.php | 459 + .../LoyaltiesTiersGetResponseBodyPoints.php | 459 + src/Model/LoyaltiesTiersListResponseBody.php | 605 + .../LoyaltiesTiersRewardsListResponseBody.php | 541 + src/Model/LoyaltiesTransferPoints.php | 540 + .../LoyaltiesUpdateCampaignRequestBody.php | 1080 ++ ...altiesUpdateCampaignRequestBodyOptions.php | 417 + .../LoyaltiesUpdateCampaignResponseBody.php | 1745 ++ src/Model/LoyaltyCampaign.php | 1744 ++ src/Model/LoyaltyCampaignVoucher.php | 828 + .../LoyaltyCampaignVoucherRedemption.php | 418 + src/Model/LoyaltyCardTransaction.php | 832 + src/Model/LoyaltyCardTransactionDetails.php | 896 + .../LoyaltyCardTransactionDetailsBalance.php | 705 + ...TransactionDetailsBalanceRelatedObject.php | 500 + ...yaltyCardTransactionDetailsCustomEvent.php | 459 + ...yaltyCardTransactionDetailsEarningRule.php | 459 + ...ardTransactionDetailsEarningRuleSource.php | 418 + .../LoyaltyCardTransactionDetailsEvent.php | 459 + ...yaltyCardTransactionDetailsEventSchema.php | 459 + ...yaltyCardTransactionDetailsLoyaltyTier.php | 459 + .../LoyaltyCardTransactionDetailsOrder.php | 459 + ...oyaltyCardTransactionDetailsRedemption.php | 418 + .../LoyaltyCardTransactionDetailsReward.php | 459 + .../LoyaltyCardTransactionDetailsRollback.php | 418 + .../LoyaltyCardTransactionDetailsSegment.php | 459 + src/Model/LoyaltyMember.php | 1488 ++ src/Model/LoyaltyMemberLoyaltyCard.php | 541 + src/Model/LoyaltyMemberPublish.php | 500 + src/Model/LoyaltyMemberRedemption.php | 582 + src/Model/LoyaltyTier.php | 893 + src/Model/LoyaltyTierBase.php | 540 + src/Model/LoyaltyTierBasePoints.php | 459 + src/Model/LoyaltyTierConfig.php | 418 + src/Model/LoyaltyTierConfigPoints.php | 459 + src/Model/LoyaltyTierExpiration.php | 664 + src/Model/LoyaltyTierPoints.php | 459 + src/Model/LoyaltyTiersExpirationAll.php | 613 + ...oyaltyTiersExpirationAllExpirationDate.php | 531 + ...ersExpirationAllExpirationDateRounding.php | 647 + .../LoyaltyTiersExpirationAllStartDate.php | 452 + src/Model/LuckyDraw.php | 502 + src/Model/MappingPoints.php | 533 + src/Model/MemberActivity.php | 582 + src/Model/ModelInterface.php | 112 + src/Model/Order.php | 743 + src/Model/OrderCalculated.php | 1335 ++ src/Model/OrderCalculatedItem.php | 1303 ++ src/Model/OrderCalculatedItemProduct.php | 623 + src/Model/OrderCalculatedItemSku.php | 582 + src/Model/OrderItem.php | 984 ++ src/Model/OrderItemProduct.php | 623 + src/Model/OrderItemSku.php | 582 + src/Model/OrderRedemptionsEntry.php | 704 + src/Model/OrdersCreateRequestBody.php | 893 + src/Model/OrdersCreateResponseBody.php | 1335 ++ src/Model/OrdersExportCreateRequestBody.php | 418 + ...rdersExportCreateRequestBodyParameters.php | 581 + src/Model/OrdersExportCreateResponseBody.php | 842 + ...dersExportCreateResponseBodyParameters.php | 581 + src/Model/OrdersGetResponseBody.php | 1335 ++ .../OrdersImportCreateRequestBodyItem.php | 885 + src/Model/OrdersImportCreateResponseBody.php | 418 + src/Model/OrdersListResponseBody.php | 605 + src/Model/OrdersUpdateRequestBody.php | 852 + src/Model/OrdersUpdateResponseBody.php | 1335 ++ src/Model/ParameterActivityCategory.php | 49 + src/Model/ParameterCampaignType.php | 57 + src/Model/ParameterCreatedBeforeAfter.php | 458 + src/Model/ParameterExpandListCampaigns.php | 47 + ...arameterFiltersListCustomerRedeemables.php | 704 + ...ltersListCustomerRedeemablesCampaignId.php | 486 + ...ersListCustomerRedeemablesCampaignType.php | 486 + ...tomerRedeemablesCampaignTypeConditions.php | 836 + ...iltersListCustomerRedeemablesCreatedAt.php | 493 + ...CustomerRedeemablesCreatedAtConditions.php | 623 + ...ltersListCustomerRedeemablesHolderRole.php | 486 + ...ustomerRedeemablesHolderRoleConditions.php | 828 + ...ameterFiltersListCustomerRedeemablesId.php | 486 + ...ersListCustomerRedeemablesRedeemableId.php | 486 + ...istCustomerRedeemablesRedeemableObject.php | 486 + ...rRedeemablesRedeemableObjectConditions.php | 812 + ...tersListCustomerRedeemablesVoucherType.php | 486 + ...stomerRedeemablesVoucherTypeConditions.php | 828 + src/Model/ParameterFiltersListRedemptions.php | 786 + ...eterFiltersListRedemptionsCampaignName.php | 486 + ...ameterFiltersListRedemptionsCustomerId.php | 486 + ...meterFiltersListRedemptionsFailureCode.php | 486 + .../ParameterFiltersListRedemptionsObject.php | 486 + ...ltersListRedemptionsParentRedemptionId.php | 486 + ...rFiltersListRedemptionsRelatedObjectId.php | 486 + ...rsListRedemptionsRelatedObjectParentId.php | 486 + .../ParameterFiltersListRedemptionsResult.php | 486 + ...rameterFiltersListRedemptionsUserLogin.php | 486 + ...meterFiltersListRedemptionsVoucherCode.php | 486 + src/Model/ParameterOrder.php | 69 + src/Model/ParameterOrderCreatedAt.php | 49 + .../ParameterOrderListAllPromotionStacks.php | 57 + src/Model/ParameterOrderListCampaigns.php | 53 + src/Model/ParameterOrderListCustomers.php | 57 + src/Model/ParameterOrderListEarningRules.php | 53 + src/Model/ParameterOrderListExports.php | 53 + src/Model/ParameterOrderListLoyaltyTiers.php | 53 + src/Model/ParameterOrderListOrders.php | 53 + .../ParameterOrderListPromotionTiers.php | 53 + ...meterOrderListPromotionTiersClientSide.php | 53 + src/Model/ParameterOrderListPublications.php | 69 + src/Model/ParameterOrderListRedeemables.php | 49 + src/Model/ParameterOrderListRedemptions.php | 65 + ...eterOrderListValidationRuleAssignments.php | 49 + .../ParameterOrderListValidationRules.php | 57 + src/Model/ParameterOrderVouchers.php | 57 + src/Model/ParameterResultListPublications.php | 49 + src/Model/ParameterUpdatedBeforeAfter.php | 458 + .../ParameterVoucherTypeListPublications.php | 51 + src/Model/Product.php | 853 + .../ProductCollectionsCreateRequestBody.php | 565 + ...ductCollectionsCreateRequestBodyFilter.php | 860 + ...llectionsCreateRequestBodyProductsItem.php | 518 + .../ProductCollectionsCreateResponseBody.php | 730 + ...uctCollectionsCreateResponseBodyFilter.php | 860 + ...lectionsCreateResponseBodyProductsItem.php | 518 + .../ProductCollectionsGetResponseBody.php | 730 + ...roductCollectionsGetResponseBodyFilter.php | 860 + ...CollectionsGetResponseBodyProductsItem.php | 518 + src/Model/ProductCollectionsItem.php | 730 + src/Model/ProductCollectionsItemFilter.php | 860 + .../ProductCollectionsItemProductsItem.php | 518 + .../ProductCollectionsListResponseBody.php | 605 + ...uctCollectionsProductsListResponseBody.php | 541 + ...ctionsProductsListResponseBodyDataItem.php | 928 + src/Model/ProductWithoutSkus.php | 818 + src/Model/ProductsCreateRequestBody.php | 664 + src/Model/ProductsCreateResponseBody.php | 853 + src/Model/ProductsGetResponseBody.php | 853 + .../ProductsImportCsvCreateResponseBody.php | 418 + src/Model/ProductsListResponseBody.php | 541 + ...roductsMetadataUpdateInBulkRequestBody.php | 459 + ...oductsMetadataUpdateInBulkResponseBody.php | 418 + src/Model/ProductsSkusCreateRequestBody.php | 705 + src/Model/ProductsSkusCreateResponseBody.php | 901 + src/Model/ProductsSkusListResponseBody.php | 541 + src/Model/ProductsSkusUpdateRequestBody.php | 623 + src/Model/ProductsSkusUpdateResponseBody.php | 901 + src/Model/ProductsUpdateInBulkRequestBody.php | 623 + .../ProductsUpdateInBulkResponseBody.php | 418 + src/Model/ProductsUpdateRequestBody.php | 582 + src/Model/ProductsUpdateResponseBody.php | 853 + src/Model/PromotionStack.php | 777 + src/Model/PromotionStackBase.php | 458 + src/Model/PromotionStackBaseTiers.php | 500 + src/Model/PromotionStackTiers.php | 500 + src/Model/PromotionTier.php | 1292 ++ src/Model/PromotionTierAction.php | 411 + src/Model/PromotionTierCampaign.php | 766 + src/Model/PromotionTierCreateParams.php | 971 ++ src/Model/PromotionTierCreateParamsAction.php | 411 + src/Model/PromotionTierSummary.php | 459 + src/Model/PromotionTierSummaryOrders.php | 459 + src/Model/PromotionTierSummaryRedemptions.php | 418 + src/Model/PromotionTiersList.php | 582 + .../PromotionsStacksCreateRequestBody.php | 500 + ...PromotionsStacksCreateRequestBodyTiers.php | 500 + .../PromotionsStacksCreateResponseBody.php | 737 + ...romotionsStacksCreateResponseBodyTiers.php | 500 + src/Model/PromotionsStacksGetResponseBody.php | 778 + .../PromotionsStacksGetResponseBodyTiers.php | 500 + .../PromotionsStacksListResponseBody.php | 614 + .../PromotionsStacksUpdateRequestBody.php | 500 + ...PromotionsStacksUpdateRequestBodyTiers.php | 491 + .../PromotionsStacksUpdateResponseBody.php | 778 + ...romotionsStacksUpdateResponseBodyTiers.php | 500 + .../PromotionsTiersCreateRequestBody.php | 964 ++ ...PromotionsTiersCreateRequestBodyAction.php | 411 + .../PromotionsTiersCreateResponseBody.php | 1292 ++ ...romotionsTiersCreateResponseBodyAction.php | 411 + ...motionsTiersCreateResponseBodyCampaign.php | 766 + ...omotionsTiersCreateResponseBodySummary.php | 459 + ...nsTiersCreateResponseBodySummaryOrders.php | 459 + ...rsCreateResponseBodySummaryRedemptions.php | 418 + .../PromotionsTiersDisableResponseBody.php | 1292 ++ ...omotionsTiersDisableResponseBodyAction.php | 411 + ...otionsTiersDisableResponseBodyCampaign.php | 766 + ...motionsTiersDisableResponseBodySummary.php | 459 + ...sTiersDisableResponseBodySummaryOrders.php | 459 + ...sDisableResponseBodySummaryRedemptions.php | 418 + .../PromotionsTiersEnableResponseBody.php | 1292 ++ ...romotionsTiersEnableResponseBodyAction.php | 411 + ...motionsTiersEnableResponseBodyCampaign.php | 766 + ...omotionsTiersEnableResponseBodySummary.php | 459 + ...nsTiersEnableResponseBodySummaryOrders.php | 459 + ...rsEnableResponseBodySummaryRedemptions.php | 418 + src/Model/PromotionsTiersGetResponseBody.php | 1292 ++ .../PromotionsTiersGetResponseBodyAction.php | 411 + ...PromotionsTiersGetResponseBodyCampaign.php | 766 + .../PromotionsTiersGetResponseBodySummary.php | 459 + ...tionsTiersGetResponseBodySummaryOrders.php | 459 + ...TiersGetResponseBodySummaryRedemptions.php | 418 + src/Model/PromotionsTiersListResponseBody.php | 582 + .../PromotionsTiersUpdateRequestBody.php | 923 + ...PromotionsTiersUpdateRequestBodyAction.php | 411 + .../PromotionsTiersUpdateResponseBody.php | 1292 ++ ...romotionsTiersUpdateResponseBodyAction.php | 411 + ...motionsTiersUpdateResponseBodyCampaign.php | 766 + ...omotionsTiersUpdateResponseBodySummary.php | 459 + ...nsTiersUpdateResponseBodySummaryOrders.php | 459 + ...rsUpdateResponseBodySummaryRedemptions.php | 418 + src/Model/PublicationsCreateRequestBody.php | 615 + .../PublicationsCreateRequestBodyCustomer.php | 786 + ...ationsCreateRequestBodyCustomerAddress.php | 622 + src/Model/PublicationsCreateResponseBody.php | 991 ++ src/Model/PublicationsListResponseBody.php | 541 + ...ationsListResponseBodyPublicationsItem.php | 1022 ++ ...stResponseBodyPublicationsItemMetadata.php | 499 + ...lificationsCheckEligibilityRequestBody.php | 648 + ...ificationsCheckEligibilityResponseBody.php | 520 + src/Model/QualificationsFieldConditions.php | 410 + src/Model/QualificationsFiltersCondition.php | 622 + src/Model/QualificationsOption.php | 653 + src/Model/QualificationsOptionFilters.php | 745 + ...ualificationsOptionFiltersCampaignType.php | 418 + ...onsOptionFiltersCampaignTypeConditions.php | 669 + .../QualificationsOptionFiltersHolderRole.php | 417 + ...tionsOptionFiltersHolderRoleConditions.php | 645 + ...ualificationsOptionFiltersResourceType.php | 417 + ...onsOptionFiltersResourceTypeConditions.php | 645 + src/Model/QualificationsRedeemable.php | 1035 ++ src/Model/QualificationsRedeemableBase.php | 995 ++ src/Model/QualificationsRedeemables.php | 687 + src/Model/RedeemableGift.php | 459 + src/Model/RedeemableLoyaltyCard.php | 582 + src/Model/RedeemableResult.php | 513 + src/Model/RedeemableVoucher.php | 1567 ++ src/Model/RedeemableVoucherGift.php | 534 + src/Model/RedeemableVoucherLoyaltyCard.php | 541 + src/Model/RedeemableVoucherPublish.php | 500 + src/Model/RedeemableVoucherRedemption.php | 582 + src/Model/Redemption.php | 1430 ++ src/Model/RedemptionChannel.php | 493 + src/Model/RedemptionEntry.php | 1493 ++ src/Model/RedemptionEntryChannel.php | 492 + src/Model/RedemptionEntryCustomer.php | 654 + src/Model/RedemptionEntryGift.php | 417 + src/Model/RedemptionEntryLoyaltyCard.php | 417 + src/Model/RedemptionEntryOrder.php | 1348 ++ src/Model/RedemptionEntryOrderCustomer.php | 490 + src/Model/RedemptionEntryOrderReferrer.php | 490 + src/Model/RedemptionEntryPromotionTier.php | 1291 ++ .../RedemptionEntryPromotionTierAction.php | 410 + .../RedemptionEntryPromotionTierCampaign.php | 765 + .../RedemptionEntryPromotionTierSummary.php | 458 + ...emptionEntryPromotionTierSummaryOrders.php | 458 + ...onEntryPromotionTierSummaryRedemptions.php | 417 + .../RedemptionEntryRelatedRedemptions.php | 458 + ...EntryRelatedRedemptionsRedemptionsItem.php | 444 + ...onEntryRelatedRedemptionsRollbacksItem.php | 444 + src/Model/RedemptionEntryVoucher.php | 1634 ++ src/Model/RedemptionEntryVoucherGift.php | 533 + .../RedemptionEntryVoucherLoyaltyCard.php | 540 + src/Model/RedemptionEntryVoucherPublish.php | 499 + .../RedemptionEntryVoucherRedemption.php | 581 + src/Model/RedemptionGift.php | 418 + src/Model/RedemptionLoyaltyCard.php | 418 + src/Model/RedemptionRelatedRedemptions.php | 458 + ...ptionRelatedRedemptionsRedemptionsItem.php | 444 + ...emptionRelatedRedemptionsRollbacksItem.php | 444 + src/Model/RedemptionRewardResult.php | 990 ++ .../RedemptionRewardResultParameters.php | 500 + ...demptionRewardResultParametersCampaign.php | 500 + .../RedemptionRewardResultParametersCoin.php | 459 + ...edemptionRewardResultParametersProduct.php | 459 + src/Model/RedemptionRollback.php | 1462 ++ src/Model/RedemptionRollbackChannel.php | 493 + src/Model/RedemptionRollbackGift.php | 418 + src/Model/RedemptionRollbackLoyaltyCard.php | 418 + .../RedemptionRollbackRelatedRedemptions.php | 458 + ...lbackRelatedRedemptionsRedemptionsItem.php | 444 + ...ollbackRelatedRedemptionsRollbacksItem.php | 444 + src/Model/RedemptionVoucher.php | 1635 ++ src/Model/RedemptionVoucherGift.php | 534 + src/Model/RedemptionVoucherLoyaltyCard.php | 541 + src/Model/RedemptionVoucherPublish.php | 500 + src/Model/RedemptionVoucherRedemption.php | 582 + src/Model/RedemptionsGetResponseBody.php | 1493 ++ .../RedemptionsGetResponseBodyChannel.php | 492 + .../RedemptionsGetResponseBodyCustomer.php | 654 + src/Model/RedemptionsGetResponseBodyGift.php | 417 + .../RedemptionsGetResponseBodyLoyaltyCard.php | 417 + src/Model/RedemptionsGetResponseBodyOrder.php | 1348 ++ ...edemptionsGetResponseBodyOrderCustomer.php | 490 + ...edemptionsGetResponseBodyOrderReferrer.php | 490 + ...edemptionsGetResponseBodyPromotionTier.php | 1291 ++ ...ionsGetResponseBodyPromotionTierAction.php | 410 + ...nsGetResponseBodyPromotionTierCampaign.php | 765 + ...onsGetResponseBodyPromotionTierSummary.php | 458 + ...ResponseBodyPromotionTierSummaryOrders.php | 458 + ...nseBodyPromotionTierSummaryRedemptions.php | 417 + ...tionsGetResponseBodyRelatedRedemptions.php | 458 + ...eBodyRelatedRedemptionsRedemptionsItem.php | 444 + ...nseBodyRelatedRedemptionsRollbacksItem.php | 444 + .../RedemptionsGetResponseBodyVoucher.php | 1634 ++ .../RedemptionsGetResponseBodyVoucherGift.php | 533 + ...tionsGetResponseBodyVoucherLoyaltyCard.php | 540 + ...demptionsGetResponseBodyVoucherPublish.php | 499 + ...ptionsGetResponseBodyVoucherRedemption.php | 581 + src/Model/RedemptionsListResponseBody.php | 541 + ...mptionsListResponseBodyRedemptionsItem.php | 1395 ++ ...ListResponseBodyRedemptionsItemChannel.php | 485 + ...istResponseBodyRedemptionsItemCustomer.php | 647 + ...onsListResponseBodyRedemptionsItemGift.php | 410 + ...ResponseBodyRedemptionsItemLoyaltyCard.php | 410 + ...nsListResponseBodyRedemptionsItemOrder.php | 1320 ++ ...sponseBodyRedemptionsItemOrderCustomer.php | 490 + ...sponseBodyRedemptionsItemOrderReferrer.php | 490 + ...sponseBodyRedemptionsItemPromotionTier.php | 1263 ++ ...BodyRedemptionsItemPromotionTierAction.php | 410 + ...dyRedemptionsItemPromotionTierCampaign.php | 765 + ...odyRedemptionsItemPromotionTierSummary.php | 444 + ...emptionsItemPromotionTierSummaryOrders.php | 458 + ...onsItemPromotionTierSummaryRedemptions.php | 417 + ...eBodyRedemptionsItemRelatedRedemptions.php | 451 + ...sItemRelatedRedemptionsRedemptionsItem.php | 444 + ...onsItemRelatedRedemptionsRollbacksItem.php | 444 + ...ListResponseBodyRedemptionsItemVoucher.php | 1599 ++ ...ResponseBodyRedemptionsItemVoucherGift.php | 533 + ...eBodyRedemptionsItemVoucherLoyaltyCard.php | 540 + ...ponseBodyRedemptionsItemVoucherPublish.php | 499 + ...seBodyRedemptionsItemVoucherRedemption.php | 581 + src/Model/RedemptionsRedeemRequestBody.php | 643 + .../RedemptionsRedeemRequestBodyOptions.php | 446 + ...ptionsRedeemRequestBodyRedeemablesItem.php | 562 + ...nsRedeemRequestBodyRedeemablesItemGift.php | 418 + ...RedeemRequestBodyRedeemablesItemReward.php | 459 + src/Model/RedemptionsRedeemResponseBody.php | 568 + .../RedemptionsRollbackCreateRequestBody.php | 568 + .../RedemptionsRollbackCreateResponseBody.php | 1462 ++ ...tionsRollbackCreateResponseBodyChannel.php | 493 + ...emptionsRollbackCreateResponseBodyGift.php | 418 + ...sRollbackCreateResponseBodyLoyaltyCard.php | 418 + ...ckCreateResponseBodyRelatedRedemptions.php | 458 + ...eBodyRelatedRedemptionsRedemptionsItem.php | 444 + ...nseBodyRelatedRedemptionsRollbacksItem.php | 444 + .../RedemptionsRollbacksCreateRequestBody.php | 568 + ...RedemptionsRollbacksCreateResponseBody.php | 486 + src/Model/ReferralProgram.php | 534 + src/Model/ReferralProgramCustomEvent.php | 459 + src/Model/ReferralProgramRefereeReward.php | 538 + ...rogramRefereeRewardRelatedObjectParent.php | 532 + src/Model/Referrer.php | 786 + src/Model/ReferrerAddress.php | 623 + src/Model/ReferrerId.php | 490 + src/Model/Reward.php | 884 + src/Model/RewardAssignment.php | 768 + src/Model/RewardAssignmentParameters.php | 418 + .../RewardAssignmentParametersLoyalty.php | 418 + src/Model/RewardAttributes.php | 459 + src/Model/RewardType.php | 499 + src/Model/RewardTypeCampaign.php | 536 + src/Model/RewardTypeCoin.php | 459 + src/Model/RewardTypeProduct.php | 459 + .../RewardsAssignmentsCreateRequestBody.php | 499 + ...AssignmentsCreateRequestBodyParameters.php | 418 + ...entsCreateRequestBodyParametersLoyalty.php | 427 + .../RewardsAssignmentsCreateResponseBody.php | 769 + ...ssignmentsCreateResponseBodyParameters.php | 418 + ...ntsCreateResponseBodyParametersLoyalty.php | 418 + .../RewardsAssignmentsGetResponseBody.php | 769 + ...dsAssignmentsGetResponseBodyParameters.php | 418 + ...nmentsGetResponseBodyParametersLoyalty.php | 418 + .../RewardsAssignmentsListResponseBody.php | 541 + .../RewardsAssignmentsUpdateRequestBody.php | 418 + ...AssignmentsUpdateRequestBodyParameters.php | 418 + ...entsUpdateRequestBodyParametersLoyalty.php | 418 + .../RewardsAssignmentsUpdateResponseBody.php | 769 + ...ssignmentsUpdateResponseBodyParameters.php | 418 + ...ntsUpdateResponseBodyParametersLoyalty.php | 418 + src/Model/RewardsCreateRequestBody.php | 581 + .../RewardsCreateRequestBodyAttributes.php | 459 + .../RewardsCreateRequestBodyParameters.php | 499 + ...rdsCreateRequestBodyParametersCampaign.php | 458 + ...RewardsCreateRequestBodyParametersCoin.php | 459 + ...ardsCreateRequestBodyParametersProduct.php | 459 + src/Model/RewardsCreateResponseBody.php | 885 + .../RewardsCreateResponseBodyAttributes.php | 459 + src/Model/RewardsListResponseBody.php | 541 + src/Model/RewardsUpdateRequestBody.php | 581 + .../RewardsUpdateRequestBodyAttributes.php | 459 + .../RewardsUpdateRequestBodyParameters.php | 499 + ...rdsUpdateRequestBodyParametersCampaign.php | 458 + ...RewardsUpdateRequestBodyParametersCoin.php | 459 + ...ardsUpdateRequestBodyParametersProduct.php | 459 + src/Model/RewardsUpdateResponseBody.php | 885 + .../RewardsUpdateResponseBodyAttributes.php | 459 + src/Model/SegmentsCreateRequestBody.php | 574 + src/Model/SegmentsCreateResponseBody.php | 764 + src/Model/SegmentsGetResponseBody.php | 764 + src/Model/Session.php | 616 + src/Model/SimpleCustomer.php | 655 + .../SimpleCustomerRequiredObjectType.php | 623 + src/Model/SimpleLoyaltyCard.php | 541 + src/Model/SimpleProductDiscountUnit.php | 499 + src/Model/SimpleSegment.php | 531 + src/Model/SimpleSkuDiscountUnit.php | 499 + src/Model/SimpleVoucher.php | 1285 ++ src/Model/SimpleVoucherRedemption.php | 459 + src/Model/Sku.php | 901 + src/Model/SkusGetResponseBody.php | 901 + src/Model/SkusImportCsvCreateResponseBody.php | 418 + src/Model/SkusListForProduct.php | 541 + src/Model/StackingRules.php | 1044 ++ src/Model/ValidationRule.php | 1002 ++ src/Model/ValidationRuleApplicableTo.php | 499 + src/Model/ValidationRuleAssignment.php | 697 + src/Model/ValidationRuleAssignmentsList.php | 541 + src/Model/ValidationRuleError.php | 418 + ...ationRulesAssignmentsCreateRequestBody.php | 501 + ...tionRulesAssignmentsCreateResponseBody.php | 697 + src/Model/ValidationRulesAssignmentsList.php | 614 + ...dationRulesAssignmentsListResponseBody.php | 541 + .../ValidationRulesCreateRequestBody.php | 798 + ...tionRulesCreateRequestBodyApplicableTo.php | 499 + .../ValidationRulesCreateRequestBodyError.php | 418 + .../ValidationRulesCreateResponseBody.php | 1003 ++ ...ionRulesCreateResponseBodyApplicableTo.php | 499 + ...ValidationRulesCreateResponseBodyError.php | 418 + src/Model/ValidationRulesGetResponseBody.php | 1003 ++ ...dationRulesGetResponseBodyApplicableTo.php | 499 + .../ValidationRulesGetResponseBodyError.php | 418 + src/Model/ValidationRulesListResponseBody.php | 541 + .../ValidationRulesUpdateRequestBody.php | 798 + ...tionRulesUpdateRequestBodyApplicableTo.php | 499 + .../ValidationRulesUpdateRequestBodyError.php | 418 + .../ValidationRulesUpdateResponseBody.php | 1003 ++ ...ionRulesUpdateResponseBodyApplicableTo.php | 499 + ...ValidationRulesUpdateResponseBodyError.php | 418 + .../ValidationsRedeemableInapplicable.php | 688 + ...alidationsRedeemableInapplicableResult.php | 452 + ...onsRedeemableInapplicableResultDetails.php | 459 + src/Model/ValidationsRedeemableSkipped.php | 688 + .../ValidationsRedeemableSkippedResult.php | 418 + ...idationsRedeemableSkippedResultDetails.php | 500 + src/Model/ValidationsValidateRequestBody.php | 643 + .../ValidationsValidateRequestBodyOptions.php | 446 + ...ionsValidateRequestBodyRedeemablesItem.php | 562 + ...ValidateRequestBodyRedeemablesItemGift.php | 418 + ...lidateRequestBodyRedeemablesItemReward.php | 459 + src/Model/ValidationsValidateResponseBody.php | 687 + ...onsValidateResponseBodyRedeemablesItem.php | 773 + ...idateResponseBodyRedeemablesItemResult.php | 553 + ...sponseBodyRedeemablesItemResultDetails.php | 444 + ...ponseBodyRedeemablesItemResultDiscount.php | 1129 ++ ...dyRedeemablesItemResultDiscountProduct.php | 499 + ...eResponseBodyRedeemablesItemResultGift.php | 418 + ...seBodyRedeemablesItemResultLoyaltyCard.php | 417 + src/Model/ValidityHours.php | 418 + src/Model/ValidityHoursDailyItem.php | 513 + src/Model/ValidityTimeframe.php | 459 + src/Model/Voucher.php | 1601 ++ src/Model/VoucherAssets.php | 459 + src/Model/VoucherAssetsBarcode.php | 459 + src/Model/VoucherAssetsQr.php | 459 + src/Model/VoucherGift.php | 534 + src/Model/VoucherLoyaltyCard.php | 541 + src/Model/VoucherPublish.php | 500 + src/Model/VoucherRedemption.php | 582 + src/Model/VoucherTransaction.php | 832 + src/Model/VoucherTransactionDetails.php | 896 + .../VoucherTransactionDetailsBalance.php | 705 + ...TransactionDetailsBalanceRelatedObject.php | 500 + .../VoucherTransactionDetailsCustomEvent.php | 459 + .../VoucherTransactionDetailsEarningRule.php | 459 + ...herTransactionDetailsEarningRuleSource.php | 418 + src/Model/VoucherTransactionDetailsEvent.php | 459 + .../VoucherTransactionDetailsEventSchema.php | 459 + .../VoucherTransactionDetailsLoyaltyTier.php | 459 + src/Model/VoucherTransactionDetailsOrder.php | 459 + .../VoucherTransactionDetailsRedemption.php | 418 + src/Model/VoucherTransactionDetailsReward.php | 459 + .../VoucherTransactionDetailsRollback.php | 418 + .../VoucherTransactionDetailsSegment.php | 459 + ...cherTransactionsExportFilterConditions.php | 418 + ...actionsExportFilterConditionsVoucherId.php | 418 + ...ortFilterConditionsVoucherIdConditions.php | 433 + .../VoucherTransactionsExportParameters.php | 537 + src/Model/VoucherTransactionsFilters.php | 574 + src/Model/VoucherWithCategories.php | 1567 ++ src/Model/VoucherWithCategoriesGift.php | 534 + .../VoucherWithCategoriesLoyaltyCard.php | 541 + src/Model/VoucherWithCategoriesPublish.php | 500 + src/Model/VoucherWithCategoriesRedemption.php | 582 + .../VouchersBalanceUpdateRequestBody.php | 500 + .../VouchersBalanceUpdateResponseBody.php | 762 + ...BalanceUpdateResponseBodyRelatedObject.php | 491 + src/Model/VouchersCreateResponseBody.php | 1601 ++ src/Model/VouchersCreateResponseBodyGift.php | 534 + .../VouchersCreateResponseBodyLoyaltyCard.php | 541 + .../VouchersCreateResponseBodyPublish.php | 500 + .../VouchersCreateResponseBodyRedemption.php | 582 + ...chersCreateWithSpecificCodeRequestBody.php | 1149 ++ ...eWithSpecificCodeRequestBodyRedemption.php | 417 + src/Model/VouchersDisableResponseBody.php | 1601 ++ src/Model/VouchersDisableResponseBodyGift.php | 534 + ...VouchersDisableResponseBodyLoyaltyCard.php | 541 + .../VouchersDisableResponseBodyPublish.php | 500 + .../VouchersDisableResponseBodyRedemption.php | 582 + src/Model/VouchersEnableResponseBody.php | 1601 ++ src/Model/VouchersEnableResponseBodyGift.php | 534 + .../VouchersEnableResponseBodyLoyaltyCard.php | 541 + .../VouchersEnableResponseBodyPublish.php | 500 + .../VouchersEnableResponseBodyRedemption.php | 582 + src/Model/VouchersGetResponseBody.php | 1601 ++ src/Model/VouchersGetResponseBodyGift.php | 534 + .../VouchersGetResponseBodyLoyaltyCard.php | 541 + src/Model/VouchersGetResponseBodyPublish.php | 500 + .../VouchersGetResponseBodyRedemption.php | 582 + .../VouchersImportCreateItemRequestBody.php | 956 ++ ...sImportCreateItemRequestBodyRedemption.php | 417 + .../VouchersImportCreateResponseBody.php | 418 + .../VouchersImportCsvCreateResponseBody.php | 418 + src/Model/VouchersListResponseBody.php | 605 + ...ouchersMetadataUpdateInBulkRequestBody.php | 459 + ...uchersMetadataUpdateInBulkResponseBody.php | 418 + .../VouchersRedemptionGetResponseBody.php | 660 + ...ersTransactionsExportCreateRequestBody.php | 411 + ...rsTransactionsExportCreateResponseBody.php | 838 + ...sactionsExportCreateResponseBodyResult.php | 418 + .../VouchersTransactionsListResponseBody.php | 541 + .../VouchersUpdateInBulkItemRequestBody.php | 458 + .../VouchersUpdateInBulkResponseBody.php | 418 + src/Model/VouchersUpdateRequestBody.php | 985 ++ src/Model/VouchersUpdateResponseBody.php | 1601 ++ src/Model/VouchersUpdateResponseBodyGift.php | 534 + .../VouchersUpdateResponseBodyLoyaltyCard.php | 541 + .../VouchersUpdateResponseBodyPublish.php | 500 + .../VouchersUpdateResponseBodyRedemption.php | 582 + src/ObjectSerializer.php | 567 + src/Orders.php | 72 - src/Products.php | 175 - src/PromotionTiers.php | 105 - src/Promotions.php | 68 - src/Redemptions.php | 205 - src/Segments.php | 57 - src/Utils.php | 27 - src/ValidationRules.php | 129 - src/Validations.php | 56 - src/VoucherBuilder.php | 143 - src/VoucherifyClient.php | 308 - src/Vouchers.php | 150 - src/autoload.php | 15 - test/AsyncActionsTest.php | 75 - test/CampaignsTest.php | 146 - test/ClientTest.php | 217 - test/CustomEventsTest.php | 54 - test/CustomersTest.php | 129 - test/DistributionsTest.php | 159 - test/OrdersTest.php | 117 - test/ProductsTest.php | 257 - test/PromotionsTest.php | 192 - test/RedemptionsTest.php | 325 - test/SegmentsTest.php | 89 - test/UtilsTest.php | 63 - test/ValidationRulesTest.php | 208 - test/ValidationsTest.php | 132 - test/VouchersTest.php | 221 - test/helpers/CurlMock.php | 267 - test/helpers/CurlRequest.php | 179 - 2052 files changed, 649853 insertions(+), 7188 deletions(-) create mode 100644 .php-cs-fixer.dist.php create mode 100644 .phplint.yml create mode 100644 ENDPOINTS-COVERAGE.md create mode 100644 __tests__/Support/AcceptanceTester.php create mode 100644 __tests__/Support/Data/.gitkeep create mode 100644 __tests__/Support/FunctionalTester.php create mode 100644 __tests__/Support/UnitTester.php create mode 100644 __tests__/Support/_generated/.gitignore create mode 100644 __tests__/Unit.suite.yml create mode 100644 __tests__/Unit/01_ProductsTest.php create mode 100644 __tests__/Unit/02_CampaignsTest.php create mode 100644 __tests__/Unit/03_CustomersTest.php create mode 100644 __tests__/Unit/04_PublicationsTest.php create mode 100644 __tests__/Unit/05_QualificationsTest.php create mode 100644 __tests__/Unit/06_ValidationsTest.php create mode 100644 __tests__/Unit/07_VouchersTest.php create mode 100644 __tests__/Unit/08_EventsTest.php create mode 100644 __tests__/Unit/09_RedemptionsTest.php create mode 100644 __tests__/Unit/10_OdersTest.php create mode 100644 __tests__/Unit/11_LoyaltiesTest.php create mode 100644 __tests__/Unit/12_ValidationRulesTest.php create mode 100644 __tests__/_generated/UnitTesterActions.php create mode 100644 __tests__/lib/campaigns.php create mode 100644 __tests__/lib/config.php create mode 100644 __tests__/lib/customers.php create mode 100644 __tests__/lib/events.php create mode 100644 __tests__/lib/loyalties.php create mode 100644 __tests__/lib/orders.php create mode 100644 __tests__/lib/products.php create mode 100644 __tests__/lib/publications.php create mode 100644 __tests__/lib/qualifications.php create mode 100644 __tests__/lib/redemptions.php create mode 100644 __tests__/lib/utils.php create mode 100644 __tests__/lib/validationRules.php create mode 100644 __tests__/lib/validations.php create mode 100644 __tests__/lib/voucherify.php create mode 100644 __tests__/lib/vouchers.php create mode 100644 __tests__/snapshots/campaigns/addedVoucherToCampaign.json create mode 100644 __tests__/snapshots/campaigns/createdBundleOfVouchers.json create mode 100644 __tests__/snapshots/campaigns/createdDiscountCampaignWithValidationRule.json create mode 100644 __tests__/snapshots/campaigns/createdLoyaltyCampaign.json create mode 100644 __tests__/snapshots/campaigns/createdLoyaltyCard.json create mode 100644 __tests__/snapshots/campaigns/createdPromotionCampaign.json create mode 100644 __tests__/snapshots/campaigns/createdValidationRuleApplicableTo.json create mode 100644 __tests__/snapshots/campaigns/createdValidationRuleMoreThan.json create mode 100644 __tests__/snapshots/customers/createdCustomer.json create mode 100644 __tests__/snapshots/customers/deletedCustomerPermanently.json create mode 100644 __tests__/snapshots/events/createdEvent.json create mode 100644 __tests__/snapshots/loyalties/listedLoyaltyMemberCardTransactions.json create mode 100644 __tests__/snapshots/loyalties/updatedLoyaltyMemberCardBalanceBy1000Points.json create mode 100644 __tests__/snapshots/orders/createdOrder.json create mode 100644 __tests__/snapshots/orders/getOrder.json create mode 100644 __tests__/snapshots/orders/updatedOrder.json create mode 100644 __tests__/snapshots/products/createdProduct.json create mode 100644 __tests__/snapshots/products/createdProduct2.json create mode 100644 __tests__/snapshots/products/createdSku.json create mode 100644 __tests__/snapshots/products/getSku.json create mode 100644 __tests__/snapshots/products/listedSkusInProducts.json create mode 100644 __tests__/snapshots/products/updatedProduct.json create mode 100644 __tests__/snapshots/products/updatedSku.json create mode 100644 __tests__/snapshots/publications/createdPublication.json create mode 100644 __tests__/snapshots/qualifications/checkedEligibility.json create mode 100644 __tests__/snapshots/redemptions/redeemedStackedApplicableDiscounts.json create mode 100644 __tests__/snapshots/redemptions/redeemedStackedSkippedDiscounts.json create mode 100644 __tests__/snapshots/validationRules/createdValidationRule.json create mode 100644 __tests__/snapshots/validations/validatedStackedApplicableDiscounts.json create mode 100644 __tests__/snapshots/validations/validatedStackedInapplicableDiscounts.json create mode 100644 __tests__/snapshots/vouchers/disabledVoucher.json create mode 100644 __tests__/snapshots/vouchers/updatedLoyaltyCardBalance.json create mode 100644 __tests__/snapshots/vouchers/voucher.json create mode 100644 codeception.yml delete mode 100644 composer.lock create mode 100644 docs/Api/AsyncActionsApi.md create mode 100644 docs/Api/CampaignsApi.md create mode 100644 docs/Api/CategoriesApi.md create mode 100644 docs/Api/ClientSideApi.md create mode 100644 docs/Api/CustomersApi.md create mode 100644 docs/Api/EventsApi.md create mode 100644 docs/Api/ExportsApi.md create mode 100644 docs/Api/LoyaltiesApi.md create mode 100644 docs/Api/OrdersApi.md create mode 100644 docs/Api/ProductCollectionsApi.md create mode 100644 docs/Api/ProductsApi.md create mode 100644 docs/Api/PromotionsApi.md create mode 100644 docs/Api/PublicationsApi.md create mode 100644 docs/Api/QualificationsApi.md create mode 100644 docs/Api/RedemptionsApi.md create mode 100644 docs/Api/RewardsApi.md create mode 100644 docs/Api/SegmentsApi.md create mode 100644 docs/Api/ValidationRulesApi.md create mode 100644 docs/Api/ValidationsApi.md create mode 100644 docs/Api/VouchersApi.md create mode 100644 docs/Model/AccessSettingsCampaignAssignmentsList.md create mode 100644 docs/Model/ApplicableTo.md create mode 100644 docs/Model/ApplicableToResultList.md create mode 100644 docs/Model/AreaStoreCampaignAssignment.md create mode 100644 docs/Model/AsyncActionBase.md create mode 100644 docs/Model/AsyncActionGetResponseBody.md create mode 100644 docs/Model/AsyncActionsListResponseBody.md create mode 100644 docs/Model/BusValRuleAssignment.md create mode 100644 docs/Model/CampaignBase.md create mode 100644 docs/Model/CampaignLoyaltyCard.md create mode 100644 docs/Model/CampaignLoyaltyCardExpirationRules.md create mode 100644 docs/Model/CampaignLoyaltyVoucher.md create mode 100644 docs/Model/CampaignLoyaltyVoucherRedemption.md create mode 100644 docs/Model/CampaignVoucher.md create mode 100644 docs/Model/CampaignVoucherRedemption.md create mode 100644 docs/Model/CampaignsCreateRequestBody.md create mode 100644 docs/Model/CampaignsCreateRequestBodyPromotion.md create mode 100644 docs/Model/CampaignsCreateRequestBodyVoucher.md create mode 100644 docs/Model/CampaignsCreateRequestBodyVoucherRedemption.md create mode 100644 docs/Model/CampaignsCreateResponseBody.md create mode 100644 docs/Model/CampaignsDeleteResponseBody.md create mode 100644 docs/Model/CampaignsGetResponseBody.md create mode 100644 docs/Model/CampaignsImportCreateResponseBody.md create mode 100644 docs/Model/CampaignsImportCsvCreateResponseBody.md create mode 100644 docs/Model/CampaignsImportVoucherItem.md create mode 100644 docs/Model/CampaignsImportVoucherItemRedemption.md create mode 100644 docs/Model/CampaignsListResponseBody.md create mode 100644 docs/Model/CampaignsUpdateRequestBody.md create mode 100644 docs/Model/CampaignsUpdateRequestBodyOptions.md create mode 100644 docs/Model/CampaignsUpdateResponseBody.md create mode 100644 docs/Model/CampaignsVouchersCreateCombinedResponseBody.md create mode 100644 docs/Model/CampaignsVouchersCreateCombinedResponseBodyGift.md create mode 100644 docs/Model/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md create mode 100644 docs/Model/CampaignsVouchersCreateCombinedResponseBodyPublish.md create mode 100644 docs/Model/CampaignsVouchersCreateCombinedResponseBodyRedemption.md create mode 100644 docs/Model/CampaignsVouchersCreateInBulkRequestBody.md create mode 100644 docs/Model/CampaignsVouchersCreateInBulkRequestBodyRedemption.md create mode 100644 docs/Model/CampaignsVouchersCreateRequestBody.md create mode 100644 docs/Model/CampaignsVouchersCreateRequestBodyRedemption.md create mode 100644 docs/Model/CampaignsVouchersCreateResponseBody.md create mode 100644 docs/Model/CampaignsVouchersCreateResponseBodyGift.md create mode 100644 docs/Model/CampaignsVouchersCreateResponseBodyLoyaltyCard.md create mode 100644 docs/Model/CampaignsVouchersCreateResponseBodyPublish.md create mode 100644 docs/Model/CampaignsVouchersCreateResponseBodyRedemption.md create mode 100644 docs/Model/CategoriesCreateRequestBody.md create mode 100644 docs/Model/CategoriesCreateResponseBody.md create mode 100644 docs/Model/CategoriesGetResponseBody.md create mode 100644 docs/Model/CategoriesListResponseBody.md create mode 100644 docs/Model/CategoriesUpdateRequestBody.md create mode 100644 docs/Model/CategoriesUpdateResponseBody.md create mode 100644 docs/Model/Category.md create mode 100644 docs/Model/ClientEventsCreateRequestBody.md create mode 100644 docs/Model/ClientEventsCreateRequestBodyLoyalty.md create mode 100644 docs/Model/ClientEventsCreateRequestBodyReferral.md create mode 100644 docs/Model/ClientEventsCreateResponseBody.md create mode 100644 docs/Model/ClientPromotionsTiersListResponseBody.md create mode 100644 docs/Model/ClientQualificationsCheckEligibilityRequestBody.md create mode 100644 docs/Model/ClientQualificationsCheckEligibilityResponseBody.md create mode 100644 docs/Model/ClientQualificationsCheckEligibilityResponseBodyOrder.md create mode 100644 docs/Model/ClientRedemptionsRedeemRequestBody.md create mode 100644 docs/Model/ClientRedemptionsRedeemRequestBodyOptions.md create mode 100644 docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md create mode 100644 docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md create mode 100644 docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md create mode 100644 docs/Model/ClientRedemptionsRedeemResponseBody.md create mode 100644 docs/Model/ClientValidationsValidateRequestBody.md create mode 100644 docs/Model/ClientValidationsValidateRequestBodyOptions.md create mode 100644 docs/Model/ClientValidationsValidateRequestBodyRedeemablesItem.md create mode 100644 docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemGift.md create mode 100644 docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemReward.md create mode 100644 docs/Model/ClientValidationsValidateResponseBody.md create mode 100644 docs/Model/ClientValidationsValidateResponseBodyRedeemablesItem.md create mode 100644 docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResult.md create mode 100644 docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md create mode 100644 docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md create mode 100644 docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md create mode 100644 docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md create mode 100644 docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md create mode 100644 docs/Model/CodeConfig.md create mode 100644 docs/Model/CreatePublicationCampaign.md create mode 100644 docs/Model/Customer.md create mode 100644 docs/Model/CustomerActivity.md create mode 100644 docs/Model/CustomerAddress.md create mode 100644 docs/Model/CustomerId.md create mode 100644 docs/Model/CustomerLoyalty.md create mode 100644 docs/Model/CustomerLoyaltyCampaignsEntry.md create mode 100644 docs/Model/CustomerRedeemable.md create mode 100644 docs/Model/CustomerRedeemableRedeemable.md create mode 100644 docs/Model/CustomerReferrals.md create mode 100644 docs/Model/CustomerReferralsCampaignsItem.md create mode 100644 docs/Model/CustomerSummary.md create mode 100644 docs/Model/CustomerSummaryOrders.md create mode 100644 docs/Model/CustomerSummaryRedemptions.md create mode 100644 docs/Model/CustomerSummaryRedemptionsGift.md create mode 100644 docs/Model/CustomerSummaryRedemptionsLoyaltyCard.md create mode 100644 docs/Model/CustomerWithSummaryLoyaltyReferrals.md create mode 100644 docs/Model/CustomerWithSummaryLoyaltyReferralsAddress.md create mode 100644 docs/Model/CustomerWithSummaryLoyaltyReferralsAssets.md create mode 100644 docs/Model/CustomersActivitiesListResponseBody.md create mode 100644 docs/Model/CustomersActivityListResponseBody.md create mode 100644 docs/Model/CustomersCreateRequestBody.md create mode 100644 docs/Model/CustomersCreateRequestBodyAddress.md create mode 100644 docs/Model/CustomersCreateResponseBody.md create mode 100644 docs/Model/CustomersCreateResponseBodyAddress.md create mode 100644 docs/Model/CustomersCreateResponseBodyAssets.md create mode 100644 docs/Model/CustomersGetResponseBody.md create mode 100644 docs/Model/CustomersGetResponseBodyAddress.md create mode 100644 docs/Model/CustomersGetResponseBodyAssets.md create mode 100644 docs/Model/CustomersImportCsvCreateResponseBody.md create mode 100644 docs/Model/CustomersListResponseBody.md create mode 100644 docs/Model/CustomersMetadataUpdateInBulkRequestBody.md create mode 100644 docs/Model/CustomersMetadataUpdateInBulkResponseBody.md create mode 100644 docs/Model/CustomersPermanentDeletionCreateResponseBody.md create mode 100644 docs/Model/CustomersPermanentDeletionCreateResponseBodyDataJson.md create mode 100644 docs/Model/CustomersRedeemablesListResponseBody.md create mode 100644 docs/Model/CustomersSegmentsListResponseBody.md create mode 100644 docs/Model/CustomersUpdateInBulkRequestBody.md create mode 100644 docs/Model/CustomersUpdateInBulkRequestBodyAddress.md create mode 100644 docs/Model/CustomersUpdateInBulkResponseBody.md create mode 100644 docs/Model/CustomersUpdateRequestBody.md create mode 100644 docs/Model/CustomersUpdateRequestBodyAddress.md create mode 100644 docs/Model/CustomersUpdateResponseBody.md create mode 100644 docs/Model/CustomersUpdateResponseBodyAddress.md create mode 100644 docs/Model/CustomersUpdateResponseBodyAssets.md create mode 100644 docs/Model/Discount.md create mode 100644 docs/Model/DiscountUnitMultipleOneUnit.md create mode 100644 docs/Model/EarningRule.md create mode 100644 docs/Model/EarningRuleCustomEvent.md create mode 100644 docs/Model/EarningRuleLoyalty.md create mode 100644 docs/Model/EarningRuleLoyaltyCustomEvent.md create mode 100644 docs/Model/EarningRuleLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/EarningRuleLoyaltyCustomer.md create mode 100644 docs/Model/EarningRuleLoyaltyCustomerMetadata.md create mode 100644 docs/Model/EarningRuleLoyaltyOrder.md create mode 100644 docs/Model/EarningRuleLoyaltyOrderAmount.md create mode 100644 docs/Model/EarningRuleLoyaltyOrderItems.md create mode 100644 docs/Model/EarningRuleLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/EarningRuleLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/EarningRuleLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/EarningRuleLoyaltyOrderMetadata.md create mode 100644 docs/Model/EarningRuleLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/EarningRuleLoyaltyTier.md create mode 100644 docs/Model/EarningRuleSegment.md create mode 100644 docs/Model/EarningRuleSource.md create mode 100644 docs/Model/Error.md create mode 100644 docs/Model/EventsCreateRequestBody.md create mode 100644 docs/Model/EventsCreateRequestBodyLoyalty.md create mode 100644 docs/Model/EventsCreateRequestBodyReferral.md create mode 100644 docs/Model/EventsCreateResponseBody.md create mode 100644 docs/Model/Export.md create mode 100644 docs/Model/ExportParameters.md create mode 100644 docs/Model/ExportParametersFilters.md create mode 100644 docs/Model/ExportResult.md create mode 100644 docs/Model/ExportVoucherTransactionsFilters.md create mode 100644 docs/Model/ExportsCreateRequestBody.md create mode 100644 docs/Model/ExportsCreateRequestBodyParameters.md create mode 100644 docs/Model/ExportsCreateRequestBodyParametersFilters.md create mode 100644 docs/Model/ExportsCreateResponseBody.md create mode 100644 docs/Model/ExportsCreateResponseBodyParameters.md create mode 100644 docs/Model/ExportsCreateResponseBodyParametersFilters.md create mode 100644 docs/Model/ExportsGetResponseBody.md create mode 100644 docs/Model/ExportsGetResponseBodyParameters.md create mode 100644 docs/Model/ExportsGetResponseBodyParametersFilters.md create mode 100644 docs/Model/ExportsGetResponseBodyResult.md create mode 100644 docs/Model/ExportsListResponseBody.md create mode 100644 docs/Model/FieldConditions.md create mode 100644 docs/Model/FilterConditionsDateTime.md create mode 100644 docs/Model/FilterConditionsDateTimeConditions.md create mode 100644 docs/Model/FilterConditionsString.md create mode 100644 docs/Model/FiltersCondition.md create mode 100644 docs/Model/Gift.md create mode 100644 docs/Model/InapplicableTo.md create mode 100644 docs/Model/InapplicableToResultList.md create mode 100644 docs/Model/ListPublicationsItemVoucher.md create mode 100644 docs/Model/LoyaltiesCreateCampaignRequestBody.md create mode 100644 docs/Model/LoyaltiesCreateCampaignResponseBody.md create mode 100644 docs/Model/LoyaltiesDeleteResponseBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomer.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomerMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySegment.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrder.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItems.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItem.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemSource.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodySegment.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateResponseBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyaltyTier.md create mode 100644 docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodySegment.md create mode 100644 docs/Model/LoyaltiesEarningRulesDisableResponseBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodySegment.md create mode 100644 docs/Model/LoyaltiesEarningRulesEnableResponseBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodySegment.md create mode 100644 docs/Model/LoyaltiesEarningRulesGetResponseBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesListResponseBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateRequestBodySource.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBody.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodySegment.md create mode 100644 docs/Model/LoyaltiesEarningRulesUpdateResponseBodySource.md create mode 100644 docs/Model/LoyaltiesGetCampaignResponseBody.md create mode 100644 docs/Model/LoyaltiesListCampaignsResponseBody.md create mode 100644 docs/Model/LoyaltiesListMembersResponseBody.md create mode 100644 docs/Model/LoyaltiesLoyaltyTierReward.md create mode 100644 docs/Model/LoyaltiesMemberActivityListResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersBalanceUpdateRequestBody.md create mode 100644 docs/Model/LoyaltiesMembersBalanceUpdateResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md create mode 100644 docs/Model/LoyaltiesMembersCreateRequestBody.md create mode 100644 docs/Model/LoyaltiesMembersCreateResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md create mode 100644 docs/Model/LoyaltiesMembersCreateResponseBodyPublish.md create mode 100644 docs/Model/LoyaltiesMembersCreateResponseBodyRedemption.md create mode 100644 docs/Model/LoyaltiesMembersGetResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersGetResponseBodyLoyaltyCard.md create mode 100644 docs/Model/LoyaltiesMembersGetResponseBodyPublish.md create mode 100644 docs/Model/LoyaltiesMembersGetResponseBodyRedemption.md create mode 100644 docs/Model/LoyaltiesMembersPointsExpirationListResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md create mode 100644 docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemRequestBody.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md create mode 100644 docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md create mode 100644 docs/Model/LoyaltiesMembersRewardsListResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersRewardsListResponseBodyDataItem.md create mode 100644 docs/Model/LoyaltiesMembersTiersListResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersTransactionsExportCreateRequestBody.md create mode 100644 docs/Model/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md create mode 100644 docs/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md create mode 100644 docs/Model/LoyaltiesMembersTransactionsListResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersTransfersCreateResponseBody.md create mode 100644 docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssets.md create mode 100644 docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md create mode 100644 docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md create mode 100644 docs/Model/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md create mode 100644 docs/Model/LoyaltiesMembersTransfersCreateResponseBodyPublish.md create mode 100644 docs/Model/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateRequestBody.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateResponseBody.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md create mode 100644 docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md create mode 100644 docs/Model/LoyaltiesRewardAssignmentsGetResponseBody.md create mode 100644 docs/Model/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md create mode 100644 docs/Model/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md create mode 100644 docs/Model/LoyaltiesRewardAssignmentsListResponseBody.md create mode 100644 docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.md create mode 100644 docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md create mode 100644 docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBody.md create mode 100644 docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md create mode 100644 docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md create mode 100644 docs/Model/LoyaltiesRewardsCreateAssignmentResponseBody.md create mode 100644 docs/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md create mode 100644 docs/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md create mode 100644 docs/Model/LoyaltiesRewardsGetResponseBody.md create mode 100644 docs/Model/LoyaltiesRewardsGetResponseBodyParameters.md create mode 100644 docs/Model/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md create mode 100644 docs/Model/LoyaltiesRewardsListAssignmentsResponseBody.md create mode 100644 docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBody.md create mode 100644 docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md create mode 100644 docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md create mode 100644 docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBody.md create mode 100644 docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md create mode 100644 docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md create mode 100644 docs/Model/LoyaltiesTiersCreateInBulkRequestBodyItem.md create mode 100644 docs/Model/LoyaltiesTiersEarningRulesListResponseBody.md create mode 100644 docs/Model/LoyaltiesTiersGetResponseBody.md create mode 100644 docs/Model/LoyaltiesTiersGetResponseBodyConfig.md create mode 100644 docs/Model/LoyaltiesTiersGetResponseBodyConfigPoints.md create mode 100644 docs/Model/LoyaltiesTiersGetResponseBodyPoints.md create mode 100644 docs/Model/LoyaltiesTiersListResponseBody.md create mode 100644 docs/Model/LoyaltiesTiersRewardsListResponseBody.md create mode 100644 docs/Model/LoyaltiesTransferPoints.md create mode 100644 docs/Model/LoyaltiesUpdateCampaignRequestBody.md create mode 100644 docs/Model/LoyaltiesUpdateCampaignRequestBodyOptions.md create mode 100644 docs/Model/LoyaltiesUpdateCampaignResponseBody.md create mode 100644 docs/Model/LoyaltyCampaign.md create mode 100644 docs/Model/LoyaltyCampaignVoucher.md create mode 100644 docs/Model/LoyaltyCampaignVoucherRedemption.md create mode 100644 docs/Model/LoyaltyCardTransaction.md create mode 100644 docs/Model/LoyaltyCardTransactionDetails.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsBalance.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsBalanceRelatedObject.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsCustomEvent.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsEarningRule.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsEarningRuleSource.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsEvent.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsEventSchema.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsLoyaltyTier.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsOrder.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsRedemption.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsReward.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsRollback.md create mode 100644 docs/Model/LoyaltyCardTransactionDetailsSegment.md create mode 100644 docs/Model/LoyaltyMember.md create mode 100644 docs/Model/LoyaltyMemberLoyaltyCard.md create mode 100644 docs/Model/LoyaltyMemberPublish.md create mode 100644 docs/Model/LoyaltyMemberRedemption.md create mode 100644 docs/Model/LoyaltyTier.md create mode 100644 docs/Model/LoyaltyTierBase.md create mode 100644 docs/Model/LoyaltyTierBasePoints.md create mode 100644 docs/Model/LoyaltyTierConfig.md create mode 100644 docs/Model/LoyaltyTierConfigPoints.md create mode 100644 docs/Model/LoyaltyTierExpiration.md create mode 100644 docs/Model/LoyaltyTierPoints.md create mode 100644 docs/Model/LoyaltyTiersExpirationAll.md create mode 100644 docs/Model/LoyaltyTiersExpirationAllExpirationDate.md create mode 100644 docs/Model/LoyaltyTiersExpirationAllExpirationDateRounding.md create mode 100644 docs/Model/LoyaltyTiersExpirationAllStartDate.md create mode 100644 docs/Model/LuckyDraw.md create mode 100644 docs/Model/MappingPoints.md create mode 100644 docs/Model/MemberActivity.md create mode 100644 docs/Model/Order.md create mode 100644 docs/Model/OrderCalculated.md create mode 100644 docs/Model/OrderCalculatedCustomer.md create mode 100644 docs/Model/OrderCalculatedCustomerAddress.md create mode 100644 docs/Model/OrderCalculatedEssential.md create mode 100644 docs/Model/OrderCalculatedItem.md create mode 100644 docs/Model/OrderCalculatedItemProduct.md create mode 100644 docs/Model/OrderCalculatedItemSku.md create mode 100644 docs/Model/OrderCalculatedNoCustomerData.md create mode 100644 docs/Model/OrderCalculatedReferrer.md create mode 100644 docs/Model/OrderCalculatedReferrerAddress.md create mode 100644 docs/Model/OrderCreateBase.md create mode 100644 docs/Model/OrderItem.md create mode 100644 docs/Model/OrderItemCalculated.md create mode 100644 docs/Model/OrderItemCalculatedProduct.md create mode 100644 docs/Model/OrderItemCalculatedSku.md create mode 100644 docs/Model/OrderItemProduct.md create mode 100644 docs/Model/OrderItemSku.md create mode 100644 docs/Model/OrderRedemptions.md create mode 100644 docs/Model/OrderRedemptionsEntry.md create mode 100644 docs/Model/OrdersCreateRequestBody.md create mode 100644 docs/Model/OrdersCreateResponseBody.md create mode 100644 docs/Model/OrdersCreateResponseBodyCustomer.md create mode 100644 docs/Model/OrdersCreateResponseBodyCustomerAddress.md create mode 100644 docs/Model/OrdersCreateResponseBodyReferrer.md create mode 100644 docs/Model/OrdersCreateResponseBodyReferrerAddress.md create mode 100644 docs/Model/OrdersExportCreateRequestBody.md create mode 100644 docs/Model/OrdersExportCreateRequestBodyParameters.md create mode 100644 docs/Model/OrdersExportCreateResponseBody.md create mode 100644 docs/Model/OrdersExportCreateResponseBodyParameters.md create mode 100644 docs/Model/OrdersGetResponseBody.md create mode 100644 docs/Model/OrdersImportCreateRequestBodyItem.md create mode 100644 docs/Model/OrdersImportCreateResponseBody.md create mode 100644 docs/Model/OrdersListResponseBody.md create mode 100644 docs/Model/OrdersUpdateRequestBody.md create mode 100644 docs/Model/OrdersUpdateResponseBody.md create mode 100644 docs/Model/OrdersUpdateResponseBodyCustomer.md create mode 100644 docs/Model/OrdersUpdateResponseBodyCustomerAddress.md create mode 100644 docs/Model/OrdersUpdateResponseBodyReferrer.md create mode 100644 docs/Model/OrdersUpdateResponseBodyReferrerAddress.md create mode 100644 docs/Model/ParameterActivityCategory.md create mode 100644 docs/Model/ParameterCampaignType.md create mode 100644 docs/Model/ParameterCreatedBeforeAfter.md create mode 100644 docs/Model/ParameterExpandListCampaigns.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemables.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesCampaignId.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesCampaignType.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesCreatedAt.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesHolderRole.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesId.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableId.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableObject.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesVoucherType.md create mode 100644 docs/Model/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md create mode 100644 docs/Model/ParameterFiltersListRedemptions.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsCampaignName.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsCustomerId.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsFailureCode.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsObject.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsParentRedemptionId.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsRelatedObjectId.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsRelatedObjectParentId.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsResult.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsUserLogin.md create mode 100644 docs/Model/ParameterFiltersListRedemptionsVoucherCode.md create mode 100644 docs/Model/ParameterOrder.md create mode 100644 docs/Model/ParameterOrderCreatedAt.md create mode 100644 docs/Model/ParameterOrderListAllPromotionStacks.md create mode 100644 docs/Model/ParameterOrderListCampaigns.md create mode 100644 docs/Model/ParameterOrderListCustomers.md create mode 100644 docs/Model/ParameterOrderListEarningRules.md create mode 100644 docs/Model/ParameterOrderListExports.md create mode 100644 docs/Model/ParameterOrderListLoyaltyTiers.md create mode 100644 docs/Model/ParameterOrderListOrders.md create mode 100644 docs/Model/ParameterOrderListPromotionTiers.md create mode 100644 docs/Model/ParameterOrderListPromotionTiersClientSide.md create mode 100644 docs/Model/ParameterOrderListPublications.md create mode 100644 docs/Model/ParameterOrderListRedeemables.md create mode 100644 docs/Model/ParameterOrderListRedemptions.md create mode 100644 docs/Model/ParameterOrderListValidationRuleAssignments.md create mode 100644 docs/Model/ParameterOrderListValidationRules.md create mode 100644 docs/Model/ParameterOrderVouchers.md create mode 100644 docs/Model/ParameterResultListPublications.md create mode 100644 docs/Model/ParameterUpdatedBeforeAfter.md create mode 100644 docs/Model/ParameterVoucherTypeListPublications.md create mode 100644 docs/Model/Product.md create mode 100644 docs/Model/ProductCollectionsCreateRequestBody.md create mode 100644 docs/Model/ProductCollectionsCreateRequestBodyFilter.md create mode 100644 docs/Model/ProductCollectionsCreateRequestBodyProductsItem.md create mode 100644 docs/Model/ProductCollectionsCreateResponseBody.md create mode 100644 docs/Model/ProductCollectionsCreateResponseBodyFilter.md create mode 100644 docs/Model/ProductCollectionsCreateResponseBodyProductsItem.md create mode 100644 docs/Model/ProductCollectionsGetResponseBody.md create mode 100644 docs/Model/ProductCollectionsGetResponseBodyFilter.md create mode 100644 docs/Model/ProductCollectionsGetResponseBodyProductsItem.md create mode 100644 docs/Model/ProductCollectionsItem.md create mode 100644 docs/Model/ProductCollectionsItemFilter.md create mode 100644 docs/Model/ProductCollectionsItemProductsItem.md create mode 100644 docs/Model/ProductCollectionsListResponseBody.md create mode 100644 docs/Model/ProductCollectionsProductsListResponseBody.md create mode 100644 docs/Model/ProductCollectionsProductsListResponseBodyDataItem.md create mode 100644 docs/Model/ProductWithoutSkus.md create mode 100644 docs/Model/ProductsCreateRequestBody.md create mode 100644 docs/Model/ProductsCreateResponseBody.md create mode 100644 docs/Model/ProductsGetResponseBody.md create mode 100644 docs/Model/ProductsImportCsvCreateResponseBody.md create mode 100644 docs/Model/ProductsListResponseBody.md create mode 100644 docs/Model/ProductsMetadataUpdateInBulkRequestBody.md create mode 100644 docs/Model/ProductsMetadataUpdateInBulkResponseBody.md create mode 100644 docs/Model/ProductsSkusCreateRequestBody.md create mode 100644 docs/Model/ProductsSkusCreateResponseBody.md create mode 100644 docs/Model/ProductsSkusListResponseBody.md create mode 100644 docs/Model/ProductsSkusUpdateRequestBody.md create mode 100644 docs/Model/ProductsSkusUpdateResponseBody.md create mode 100644 docs/Model/ProductsUpdateInBulkRequestBody.md create mode 100644 docs/Model/ProductsUpdateInBulkResponseBody.md create mode 100644 docs/Model/ProductsUpdateRequestBody.md create mode 100644 docs/Model/ProductsUpdateResponseBody.md create mode 100644 docs/Model/PromotionStack.md create mode 100644 docs/Model/PromotionStackBase.md create mode 100644 docs/Model/PromotionStackBaseTiers.md create mode 100644 docs/Model/PromotionStackTiers.md create mode 100644 docs/Model/PromotionTier.md create mode 100644 docs/Model/PromotionTierAction.md create mode 100644 docs/Model/PromotionTierCampaign.md create mode 100644 docs/Model/PromotionTierCreateParams.md create mode 100644 docs/Model/PromotionTierCreateParamsAction.md create mode 100644 docs/Model/PromotionTierSummary.md create mode 100644 docs/Model/PromotionTierSummaryOrders.md create mode 100644 docs/Model/PromotionTierSummaryRedemptions.md create mode 100644 docs/Model/PromotionTiersList.md create mode 100644 docs/Model/PromotionsStacksCreateRequestBody.md create mode 100644 docs/Model/PromotionsStacksCreateRequestBodyTiers.md create mode 100644 docs/Model/PromotionsStacksCreateResponseBody.md create mode 100644 docs/Model/PromotionsStacksCreateResponseBodyTiers.md create mode 100644 docs/Model/PromotionsStacksGetResponseBody.md create mode 100644 docs/Model/PromotionsStacksGetResponseBodyTiers.md create mode 100644 docs/Model/PromotionsStacksListResponseBody.md create mode 100644 docs/Model/PromotionsStacksUpdateRequestBody.md create mode 100644 docs/Model/PromotionsStacksUpdateRequestBodyTiers.md create mode 100644 docs/Model/PromotionsStacksUpdateResponseBody.md create mode 100644 docs/Model/PromotionsStacksUpdateResponseBodyTiers.md create mode 100644 docs/Model/PromotionsTiersCreateRequestBody.md create mode 100644 docs/Model/PromotionsTiersCreateRequestBodyAction.md create mode 100644 docs/Model/PromotionsTiersCreateResponseBody.md create mode 100644 docs/Model/PromotionsTiersCreateResponseBodyAction.md create mode 100644 docs/Model/PromotionsTiersCreateResponseBodyCampaign.md create mode 100644 docs/Model/PromotionsTiersCreateResponseBodySummary.md create mode 100644 docs/Model/PromotionsTiersCreateResponseBodySummaryOrders.md create mode 100644 docs/Model/PromotionsTiersCreateResponseBodySummaryRedemptions.md create mode 100644 docs/Model/PromotionsTiersDisableResponseBody.md create mode 100644 docs/Model/PromotionsTiersDisableResponseBodyAction.md create mode 100644 docs/Model/PromotionsTiersDisableResponseBodyCampaign.md create mode 100644 docs/Model/PromotionsTiersDisableResponseBodySummary.md create mode 100644 docs/Model/PromotionsTiersDisableResponseBodySummaryOrders.md create mode 100644 docs/Model/PromotionsTiersDisableResponseBodySummaryRedemptions.md create mode 100644 docs/Model/PromotionsTiersEnableResponseBody.md create mode 100644 docs/Model/PromotionsTiersEnableResponseBodyAction.md create mode 100644 docs/Model/PromotionsTiersEnableResponseBodyCampaign.md create mode 100644 docs/Model/PromotionsTiersEnableResponseBodySummary.md create mode 100644 docs/Model/PromotionsTiersEnableResponseBodySummaryOrders.md create mode 100644 docs/Model/PromotionsTiersEnableResponseBodySummaryRedemptions.md create mode 100644 docs/Model/PromotionsTiersGetResponseBody.md create mode 100644 docs/Model/PromotionsTiersGetResponseBodyAction.md create mode 100644 docs/Model/PromotionsTiersGetResponseBodyCampaign.md create mode 100644 docs/Model/PromotionsTiersGetResponseBodySummary.md create mode 100644 docs/Model/PromotionsTiersGetResponseBodySummaryOrders.md create mode 100644 docs/Model/PromotionsTiersGetResponseBodySummaryRedemptions.md create mode 100644 docs/Model/PromotionsTiersListResponseBody.md create mode 100644 docs/Model/PromotionsTiersUpdateRequestBody.md create mode 100644 docs/Model/PromotionsTiersUpdateRequestBodyAction.md create mode 100644 docs/Model/PromotionsTiersUpdateResponseBody.md create mode 100644 docs/Model/PromotionsTiersUpdateResponseBodyAction.md create mode 100644 docs/Model/PromotionsTiersUpdateResponseBodyCampaign.md create mode 100644 docs/Model/PromotionsTiersUpdateResponseBodySummary.md create mode 100644 docs/Model/PromotionsTiersUpdateResponseBodySummaryOrders.md create mode 100644 docs/Model/PromotionsTiersUpdateResponseBodySummaryRedemptions.md create mode 100644 docs/Model/PublicationsCreateRequestBody.md create mode 100644 docs/Model/PublicationsCreateRequestBodyCustomer.md create mode 100644 docs/Model/PublicationsCreateRequestBodyCustomerAddress.md create mode 100644 docs/Model/PublicationsCreateResponseBody.md create mode 100644 docs/Model/PublicationsListResponseBody.md create mode 100644 docs/Model/PublicationsListResponseBodyPublicationsItem.md create mode 100644 docs/Model/PublicationsListResponseBodyPublicationsItemMetadata.md create mode 100644 docs/Model/QualificationsCheckEligibilityRequestBody.md create mode 100644 docs/Model/QualificationsCheckEligibilityResponseBody.md create mode 100644 docs/Model/QualificationsCheckEligibilityResponseBodyOrder.md create mode 100644 docs/Model/QualificationsFieldConditions.md create mode 100644 docs/Model/QualificationsFiltersCondition.md create mode 100644 docs/Model/QualificationsOption.md create mode 100644 docs/Model/QualificationsOptionFilters.md create mode 100644 docs/Model/QualificationsOptionFiltersCampaignType.md create mode 100644 docs/Model/QualificationsOptionFiltersCampaignTypeConditions.md create mode 100644 docs/Model/QualificationsOptionFiltersHolderRole.md create mode 100644 docs/Model/QualificationsOptionFiltersHolderRoleConditions.md create mode 100644 docs/Model/QualificationsOptionFiltersResourceType.md create mode 100644 docs/Model/QualificationsOptionFiltersResourceTypeConditions.md create mode 100644 docs/Model/QualificationsRedeemable.md create mode 100644 docs/Model/QualificationsRedeemableBase.md create mode 100644 docs/Model/QualificationsRedeemables.md create mode 100644 docs/Model/RedeemableGift.md create mode 100644 docs/Model/RedeemableLoyaltyCard.md create mode 100644 docs/Model/RedeemableResult.md create mode 100644 docs/Model/RedeemableVoucher.md create mode 100644 docs/Model/RedeemableVoucherGift.md create mode 100644 docs/Model/RedeemableVoucherLoyaltyCard.md create mode 100644 docs/Model/RedeemableVoucherPublish.md create mode 100644 docs/Model/RedeemableVoucherRedemption.md create mode 100644 docs/Model/Redemption.md create mode 100644 docs/Model/RedemptionChannel.md create mode 100644 docs/Model/RedemptionEntry.md create mode 100644 docs/Model/RedemptionEntryChannel.md create mode 100644 docs/Model/RedemptionEntryCustomer.md create mode 100644 docs/Model/RedemptionEntryGift.md create mode 100644 docs/Model/RedemptionEntryLoyaltyCard.md create mode 100644 docs/Model/RedemptionEntryOrder.md create mode 100644 docs/Model/RedemptionEntryOrderCustomer.md create mode 100644 docs/Model/RedemptionEntryOrderReferrer.md create mode 100644 docs/Model/RedemptionEntryPromotionTier.md create mode 100644 docs/Model/RedemptionEntryPromotionTierAction.md create mode 100644 docs/Model/RedemptionEntryPromotionTierCampaign.md create mode 100644 docs/Model/RedemptionEntryPromotionTierSummary.md create mode 100644 docs/Model/RedemptionEntryPromotionTierSummaryOrders.md create mode 100644 docs/Model/RedemptionEntryPromotionTierSummaryRedemptions.md create mode 100644 docs/Model/RedemptionEntryRelatedRedemptions.md create mode 100644 docs/Model/RedemptionEntryRelatedRedemptionsRedemptionsItem.md create mode 100644 docs/Model/RedemptionEntryRelatedRedemptionsRollbacksItem.md create mode 100644 docs/Model/RedemptionEntryVoucher.md create mode 100644 docs/Model/RedemptionEntryVoucherGift.md create mode 100644 docs/Model/RedemptionEntryVoucherLoyaltyCard.md create mode 100644 docs/Model/RedemptionEntryVoucherPublish.md create mode 100644 docs/Model/RedemptionEntryVoucherRedemption.md create mode 100644 docs/Model/RedemptionGift.md create mode 100644 docs/Model/RedemptionLoyaltyCard.md create mode 100644 docs/Model/RedemptionRelatedRedemptions.md create mode 100644 docs/Model/RedemptionRelatedRedemptionsRedemptionsItem.md create mode 100644 docs/Model/RedemptionRelatedRedemptionsRollbacksItem.md create mode 100644 docs/Model/RedemptionRewardResult.md create mode 100644 docs/Model/RedemptionRewardResultParameters.md create mode 100644 docs/Model/RedemptionRewardResultParametersCampaign.md create mode 100644 docs/Model/RedemptionRewardResultParametersCoin.md create mode 100644 docs/Model/RedemptionRewardResultParametersProduct.md create mode 100644 docs/Model/RedemptionRollback.md create mode 100644 docs/Model/RedemptionRollbackChannel.md create mode 100644 docs/Model/RedemptionRollbackGift.md create mode 100644 docs/Model/RedemptionRollbackLoyaltyCard.md create mode 100644 docs/Model/RedemptionRollbackRelatedRedemptions.md create mode 100644 docs/Model/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md create mode 100644 docs/Model/RedemptionRollbackRelatedRedemptionsRollbacksItem.md create mode 100644 docs/Model/RedemptionVoucher.md create mode 100644 docs/Model/RedemptionVoucherGift.md create mode 100644 docs/Model/RedemptionVoucherLoyaltyCard.md create mode 100644 docs/Model/RedemptionVoucherPublish.md create mode 100644 docs/Model/RedemptionVoucherRedemption.md create mode 100644 docs/Model/RedemptionsGetResponseBody.md create mode 100644 docs/Model/RedemptionsGetResponseBodyChannel.md create mode 100644 docs/Model/RedemptionsGetResponseBodyCustomer.md create mode 100644 docs/Model/RedemptionsGetResponseBodyGift.md create mode 100644 docs/Model/RedemptionsGetResponseBodyLoyaltyCard.md create mode 100644 docs/Model/RedemptionsGetResponseBodyOrder.md create mode 100644 docs/Model/RedemptionsGetResponseBodyOrderCustomer.md create mode 100644 docs/Model/RedemptionsGetResponseBodyOrderReferrer.md create mode 100644 docs/Model/RedemptionsGetResponseBodyPromotionTier.md create mode 100644 docs/Model/RedemptionsGetResponseBodyPromotionTierAction.md create mode 100644 docs/Model/RedemptionsGetResponseBodyPromotionTierCampaign.md create mode 100644 docs/Model/RedemptionsGetResponseBodyPromotionTierSummary.md create mode 100644 docs/Model/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md create mode 100644 docs/Model/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md create mode 100644 docs/Model/RedemptionsGetResponseBodyRelatedRedemptions.md create mode 100644 docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md create mode 100644 docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md create mode 100644 docs/Model/RedemptionsGetResponseBodyVoucher.md create mode 100644 docs/Model/RedemptionsGetResponseBodyVoucherGift.md create mode 100644 docs/Model/RedemptionsGetResponseBodyVoucherLoyaltyCard.md create mode 100644 docs/Model/RedemptionsGetResponseBodyVoucherPublish.md create mode 100644 docs/Model/RedemptionsGetResponseBodyVoucherRedemption.md create mode 100644 docs/Model/RedemptionsListResponseBody.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItem.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemChannel.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemCustomer.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemGift.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemOrder.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucher.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md create mode 100644 docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md create mode 100644 docs/Model/RedemptionsRedeemRequestBody.md create mode 100644 docs/Model/RedemptionsRedeemRequestBodyOptions.md create mode 100644 docs/Model/RedemptionsRedeemRequestBodyRedeemablesItem.md create mode 100644 docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemGift.md create mode 100644 docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemReward.md create mode 100644 docs/Model/RedemptionsRedeemResponseBody.md create mode 100644 docs/Model/RedemptionsRollbackCreateRequestBody.md create mode 100644 docs/Model/RedemptionsRollbackCreateResponseBody.md create mode 100644 docs/Model/RedemptionsRollbackCreateResponseBodyChannel.md create mode 100644 docs/Model/RedemptionsRollbackCreateResponseBodyGift.md create mode 100644 docs/Model/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md create mode 100644 docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md create mode 100644 docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md create mode 100644 docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md create mode 100644 docs/Model/RedemptionsRollbacksCreateRequestBody.md create mode 100644 docs/Model/RedemptionsRollbacksCreateResponseBody.md create mode 100644 docs/Model/ReferralProgram.md create mode 100644 docs/Model/ReferralProgramCustomEvent.md create mode 100644 docs/Model/ReferralProgramRefereeReward.md create mode 100644 docs/Model/ReferralProgramRefereeRewardRelatedObjectParent.md create mode 100644 docs/Model/Referrer.md create mode 100644 docs/Model/ReferrerAddress.md create mode 100644 docs/Model/ReferrerId.md create mode 100644 docs/Model/Reward.md create mode 100644 docs/Model/RewardAssignment.md create mode 100644 docs/Model/RewardAssignmentParameters.md create mode 100644 docs/Model/RewardAssignmentParametersLoyalty.md create mode 100644 docs/Model/RewardAttributes.md create mode 100644 docs/Model/RewardType.md create mode 100644 docs/Model/RewardTypeCampaign.md create mode 100644 docs/Model/RewardTypeCoin.md create mode 100644 docs/Model/RewardTypeProduct.md create mode 100644 docs/Model/RewardsAssignmentsCreateRequestBody.md create mode 100644 docs/Model/RewardsAssignmentsCreateRequestBodyParameters.md create mode 100644 docs/Model/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md create mode 100644 docs/Model/RewardsAssignmentsCreateResponseBody.md create mode 100644 docs/Model/RewardsAssignmentsCreateResponseBodyParameters.md create mode 100644 docs/Model/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md create mode 100644 docs/Model/RewardsAssignmentsGetResponseBody.md create mode 100644 docs/Model/RewardsAssignmentsGetResponseBodyParameters.md create mode 100644 docs/Model/RewardsAssignmentsGetResponseBodyParametersLoyalty.md create mode 100644 docs/Model/RewardsAssignmentsListResponseBody.md create mode 100644 docs/Model/RewardsAssignmentsUpdateRequestBody.md create mode 100644 docs/Model/RewardsAssignmentsUpdateRequestBodyParameters.md create mode 100644 docs/Model/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md create mode 100644 docs/Model/RewardsAssignmentsUpdateResponseBody.md create mode 100644 docs/Model/RewardsAssignmentsUpdateResponseBodyParameters.md create mode 100644 docs/Model/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md create mode 100644 docs/Model/RewardsCreateRequestBody.md create mode 100644 docs/Model/RewardsCreateRequestBodyAttributes.md create mode 100644 docs/Model/RewardsCreateRequestBodyParameters.md create mode 100644 docs/Model/RewardsCreateRequestBodyParametersCampaign.md create mode 100644 docs/Model/RewardsCreateRequestBodyParametersCoin.md create mode 100644 docs/Model/RewardsCreateRequestBodyParametersProduct.md create mode 100644 docs/Model/RewardsCreateResponseBody.md create mode 100644 docs/Model/RewardsCreateResponseBodyAttributes.md create mode 100644 docs/Model/RewardsListResponseBody.md create mode 100644 docs/Model/RewardsUpdateRequestBody.md create mode 100644 docs/Model/RewardsUpdateRequestBodyAttributes.md create mode 100644 docs/Model/RewardsUpdateRequestBodyParameters.md create mode 100644 docs/Model/RewardsUpdateRequestBodyParametersCampaign.md create mode 100644 docs/Model/RewardsUpdateRequestBodyParametersCoin.md create mode 100644 docs/Model/RewardsUpdateRequestBodyParametersProduct.md create mode 100644 docs/Model/RewardsUpdateResponseBody.md create mode 100644 docs/Model/RewardsUpdateResponseBodyAttributes.md create mode 100644 docs/Model/SegmentsCreateRequestBody.md create mode 100644 docs/Model/SegmentsCreateResponseBody.md create mode 100644 docs/Model/SegmentsGetResponseBody.md create mode 100644 docs/Model/Session.md create mode 100644 docs/Model/SimpleCustomer.md create mode 100644 docs/Model/SimpleCustomerRequiredObjectType.md create mode 100644 docs/Model/SimpleLoyaltyCard.md create mode 100644 docs/Model/SimpleProductDiscountUnit.md create mode 100644 docs/Model/SimpleSegment.md create mode 100644 docs/Model/SimpleSkuDiscountUnit.md create mode 100644 docs/Model/SimpleVoucher.md create mode 100644 docs/Model/SimpleVoucherLoyaltyCard.md create mode 100644 docs/Model/SimpleVoucherRedemption.md create mode 100644 docs/Model/Sku.md create mode 100644 docs/Model/SkusGetResponseBody.md create mode 100644 docs/Model/SkusImportCsvCreateResponseBody.md create mode 100644 docs/Model/SkusListForProduct.md create mode 100644 docs/Model/StackingRules.md create mode 100644 docs/Model/ValidationRule.md create mode 100644 docs/Model/ValidationRuleApplicableTo.md create mode 100644 docs/Model/ValidationRuleAssignment.md create mode 100644 docs/Model/ValidationRuleAssignmentsList.md create mode 100644 docs/Model/ValidationRuleError.md create mode 100644 docs/Model/ValidationRulesAssignmentsCreateRequestBody.md create mode 100644 docs/Model/ValidationRulesAssignmentsCreateResponseBody.md create mode 100644 docs/Model/ValidationRulesAssignmentsList.md create mode 100644 docs/Model/ValidationRulesAssignmentsListResponseBody.md create mode 100644 docs/Model/ValidationRulesCreateRequestBody.md create mode 100644 docs/Model/ValidationRulesCreateRequestBodyApplicableTo.md create mode 100644 docs/Model/ValidationRulesCreateRequestBodyError.md create mode 100644 docs/Model/ValidationRulesCreateResponseBody.md create mode 100644 docs/Model/ValidationRulesCreateResponseBodyApplicableTo.md create mode 100644 docs/Model/ValidationRulesCreateResponseBodyError.md create mode 100644 docs/Model/ValidationRulesGetResponseBody.md create mode 100644 docs/Model/ValidationRulesGetResponseBodyApplicableTo.md create mode 100644 docs/Model/ValidationRulesGetResponseBodyError.md create mode 100644 docs/Model/ValidationRulesListResponseBody.md create mode 100644 docs/Model/ValidationRulesUpdateRequestBody.md create mode 100644 docs/Model/ValidationRulesUpdateRequestBodyApplicableTo.md create mode 100644 docs/Model/ValidationRulesUpdateRequestBodyError.md create mode 100644 docs/Model/ValidationRulesUpdateResponseBody.md create mode 100644 docs/Model/ValidationRulesUpdateResponseBodyApplicableTo.md create mode 100644 docs/Model/ValidationRulesUpdateResponseBodyError.md create mode 100644 docs/Model/ValidationsRedeemableInapplicable.md create mode 100644 docs/Model/ValidationsRedeemableInapplicableResult.md create mode 100644 docs/Model/ValidationsRedeemableInapplicableResultDetails.md create mode 100644 docs/Model/ValidationsRedeemableSkipped.md create mode 100644 docs/Model/ValidationsRedeemableSkippedResult.md create mode 100644 docs/Model/ValidationsRedeemableSkippedResultDetails.md create mode 100644 docs/Model/ValidationsValidateRequestBody.md create mode 100644 docs/Model/ValidationsValidateRequestBodyOptions.md create mode 100644 docs/Model/ValidationsValidateRequestBodyRedeemablesItem.md create mode 100644 docs/Model/ValidationsValidateRequestBodyRedeemablesItemGift.md create mode 100644 docs/Model/ValidationsValidateRequestBodyRedeemablesItemReward.md create mode 100644 docs/Model/ValidationsValidateResponseBody.md create mode 100644 docs/Model/ValidationsValidateResponseBodyRedeemablesItem.md create mode 100644 docs/Model/ValidationsValidateResponseBodyRedeemablesItemResult.md create mode 100644 docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md create mode 100644 docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md create mode 100644 docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md create mode 100644 docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultGift.md create mode 100644 docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md create mode 100644 docs/Model/ValidityHours.md create mode 100644 docs/Model/ValidityHoursDailyItem.md create mode 100644 docs/Model/ValidityTimeframe.md create mode 100644 docs/Model/Voucher.md create mode 100644 docs/Model/VoucherAssets.md create mode 100644 docs/Model/VoucherAssetsBarcode.md create mode 100644 docs/Model/VoucherAssetsQr.md create mode 100644 docs/Model/VoucherGift.md create mode 100644 docs/Model/VoucherLoyaltyCard.md create mode 100644 docs/Model/VoucherPublish.md create mode 100644 docs/Model/VoucherRedemption.md create mode 100644 docs/Model/VoucherTransaction.md create mode 100644 docs/Model/VoucherTransactionDetails.md create mode 100644 docs/Model/VoucherTransactionDetailsBalance.md create mode 100644 docs/Model/VoucherTransactionDetailsBalanceRelatedObject.md create mode 100644 docs/Model/VoucherTransactionDetailsCustomEvent.md create mode 100644 docs/Model/VoucherTransactionDetailsEarningRule.md create mode 100644 docs/Model/VoucherTransactionDetailsEarningRuleSource.md create mode 100644 docs/Model/VoucherTransactionDetailsEvent.md create mode 100644 docs/Model/VoucherTransactionDetailsEventSchema.md create mode 100644 docs/Model/VoucherTransactionDetailsLoyaltyTier.md create mode 100644 docs/Model/VoucherTransactionDetailsOrder.md create mode 100644 docs/Model/VoucherTransactionDetailsRedemption.md create mode 100644 docs/Model/VoucherTransactionDetailsReward.md create mode 100644 docs/Model/VoucherTransactionDetailsRollback.md create mode 100644 docs/Model/VoucherTransactionDetailsSegment.md create mode 100644 docs/Model/VoucherTransactionsExportFilterConditions.md create mode 100644 docs/Model/VoucherTransactionsExportFilterConditionsVoucherId.md create mode 100644 docs/Model/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md create mode 100644 docs/Model/VoucherTransactionsExportParameters.md create mode 100644 docs/Model/VoucherTransactionsFilters.md create mode 100644 docs/Model/VoucherWithCategories.md create mode 100644 docs/Model/VoucherWithCategoriesGift.md create mode 100644 docs/Model/VoucherWithCategoriesLoyaltyCard.md create mode 100644 docs/Model/VoucherWithCategoriesPublish.md create mode 100644 docs/Model/VoucherWithCategoriesRedemption.md create mode 100644 docs/Model/VouchersBalanceUpdateRequestBody.md create mode 100644 docs/Model/VouchersBalanceUpdateResponseBody.md create mode 100644 docs/Model/VouchersBalanceUpdateResponseBodyRelatedObject.md create mode 100644 docs/Model/VouchersCreateResponseBody.md create mode 100644 docs/Model/VouchersCreateResponseBodyGift.md create mode 100644 docs/Model/VouchersCreateResponseBodyLoyaltyCard.md create mode 100644 docs/Model/VouchersCreateResponseBodyPublish.md create mode 100644 docs/Model/VouchersCreateResponseBodyRedemption.md create mode 100644 docs/Model/VouchersCreateWithSpecificCodeRequestBody.md create mode 100644 docs/Model/VouchersCreateWithSpecificCodeRequestBodyRedemption.md create mode 100644 docs/Model/VouchersDisableResponseBody.md create mode 100644 docs/Model/VouchersDisableResponseBodyGift.md create mode 100644 docs/Model/VouchersDisableResponseBodyLoyaltyCard.md create mode 100644 docs/Model/VouchersDisableResponseBodyPublish.md create mode 100644 docs/Model/VouchersDisableResponseBodyRedemption.md create mode 100644 docs/Model/VouchersEnableResponseBody.md create mode 100644 docs/Model/VouchersEnableResponseBodyGift.md create mode 100644 docs/Model/VouchersEnableResponseBodyLoyaltyCard.md create mode 100644 docs/Model/VouchersEnableResponseBodyPublish.md create mode 100644 docs/Model/VouchersEnableResponseBodyRedemption.md create mode 100644 docs/Model/VouchersGetResponseBody.md create mode 100644 docs/Model/VouchersGetResponseBodyGift.md create mode 100644 docs/Model/VouchersGetResponseBodyLoyaltyCard.md create mode 100644 docs/Model/VouchersGetResponseBodyPublish.md create mode 100644 docs/Model/VouchersGetResponseBodyRedemption.md create mode 100644 docs/Model/VouchersImportCreateItemRequestBody.md create mode 100644 docs/Model/VouchersImportCreateItemRequestBodyRedemption.md create mode 100644 docs/Model/VouchersImportCreateResponseBody.md create mode 100644 docs/Model/VouchersImportCsvCreateResponseBody.md create mode 100644 docs/Model/VouchersListResponseBody.md create mode 100644 docs/Model/VouchersMetadataUpdateInBulkRequestBody.md create mode 100644 docs/Model/VouchersMetadataUpdateInBulkResponseBody.md create mode 100644 docs/Model/VouchersRedemptionGetResponseBody.md create mode 100644 docs/Model/VouchersTransactionsExportCreateRequestBody.md create mode 100644 docs/Model/VouchersTransactionsExportCreateResponseBody.md create mode 100644 docs/Model/VouchersTransactionsExportCreateResponseBodyResult.md create mode 100644 docs/Model/VouchersTransactionsListResponseBody.md create mode 100644 docs/Model/VouchersUpdateInBulkItemRequestBody.md create mode 100644 docs/Model/VouchersUpdateInBulkResponseBody.md create mode 100644 docs/Model/VouchersUpdateRequestBody.md create mode 100644 docs/Model/VouchersUpdateResponseBody.md create mode 100644 docs/Model/VouchersUpdateResponseBodyGift.md create mode 100644 docs/Model/VouchersUpdateResponseBodyLoyaltyCard.md create mode 100644 docs/Model/VouchersUpdateResponseBodyPublish.md create mode 100644 docs/Model/VouchersUpdateResponseBodyRedemption.md delete mode 100644 phpunit.xml create mode 100644 phpunit.xml.dist create mode 100644 src/Api/AsyncActionsApi.php create mode 100644 src/Api/CampaignsApi.php create mode 100644 src/Api/CategoriesApi.php create mode 100644 src/Api/ClientSideApi.php create mode 100644 src/Api/CustomersApi.php create mode 100644 src/Api/EventsApi.php create mode 100644 src/Api/ExportsApi.php create mode 100644 src/Api/LoyaltiesApi.php create mode 100644 src/Api/OrdersApi.php create mode 100644 src/Api/ProductCollectionsApi.php create mode 100644 src/Api/ProductsApi.php create mode 100644 src/Api/PromotionsApi.php create mode 100644 src/Api/PublicationsApi.php create mode 100644 src/Api/QualificationsApi.php create mode 100644 src/Api/RedemptionsApi.php create mode 100644 src/Api/RewardsApi.php create mode 100644 src/Api/SegmentsApi.php create mode 100644 src/Api/ValidationRulesApi.php create mode 100644 src/Api/ValidationsApi.php create mode 100644 src/Api/VouchersApi.php delete mode 100644 src/ApiClient.php create mode 100644 src/ApiException.php delete mode 100644 src/AsyncActions.php delete mode 100644 src/Campaigns.php delete mode 100644 src/ClientException.php create mode 100644 src/Configuration.php delete mode 100644 src/CustomEvents.php delete mode 100644 src/CustomerBuilder.php delete mode 100644 src/Customers.php delete mode 100644 src/Distributions.php create mode 100644 src/HeaderSelector.php create mode 100644 src/Model/AccessSettingsCampaignAssignmentsList.php create mode 100644 src/Model/ApplicableTo.php create mode 100644 src/Model/ApplicableToResultList.php create mode 100644 src/Model/AreaStoreCampaignAssignment.php create mode 100644 src/Model/AsyncActionBase.php create mode 100644 src/Model/AsyncActionGetResponseBody.php create mode 100644 src/Model/AsyncActionsListResponseBody.php create mode 100644 src/Model/BusValRuleAssignment.php create mode 100644 src/Model/CampaignBase.php create mode 100644 src/Model/CampaignLoyaltyCard.php create mode 100644 src/Model/CampaignLoyaltyCardExpirationRules.php create mode 100644 src/Model/CampaignLoyaltyVoucher.php create mode 100644 src/Model/CampaignLoyaltyVoucherRedemption.php create mode 100644 src/Model/CampaignVoucher.php create mode 100644 src/Model/CampaignVoucherRedemption.php create mode 100644 src/Model/CampaignsCreateRequestBody.php create mode 100644 src/Model/CampaignsCreateRequestBodyPromotion.php create mode 100644 src/Model/CampaignsCreateRequestBodyVoucher.php create mode 100644 src/Model/CampaignsCreateRequestBodyVoucherRedemption.php create mode 100644 src/Model/CampaignsCreateResponseBody.php create mode 100644 src/Model/CampaignsDeleteResponseBody.php create mode 100644 src/Model/CampaignsGetResponseBody.php create mode 100644 src/Model/CampaignsImportCreateResponseBody.php create mode 100644 src/Model/CampaignsImportCsvCreateResponseBody.php create mode 100644 src/Model/CampaignsImportVoucherItem.php create mode 100644 src/Model/CampaignsImportVoucherItemRedemption.php create mode 100644 src/Model/CampaignsListResponseBody.php create mode 100644 src/Model/CampaignsUpdateRequestBody.php create mode 100644 src/Model/CampaignsUpdateRequestBodyOptions.php create mode 100644 src/Model/CampaignsUpdateResponseBody.php create mode 100644 src/Model/CampaignsVouchersCreateCombinedResponseBody.php create mode 100644 src/Model/CampaignsVouchersCreateCombinedResponseBodyGift.php create mode 100644 src/Model/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.php create mode 100644 src/Model/CampaignsVouchersCreateCombinedResponseBodyPublish.php create mode 100644 src/Model/CampaignsVouchersCreateCombinedResponseBodyRedemption.php create mode 100644 src/Model/CampaignsVouchersCreateInBulkRequestBody.php create mode 100644 src/Model/CampaignsVouchersCreateInBulkRequestBodyRedemption.php create mode 100644 src/Model/CampaignsVouchersCreateRequestBody.php create mode 100644 src/Model/CampaignsVouchersCreateRequestBodyRedemption.php create mode 100644 src/Model/CampaignsVouchersCreateResponseBody.php create mode 100644 src/Model/CampaignsVouchersCreateResponseBodyGift.php create mode 100644 src/Model/CampaignsVouchersCreateResponseBodyLoyaltyCard.php create mode 100644 src/Model/CampaignsVouchersCreateResponseBodyPublish.php create mode 100644 src/Model/CampaignsVouchersCreateResponseBodyRedemption.php create mode 100644 src/Model/CategoriesCreateRequestBody.php create mode 100644 src/Model/CategoriesCreateResponseBody.php create mode 100644 src/Model/CategoriesGetResponseBody.php create mode 100644 src/Model/CategoriesListResponseBody.php create mode 100644 src/Model/CategoriesUpdateRequestBody.php create mode 100644 src/Model/CategoriesUpdateResponseBody.php create mode 100644 src/Model/Category.php create mode 100644 src/Model/ClientEventsCreateRequestBody.php create mode 100644 src/Model/ClientEventsCreateRequestBodyLoyalty.php create mode 100644 src/Model/ClientEventsCreateRequestBodyReferral.php create mode 100644 src/Model/ClientEventsCreateResponseBody.php create mode 100644 src/Model/ClientPromotionsTiersListResponseBody.php create mode 100644 src/Model/ClientQualificationsCheckEligibilityRequestBody.php create mode 100644 src/Model/ClientQualificationsCheckEligibilityResponseBody.php create mode 100644 src/Model/ClientRedemptionsRedeemRequestBody.php create mode 100644 src/Model/ClientRedemptionsRedeemRequestBodyOptions.php create mode 100644 src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItem.php create mode 100644 src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.php create mode 100644 src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.php create mode 100644 src/Model/ClientRedemptionsRedeemResponseBody.php create mode 100644 src/Model/ClientValidationsValidateRequestBody.php create mode 100644 src/Model/ClientValidationsValidateRequestBodyOptions.php create mode 100644 src/Model/ClientValidationsValidateRequestBodyRedeemablesItem.php create mode 100644 src/Model/ClientValidationsValidateRequestBodyRedeemablesItemGift.php create mode 100644 src/Model/ClientValidationsValidateRequestBodyRedeemablesItemReward.php create mode 100644 src/Model/ClientValidationsValidateResponseBody.php create mode 100644 src/Model/ClientValidationsValidateResponseBodyRedeemablesItem.php create mode 100644 src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResult.php create mode 100644 src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.php create mode 100644 src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.php create mode 100644 src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.php create mode 100644 src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.php create mode 100644 src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.php create mode 100644 src/Model/CodeConfig.php create mode 100644 src/Model/CreatePublicationCampaign.php create mode 100644 src/Model/Customer.php create mode 100644 src/Model/CustomerActivity.php create mode 100644 src/Model/CustomerAddress.php create mode 100644 src/Model/CustomerId.php create mode 100644 src/Model/CustomerLoyalty.php create mode 100644 src/Model/CustomerLoyaltyCampaignsEntry.php create mode 100644 src/Model/CustomerRedeemable.php create mode 100644 src/Model/CustomerRedeemableRedeemable.php create mode 100644 src/Model/CustomerReferrals.php create mode 100644 src/Model/CustomerReferralsCampaignsItem.php create mode 100644 src/Model/CustomerSummary.php create mode 100644 src/Model/CustomerSummaryOrders.php create mode 100644 src/Model/CustomerSummaryRedemptions.php create mode 100644 src/Model/CustomerSummaryRedemptionsGift.php create mode 100644 src/Model/CustomerSummaryRedemptionsLoyaltyCard.php create mode 100644 src/Model/CustomerWithSummaryLoyaltyReferrals.php create mode 100644 src/Model/CustomerWithSummaryLoyaltyReferralsAddress.php create mode 100644 src/Model/CustomerWithSummaryLoyaltyReferralsAssets.php create mode 100644 src/Model/CustomersActivityListResponseBody.php create mode 100644 src/Model/CustomersCreateRequestBody.php create mode 100644 src/Model/CustomersCreateRequestBodyAddress.php create mode 100644 src/Model/CustomersCreateResponseBody.php create mode 100644 src/Model/CustomersCreateResponseBodyAddress.php create mode 100644 src/Model/CustomersCreateResponseBodyAssets.php create mode 100644 src/Model/CustomersGetResponseBody.php create mode 100644 src/Model/CustomersGetResponseBodyAddress.php create mode 100644 src/Model/CustomersGetResponseBodyAssets.php create mode 100644 src/Model/CustomersImportCsvCreateResponseBody.php create mode 100644 src/Model/CustomersListResponseBody.php create mode 100644 src/Model/CustomersMetadataUpdateInBulkRequestBody.php create mode 100644 src/Model/CustomersMetadataUpdateInBulkResponseBody.php create mode 100644 src/Model/CustomersPermanentDeletionCreateResponseBody.php create mode 100644 src/Model/CustomersPermanentDeletionCreateResponseBodyDataJson.php create mode 100644 src/Model/CustomersRedeemablesListResponseBody.php create mode 100644 src/Model/CustomersSegmentsListResponseBody.php create mode 100644 src/Model/CustomersUpdateInBulkRequestBody.php create mode 100644 src/Model/CustomersUpdateInBulkRequestBodyAddress.php create mode 100644 src/Model/CustomersUpdateInBulkResponseBody.php create mode 100644 src/Model/CustomersUpdateRequestBody.php create mode 100644 src/Model/CustomersUpdateRequestBodyAddress.php create mode 100644 src/Model/CustomersUpdateResponseBody.php create mode 100644 src/Model/CustomersUpdateResponseBodyAddress.php create mode 100644 src/Model/CustomersUpdateResponseBodyAssets.php create mode 100644 src/Model/Discount.php create mode 100644 src/Model/DiscountUnitMultipleOneUnit.php create mode 100644 src/Model/EarningRule.php create mode 100644 src/Model/EarningRuleCustomEvent.php create mode 100644 src/Model/EarningRuleLoyalty.php create mode 100644 src/Model/EarningRuleLoyaltyCustomEvent.php create mode 100644 src/Model/EarningRuleLoyaltyCustomEventMetadata.php create mode 100644 src/Model/EarningRuleLoyaltyCustomer.php create mode 100644 src/Model/EarningRuleLoyaltyCustomerMetadata.php create mode 100644 src/Model/EarningRuleLoyaltyOrder.php create mode 100644 src/Model/EarningRuleLoyaltyOrderAmount.php create mode 100644 src/Model/EarningRuleLoyaltyOrderItems.php create mode 100644 src/Model/EarningRuleLoyaltyOrderItemsAmount.php create mode 100644 src/Model/EarningRuleLoyaltyOrderItemsQuantity.php create mode 100644 src/Model/EarningRuleLoyaltyOrderItemsSubtotalAmount.php create mode 100644 src/Model/EarningRuleLoyaltyOrderMetadata.php create mode 100644 src/Model/EarningRuleLoyaltyOrderTotalAmount.php create mode 100644 src/Model/EarningRuleLoyaltyTier.php create mode 100644 src/Model/EarningRuleSegment.php create mode 100644 src/Model/EarningRuleSource.php create mode 100644 src/Model/Error.php create mode 100644 src/Model/EventsCreateRequestBody.php create mode 100644 src/Model/EventsCreateRequestBodyLoyalty.php create mode 100644 src/Model/EventsCreateRequestBodyReferral.php create mode 100644 src/Model/EventsCreateResponseBody.php create mode 100644 src/Model/Export.php create mode 100644 src/Model/ExportParameters.php create mode 100644 src/Model/ExportParametersFilters.php create mode 100644 src/Model/ExportResult.php create mode 100644 src/Model/ExportVoucherTransactionsFilters.php create mode 100644 src/Model/ExportsCreateRequestBody.php create mode 100644 src/Model/ExportsCreateRequestBodyParameters.php create mode 100644 src/Model/ExportsCreateRequestBodyParametersFilters.php create mode 100644 src/Model/ExportsCreateResponseBody.php create mode 100644 src/Model/ExportsCreateResponseBodyParameters.php create mode 100644 src/Model/ExportsCreateResponseBodyParametersFilters.php create mode 100644 src/Model/ExportsGetResponseBody.php create mode 100644 src/Model/ExportsGetResponseBodyParameters.php create mode 100644 src/Model/ExportsGetResponseBodyParametersFilters.php create mode 100644 src/Model/ExportsGetResponseBodyResult.php create mode 100644 src/Model/ExportsListResponseBody.php create mode 100644 src/Model/FieldConditions.php create mode 100644 src/Model/FilterConditionsString.php create mode 100644 src/Model/FiltersCondition.php create mode 100644 src/Model/Gift.php create mode 100644 src/Model/InapplicableTo.php create mode 100644 src/Model/InapplicableToResultList.php create mode 100644 src/Model/ListPublicationsItemVoucher.php create mode 100644 src/Model/LoyaltiesCreateCampaignRequestBody.php create mode 100644 src/Model/LoyaltiesCreateCampaignResponseBody.php create mode 100644 src/Model/LoyaltiesDeleteResponseBody.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItem.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemSegment.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateRequestBodyItemSource.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBody.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyalty.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodySegment.php create mode 100644 src/Model/LoyaltiesEarningRulesCreateResponseBodySource.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBody.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyalty.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodySegment.php create mode 100644 src/Model/LoyaltiesEarningRulesDisableResponseBodySource.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBody.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyalty.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodySegment.php create mode 100644 src/Model/LoyaltiesEarningRulesEnableResponseBodySource.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBody.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyalty.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodySegment.php create mode 100644 src/Model/LoyaltiesEarningRulesGetResponseBodySource.php create mode 100644 src/Model/LoyaltiesEarningRulesListResponseBody.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBody.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateRequestBodySource.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBody.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodySegment.php create mode 100644 src/Model/LoyaltiesEarningRulesUpdateResponseBodySource.php create mode 100644 src/Model/LoyaltiesGetCampaignResponseBody.php create mode 100644 src/Model/LoyaltiesListCampaignsResponseBody.php create mode 100644 src/Model/LoyaltiesListMembersResponseBody.php create mode 100644 src/Model/LoyaltiesLoyaltyTierReward.php create mode 100644 src/Model/LoyaltiesMemberActivityListResponseBody.php create mode 100644 src/Model/LoyaltiesMembersBalanceUpdateRequestBody.php create mode 100644 src/Model/LoyaltiesMembersBalanceUpdateResponseBody.php create mode 100644 src/Model/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.php create mode 100644 src/Model/LoyaltiesMembersCreateRequestBody.php create mode 100644 src/Model/LoyaltiesMembersCreateResponseBody.php create mode 100644 src/Model/LoyaltiesMembersCreateResponseBodyLoyaltyCard.php create mode 100644 src/Model/LoyaltiesMembersCreateResponseBodyPublish.php create mode 100644 src/Model/LoyaltiesMembersCreateResponseBodyRedemption.php create mode 100644 src/Model/LoyaltiesMembersGetResponseBody.php create mode 100644 src/Model/LoyaltiesMembersGetResponseBodyLoyaltyCard.php create mode 100644 src/Model/LoyaltiesMembersGetResponseBodyPublish.php create mode 100644 src/Model/LoyaltiesMembersGetResponseBodyRedemption.php create mode 100644 src/Model/LoyaltiesMembersPointsExpirationListResponseBody.php create mode 100644 src/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.php create mode 100644 src/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemRequestBody.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemRequestBodyReward.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBody.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyGift.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.php create mode 100644 src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.php create mode 100644 src/Model/LoyaltiesMembersRewardsListResponseBody.php create mode 100644 src/Model/LoyaltiesMembersRewardsListResponseBodyDataItem.php create mode 100644 src/Model/LoyaltiesMembersTiersListResponseBody.php create mode 100644 src/Model/LoyaltiesMembersTransactionsExportCreateRequestBody.php create mode 100644 src/Model/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.php create mode 100644 src/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.php create mode 100644 src/Model/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.php create mode 100644 src/Model/LoyaltiesMembersTransactionsListResponseBody.php create mode 100644 src/Model/LoyaltiesMembersTransfersCreateResponseBody.php create mode 100644 src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssets.php create mode 100644 src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.php create mode 100644 src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.php create mode 100644 src/Model/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.php create mode 100644 src/Model/LoyaltiesMembersTransfersCreateResponseBodyPublish.php create mode 100644 src/Model/LoyaltiesMembersTransfersCreateResponseBodyRedemption.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateRequestBody.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateResponseBody.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.php create mode 100644 src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.php create mode 100644 src/Model/LoyaltiesRewardAssignmentsGetResponseBody.php create mode 100644 src/Model/LoyaltiesRewardAssignmentsGetResponseBodyParameters.php create mode 100644 src/Model/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.php create mode 100644 src/Model/LoyaltiesRewardAssignmentsListResponseBody.php create mode 100644 src/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.php create mode 100644 src/Model/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.php create mode 100644 src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBody.php create mode 100644 src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.php create mode 100644 src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.php create mode 100644 src/Model/LoyaltiesRewardsCreateAssignmentResponseBody.php create mode 100644 src/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.php create mode 100644 src/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.php create mode 100644 src/Model/LoyaltiesRewardsGetResponseBody.php create mode 100644 src/Model/LoyaltiesRewardsGetResponseBodyParameters.php create mode 100644 src/Model/LoyaltiesRewardsGetResponseBodyParametersLoyalty.php create mode 100644 src/Model/LoyaltiesRewardsListAssignmentsResponseBody.php create mode 100644 src/Model/LoyaltiesRewardsUpdateAssignmentRequestBody.php create mode 100644 src/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.php create mode 100644 src/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.php create mode 100644 src/Model/LoyaltiesRewardsUpdateAssignmentResponseBody.php create mode 100644 src/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.php create mode 100644 src/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.php create mode 100644 src/Model/LoyaltiesTiersCreateInBulkRequestBodyItem.php create mode 100644 src/Model/LoyaltiesTiersEarningRulesListResponseBody.php create mode 100644 src/Model/LoyaltiesTiersGetResponseBody.php create mode 100644 src/Model/LoyaltiesTiersGetResponseBodyConfig.php create mode 100644 src/Model/LoyaltiesTiersGetResponseBodyConfigPoints.php create mode 100644 src/Model/LoyaltiesTiersGetResponseBodyPoints.php create mode 100644 src/Model/LoyaltiesTiersListResponseBody.php create mode 100644 src/Model/LoyaltiesTiersRewardsListResponseBody.php create mode 100644 src/Model/LoyaltiesTransferPoints.php create mode 100644 src/Model/LoyaltiesUpdateCampaignRequestBody.php create mode 100644 src/Model/LoyaltiesUpdateCampaignRequestBodyOptions.php create mode 100644 src/Model/LoyaltiesUpdateCampaignResponseBody.php create mode 100644 src/Model/LoyaltyCampaign.php create mode 100644 src/Model/LoyaltyCampaignVoucher.php create mode 100644 src/Model/LoyaltyCampaignVoucherRedemption.php create mode 100644 src/Model/LoyaltyCardTransaction.php create mode 100644 src/Model/LoyaltyCardTransactionDetails.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsBalance.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsBalanceRelatedObject.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsCustomEvent.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsEarningRule.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsEarningRuleSource.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsEvent.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsEventSchema.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsLoyaltyTier.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsOrder.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsRedemption.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsReward.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsRollback.php create mode 100644 src/Model/LoyaltyCardTransactionDetailsSegment.php create mode 100644 src/Model/LoyaltyMember.php create mode 100644 src/Model/LoyaltyMemberLoyaltyCard.php create mode 100644 src/Model/LoyaltyMemberPublish.php create mode 100644 src/Model/LoyaltyMemberRedemption.php create mode 100644 src/Model/LoyaltyTier.php create mode 100644 src/Model/LoyaltyTierBase.php create mode 100644 src/Model/LoyaltyTierBasePoints.php create mode 100644 src/Model/LoyaltyTierConfig.php create mode 100644 src/Model/LoyaltyTierConfigPoints.php create mode 100644 src/Model/LoyaltyTierExpiration.php create mode 100644 src/Model/LoyaltyTierPoints.php create mode 100644 src/Model/LoyaltyTiersExpirationAll.php create mode 100644 src/Model/LoyaltyTiersExpirationAllExpirationDate.php create mode 100644 src/Model/LoyaltyTiersExpirationAllExpirationDateRounding.php create mode 100644 src/Model/LoyaltyTiersExpirationAllStartDate.php create mode 100644 src/Model/LuckyDraw.php create mode 100644 src/Model/MappingPoints.php create mode 100644 src/Model/MemberActivity.php create mode 100644 src/Model/ModelInterface.php create mode 100644 src/Model/Order.php create mode 100644 src/Model/OrderCalculated.php create mode 100644 src/Model/OrderCalculatedItem.php create mode 100644 src/Model/OrderCalculatedItemProduct.php create mode 100644 src/Model/OrderCalculatedItemSku.php create mode 100644 src/Model/OrderItem.php create mode 100644 src/Model/OrderItemProduct.php create mode 100644 src/Model/OrderItemSku.php create mode 100644 src/Model/OrderRedemptionsEntry.php create mode 100644 src/Model/OrdersCreateRequestBody.php create mode 100644 src/Model/OrdersCreateResponseBody.php create mode 100644 src/Model/OrdersExportCreateRequestBody.php create mode 100644 src/Model/OrdersExportCreateRequestBodyParameters.php create mode 100644 src/Model/OrdersExportCreateResponseBody.php create mode 100644 src/Model/OrdersExportCreateResponseBodyParameters.php create mode 100644 src/Model/OrdersGetResponseBody.php create mode 100644 src/Model/OrdersImportCreateRequestBodyItem.php create mode 100644 src/Model/OrdersImportCreateResponseBody.php create mode 100644 src/Model/OrdersListResponseBody.php create mode 100644 src/Model/OrdersUpdateRequestBody.php create mode 100644 src/Model/OrdersUpdateResponseBody.php create mode 100644 src/Model/ParameterActivityCategory.php create mode 100644 src/Model/ParameterCampaignType.php create mode 100644 src/Model/ParameterCreatedBeforeAfter.php create mode 100644 src/Model/ParameterExpandListCampaigns.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemables.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesCampaignId.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesCampaignType.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesCreatedAt.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesHolderRole.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesId.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesRedeemableId.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesRedeemableObject.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesVoucherType.php create mode 100644 src/Model/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.php create mode 100644 src/Model/ParameterFiltersListRedemptions.php create mode 100644 src/Model/ParameterFiltersListRedemptionsCampaignName.php create mode 100644 src/Model/ParameterFiltersListRedemptionsCustomerId.php create mode 100644 src/Model/ParameterFiltersListRedemptionsFailureCode.php create mode 100644 src/Model/ParameterFiltersListRedemptionsObject.php create mode 100644 src/Model/ParameterFiltersListRedemptionsParentRedemptionId.php create mode 100644 src/Model/ParameterFiltersListRedemptionsRelatedObjectId.php create mode 100644 src/Model/ParameterFiltersListRedemptionsRelatedObjectParentId.php create mode 100644 src/Model/ParameterFiltersListRedemptionsResult.php create mode 100644 src/Model/ParameterFiltersListRedemptionsUserLogin.php create mode 100644 src/Model/ParameterFiltersListRedemptionsVoucherCode.php create mode 100644 src/Model/ParameterOrder.php create mode 100644 src/Model/ParameterOrderCreatedAt.php create mode 100644 src/Model/ParameterOrderListAllPromotionStacks.php create mode 100644 src/Model/ParameterOrderListCampaigns.php create mode 100644 src/Model/ParameterOrderListCustomers.php create mode 100644 src/Model/ParameterOrderListEarningRules.php create mode 100644 src/Model/ParameterOrderListExports.php create mode 100644 src/Model/ParameterOrderListLoyaltyTiers.php create mode 100644 src/Model/ParameterOrderListOrders.php create mode 100644 src/Model/ParameterOrderListPromotionTiers.php create mode 100644 src/Model/ParameterOrderListPromotionTiersClientSide.php create mode 100644 src/Model/ParameterOrderListPublications.php create mode 100644 src/Model/ParameterOrderListRedeemables.php create mode 100644 src/Model/ParameterOrderListRedemptions.php create mode 100644 src/Model/ParameterOrderListValidationRuleAssignments.php create mode 100644 src/Model/ParameterOrderListValidationRules.php create mode 100644 src/Model/ParameterOrderVouchers.php create mode 100644 src/Model/ParameterResultListPublications.php create mode 100644 src/Model/ParameterUpdatedBeforeAfter.php create mode 100644 src/Model/ParameterVoucherTypeListPublications.php create mode 100644 src/Model/Product.php create mode 100644 src/Model/ProductCollectionsCreateRequestBody.php create mode 100644 src/Model/ProductCollectionsCreateRequestBodyFilter.php create mode 100644 src/Model/ProductCollectionsCreateRequestBodyProductsItem.php create mode 100644 src/Model/ProductCollectionsCreateResponseBody.php create mode 100644 src/Model/ProductCollectionsCreateResponseBodyFilter.php create mode 100644 src/Model/ProductCollectionsCreateResponseBodyProductsItem.php create mode 100644 src/Model/ProductCollectionsGetResponseBody.php create mode 100644 src/Model/ProductCollectionsGetResponseBodyFilter.php create mode 100644 src/Model/ProductCollectionsGetResponseBodyProductsItem.php create mode 100644 src/Model/ProductCollectionsItem.php create mode 100644 src/Model/ProductCollectionsItemFilter.php create mode 100644 src/Model/ProductCollectionsItemProductsItem.php create mode 100644 src/Model/ProductCollectionsListResponseBody.php create mode 100644 src/Model/ProductCollectionsProductsListResponseBody.php create mode 100644 src/Model/ProductCollectionsProductsListResponseBodyDataItem.php create mode 100644 src/Model/ProductWithoutSkus.php create mode 100644 src/Model/ProductsCreateRequestBody.php create mode 100644 src/Model/ProductsCreateResponseBody.php create mode 100644 src/Model/ProductsGetResponseBody.php create mode 100644 src/Model/ProductsImportCsvCreateResponseBody.php create mode 100644 src/Model/ProductsListResponseBody.php create mode 100644 src/Model/ProductsMetadataUpdateInBulkRequestBody.php create mode 100644 src/Model/ProductsMetadataUpdateInBulkResponseBody.php create mode 100644 src/Model/ProductsSkusCreateRequestBody.php create mode 100644 src/Model/ProductsSkusCreateResponseBody.php create mode 100644 src/Model/ProductsSkusListResponseBody.php create mode 100644 src/Model/ProductsSkusUpdateRequestBody.php create mode 100644 src/Model/ProductsSkusUpdateResponseBody.php create mode 100644 src/Model/ProductsUpdateInBulkRequestBody.php create mode 100644 src/Model/ProductsUpdateInBulkResponseBody.php create mode 100644 src/Model/ProductsUpdateRequestBody.php create mode 100644 src/Model/ProductsUpdateResponseBody.php create mode 100644 src/Model/PromotionStack.php create mode 100644 src/Model/PromotionStackBase.php create mode 100644 src/Model/PromotionStackBaseTiers.php create mode 100644 src/Model/PromotionStackTiers.php create mode 100644 src/Model/PromotionTier.php create mode 100644 src/Model/PromotionTierAction.php create mode 100644 src/Model/PromotionTierCampaign.php create mode 100644 src/Model/PromotionTierCreateParams.php create mode 100644 src/Model/PromotionTierCreateParamsAction.php create mode 100644 src/Model/PromotionTierSummary.php create mode 100644 src/Model/PromotionTierSummaryOrders.php create mode 100644 src/Model/PromotionTierSummaryRedemptions.php create mode 100644 src/Model/PromotionTiersList.php create mode 100644 src/Model/PromotionsStacksCreateRequestBody.php create mode 100644 src/Model/PromotionsStacksCreateRequestBodyTiers.php create mode 100644 src/Model/PromotionsStacksCreateResponseBody.php create mode 100644 src/Model/PromotionsStacksCreateResponseBodyTiers.php create mode 100644 src/Model/PromotionsStacksGetResponseBody.php create mode 100644 src/Model/PromotionsStacksGetResponseBodyTiers.php create mode 100644 src/Model/PromotionsStacksListResponseBody.php create mode 100644 src/Model/PromotionsStacksUpdateRequestBody.php create mode 100644 src/Model/PromotionsStacksUpdateRequestBodyTiers.php create mode 100644 src/Model/PromotionsStacksUpdateResponseBody.php create mode 100644 src/Model/PromotionsStacksUpdateResponseBodyTiers.php create mode 100644 src/Model/PromotionsTiersCreateRequestBody.php create mode 100644 src/Model/PromotionsTiersCreateRequestBodyAction.php create mode 100644 src/Model/PromotionsTiersCreateResponseBody.php create mode 100644 src/Model/PromotionsTiersCreateResponseBodyAction.php create mode 100644 src/Model/PromotionsTiersCreateResponseBodyCampaign.php create mode 100644 src/Model/PromotionsTiersCreateResponseBodySummary.php create mode 100644 src/Model/PromotionsTiersCreateResponseBodySummaryOrders.php create mode 100644 src/Model/PromotionsTiersCreateResponseBodySummaryRedemptions.php create mode 100644 src/Model/PromotionsTiersDisableResponseBody.php create mode 100644 src/Model/PromotionsTiersDisableResponseBodyAction.php create mode 100644 src/Model/PromotionsTiersDisableResponseBodyCampaign.php create mode 100644 src/Model/PromotionsTiersDisableResponseBodySummary.php create mode 100644 src/Model/PromotionsTiersDisableResponseBodySummaryOrders.php create mode 100644 src/Model/PromotionsTiersDisableResponseBodySummaryRedemptions.php create mode 100644 src/Model/PromotionsTiersEnableResponseBody.php create mode 100644 src/Model/PromotionsTiersEnableResponseBodyAction.php create mode 100644 src/Model/PromotionsTiersEnableResponseBodyCampaign.php create mode 100644 src/Model/PromotionsTiersEnableResponseBodySummary.php create mode 100644 src/Model/PromotionsTiersEnableResponseBodySummaryOrders.php create mode 100644 src/Model/PromotionsTiersEnableResponseBodySummaryRedemptions.php create mode 100644 src/Model/PromotionsTiersGetResponseBody.php create mode 100644 src/Model/PromotionsTiersGetResponseBodyAction.php create mode 100644 src/Model/PromotionsTiersGetResponseBodyCampaign.php create mode 100644 src/Model/PromotionsTiersGetResponseBodySummary.php create mode 100644 src/Model/PromotionsTiersGetResponseBodySummaryOrders.php create mode 100644 src/Model/PromotionsTiersGetResponseBodySummaryRedemptions.php create mode 100644 src/Model/PromotionsTiersListResponseBody.php create mode 100644 src/Model/PromotionsTiersUpdateRequestBody.php create mode 100644 src/Model/PromotionsTiersUpdateRequestBodyAction.php create mode 100644 src/Model/PromotionsTiersUpdateResponseBody.php create mode 100644 src/Model/PromotionsTiersUpdateResponseBodyAction.php create mode 100644 src/Model/PromotionsTiersUpdateResponseBodyCampaign.php create mode 100644 src/Model/PromotionsTiersUpdateResponseBodySummary.php create mode 100644 src/Model/PromotionsTiersUpdateResponseBodySummaryOrders.php create mode 100644 src/Model/PromotionsTiersUpdateResponseBodySummaryRedemptions.php create mode 100644 src/Model/PublicationsCreateRequestBody.php create mode 100644 src/Model/PublicationsCreateRequestBodyCustomer.php create mode 100644 src/Model/PublicationsCreateRequestBodyCustomerAddress.php create mode 100644 src/Model/PublicationsCreateResponseBody.php create mode 100644 src/Model/PublicationsListResponseBody.php create mode 100644 src/Model/PublicationsListResponseBodyPublicationsItem.php create mode 100644 src/Model/PublicationsListResponseBodyPublicationsItemMetadata.php create mode 100644 src/Model/QualificationsCheckEligibilityRequestBody.php create mode 100644 src/Model/QualificationsCheckEligibilityResponseBody.php create mode 100644 src/Model/QualificationsFieldConditions.php create mode 100644 src/Model/QualificationsFiltersCondition.php create mode 100644 src/Model/QualificationsOption.php create mode 100644 src/Model/QualificationsOptionFilters.php create mode 100644 src/Model/QualificationsOptionFiltersCampaignType.php create mode 100644 src/Model/QualificationsOptionFiltersCampaignTypeConditions.php create mode 100644 src/Model/QualificationsOptionFiltersHolderRole.php create mode 100644 src/Model/QualificationsOptionFiltersHolderRoleConditions.php create mode 100644 src/Model/QualificationsOptionFiltersResourceType.php create mode 100644 src/Model/QualificationsOptionFiltersResourceTypeConditions.php create mode 100644 src/Model/QualificationsRedeemable.php create mode 100644 src/Model/QualificationsRedeemableBase.php create mode 100644 src/Model/QualificationsRedeemables.php create mode 100644 src/Model/RedeemableGift.php create mode 100644 src/Model/RedeemableLoyaltyCard.php create mode 100644 src/Model/RedeemableResult.php create mode 100644 src/Model/RedeemableVoucher.php create mode 100644 src/Model/RedeemableVoucherGift.php create mode 100644 src/Model/RedeemableVoucherLoyaltyCard.php create mode 100644 src/Model/RedeemableVoucherPublish.php create mode 100644 src/Model/RedeemableVoucherRedemption.php create mode 100644 src/Model/Redemption.php create mode 100644 src/Model/RedemptionChannel.php create mode 100644 src/Model/RedemptionEntry.php create mode 100644 src/Model/RedemptionEntryChannel.php create mode 100644 src/Model/RedemptionEntryCustomer.php create mode 100644 src/Model/RedemptionEntryGift.php create mode 100644 src/Model/RedemptionEntryLoyaltyCard.php create mode 100644 src/Model/RedemptionEntryOrder.php create mode 100644 src/Model/RedemptionEntryOrderCustomer.php create mode 100644 src/Model/RedemptionEntryOrderReferrer.php create mode 100644 src/Model/RedemptionEntryPromotionTier.php create mode 100644 src/Model/RedemptionEntryPromotionTierAction.php create mode 100644 src/Model/RedemptionEntryPromotionTierCampaign.php create mode 100644 src/Model/RedemptionEntryPromotionTierSummary.php create mode 100644 src/Model/RedemptionEntryPromotionTierSummaryOrders.php create mode 100644 src/Model/RedemptionEntryPromotionTierSummaryRedemptions.php create mode 100644 src/Model/RedemptionEntryRelatedRedemptions.php create mode 100644 src/Model/RedemptionEntryRelatedRedemptionsRedemptionsItem.php create mode 100644 src/Model/RedemptionEntryRelatedRedemptionsRollbacksItem.php create mode 100644 src/Model/RedemptionEntryVoucher.php create mode 100644 src/Model/RedemptionEntryVoucherGift.php create mode 100644 src/Model/RedemptionEntryVoucherLoyaltyCard.php create mode 100644 src/Model/RedemptionEntryVoucherPublish.php create mode 100644 src/Model/RedemptionEntryVoucherRedemption.php create mode 100644 src/Model/RedemptionGift.php create mode 100644 src/Model/RedemptionLoyaltyCard.php create mode 100644 src/Model/RedemptionRelatedRedemptions.php create mode 100644 src/Model/RedemptionRelatedRedemptionsRedemptionsItem.php create mode 100644 src/Model/RedemptionRelatedRedemptionsRollbacksItem.php create mode 100644 src/Model/RedemptionRewardResult.php create mode 100644 src/Model/RedemptionRewardResultParameters.php create mode 100644 src/Model/RedemptionRewardResultParametersCampaign.php create mode 100644 src/Model/RedemptionRewardResultParametersCoin.php create mode 100644 src/Model/RedemptionRewardResultParametersProduct.php create mode 100644 src/Model/RedemptionRollback.php create mode 100644 src/Model/RedemptionRollbackChannel.php create mode 100644 src/Model/RedemptionRollbackGift.php create mode 100644 src/Model/RedemptionRollbackLoyaltyCard.php create mode 100644 src/Model/RedemptionRollbackRelatedRedemptions.php create mode 100644 src/Model/RedemptionRollbackRelatedRedemptionsRedemptionsItem.php create mode 100644 src/Model/RedemptionRollbackRelatedRedemptionsRollbacksItem.php create mode 100644 src/Model/RedemptionVoucher.php create mode 100644 src/Model/RedemptionVoucherGift.php create mode 100644 src/Model/RedemptionVoucherLoyaltyCard.php create mode 100644 src/Model/RedemptionVoucherPublish.php create mode 100644 src/Model/RedemptionVoucherRedemption.php create mode 100644 src/Model/RedemptionsGetResponseBody.php create mode 100644 src/Model/RedemptionsGetResponseBodyChannel.php create mode 100644 src/Model/RedemptionsGetResponseBodyCustomer.php create mode 100644 src/Model/RedemptionsGetResponseBodyGift.php create mode 100644 src/Model/RedemptionsGetResponseBodyLoyaltyCard.php create mode 100644 src/Model/RedemptionsGetResponseBodyOrder.php create mode 100644 src/Model/RedemptionsGetResponseBodyOrderCustomer.php create mode 100644 src/Model/RedemptionsGetResponseBodyOrderReferrer.php create mode 100644 src/Model/RedemptionsGetResponseBodyPromotionTier.php create mode 100644 src/Model/RedemptionsGetResponseBodyPromotionTierAction.php create mode 100644 src/Model/RedemptionsGetResponseBodyPromotionTierCampaign.php create mode 100644 src/Model/RedemptionsGetResponseBodyPromotionTierSummary.php create mode 100644 src/Model/RedemptionsGetResponseBodyPromotionTierSummaryOrders.php create mode 100644 src/Model/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.php create mode 100644 src/Model/RedemptionsGetResponseBodyRelatedRedemptions.php create mode 100644 src/Model/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.php create mode 100644 src/Model/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.php create mode 100644 src/Model/RedemptionsGetResponseBodyVoucher.php create mode 100644 src/Model/RedemptionsGetResponseBodyVoucherGift.php create mode 100644 src/Model/RedemptionsGetResponseBodyVoucherLoyaltyCard.php create mode 100644 src/Model/RedemptionsGetResponseBodyVoucherPublish.php create mode 100644 src/Model/RedemptionsGetResponseBodyVoucherRedemption.php create mode 100644 src/Model/RedemptionsListResponseBody.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItem.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemChannel.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemCustomer.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemGift.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemOrder.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTier.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemVoucher.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherGift.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.php create mode 100644 src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.php create mode 100644 src/Model/RedemptionsRedeemRequestBody.php create mode 100644 src/Model/RedemptionsRedeemRequestBodyOptions.php create mode 100644 src/Model/RedemptionsRedeemRequestBodyRedeemablesItem.php create mode 100644 src/Model/RedemptionsRedeemRequestBodyRedeemablesItemGift.php create mode 100644 src/Model/RedemptionsRedeemRequestBodyRedeemablesItemReward.php create mode 100644 src/Model/RedemptionsRedeemResponseBody.php create mode 100644 src/Model/RedemptionsRollbackCreateRequestBody.php create mode 100644 src/Model/RedemptionsRollbackCreateResponseBody.php create mode 100644 src/Model/RedemptionsRollbackCreateResponseBodyChannel.php create mode 100644 src/Model/RedemptionsRollbackCreateResponseBodyGift.php create mode 100644 src/Model/RedemptionsRollbackCreateResponseBodyLoyaltyCard.php create mode 100644 src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.php create mode 100644 src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.php create mode 100644 src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.php create mode 100644 src/Model/RedemptionsRollbacksCreateRequestBody.php create mode 100644 src/Model/RedemptionsRollbacksCreateResponseBody.php create mode 100644 src/Model/ReferralProgram.php create mode 100644 src/Model/ReferralProgramCustomEvent.php create mode 100644 src/Model/ReferralProgramRefereeReward.php create mode 100644 src/Model/ReferralProgramRefereeRewardRelatedObjectParent.php create mode 100644 src/Model/Referrer.php create mode 100644 src/Model/ReferrerAddress.php create mode 100644 src/Model/ReferrerId.php create mode 100644 src/Model/Reward.php create mode 100644 src/Model/RewardAssignment.php create mode 100644 src/Model/RewardAssignmentParameters.php create mode 100644 src/Model/RewardAssignmentParametersLoyalty.php create mode 100644 src/Model/RewardAttributes.php create mode 100644 src/Model/RewardType.php create mode 100644 src/Model/RewardTypeCampaign.php create mode 100644 src/Model/RewardTypeCoin.php create mode 100644 src/Model/RewardTypeProduct.php create mode 100644 src/Model/RewardsAssignmentsCreateRequestBody.php create mode 100644 src/Model/RewardsAssignmentsCreateRequestBodyParameters.php create mode 100644 src/Model/RewardsAssignmentsCreateRequestBodyParametersLoyalty.php create mode 100644 src/Model/RewardsAssignmentsCreateResponseBody.php create mode 100644 src/Model/RewardsAssignmentsCreateResponseBodyParameters.php create mode 100644 src/Model/RewardsAssignmentsCreateResponseBodyParametersLoyalty.php create mode 100644 src/Model/RewardsAssignmentsGetResponseBody.php create mode 100644 src/Model/RewardsAssignmentsGetResponseBodyParameters.php create mode 100644 src/Model/RewardsAssignmentsGetResponseBodyParametersLoyalty.php create mode 100644 src/Model/RewardsAssignmentsListResponseBody.php create mode 100644 src/Model/RewardsAssignmentsUpdateRequestBody.php create mode 100644 src/Model/RewardsAssignmentsUpdateRequestBodyParameters.php create mode 100644 src/Model/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.php create mode 100644 src/Model/RewardsAssignmentsUpdateResponseBody.php create mode 100644 src/Model/RewardsAssignmentsUpdateResponseBodyParameters.php create mode 100644 src/Model/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.php create mode 100644 src/Model/RewardsCreateRequestBody.php create mode 100644 src/Model/RewardsCreateRequestBodyAttributes.php create mode 100644 src/Model/RewardsCreateRequestBodyParameters.php create mode 100644 src/Model/RewardsCreateRequestBodyParametersCampaign.php create mode 100644 src/Model/RewardsCreateRequestBodyParametersCoin.php create mode 100644 src/Model/RewardsCreateRequestBodyParametersProduct.php create mode 100644 src/Model/RewardsCreateResponseBody.php create mode 100644 src/Model/RewardsCreateResponseBodyAttributes.php create mode 100644 src/Model/RewardsListResponseBody.php create mode 100644 src/Model/RewardsUpdateRequestBody.php create mode 100644 src/Model/RewardsUpdateRequestBodyAttributes.php create mode 100644 src/Model/RewardsUpdateRequestBodyParameters.php create mode 100644 src/Model/RewardsUpdateRequestBodyParametersCampaign.php create mode 100644 src/Model/RewardsUpdateRequestBodyParametersCoin.php create mode 100644 src/Model/RewardsUpdateRequestBodyParametersProduct.php create mode 100644 src/Model/RewardsUpdateResponseBody.php create mode 100644 src/Model/RewardsUpdateResponseBodyAttributes.php create mode 100644 src/Model/SegmentsCreateRequestBody.php create mode 100644 src/Model/SegmentsCreateResponseBody.php create mode 100644 src/Model/SegmentsGetResponseBody.php create mode 100644 src/Model/Session.php create mode 100644 src/Model/SimpleCustomer.php create mode 100644 src/Model/SimpleCustomerRequiredObjectType.php create mode 100644 src/Model/SimpleLoyaltyCard.php create mode 100644 src/Model/SimpleProductDiscountUnit.php create mode 100644 src/Model/SimpleSegment.php create mode 100644 src/Model/SimpleSkuDiscountUnit.php create mode 100644 src/Model/SimpleVoucher.php create mode 100644 src/Model/SimpleVoucherRedemption.php create mode 100644 src/Model/Sku.php create mode 100644 src/Model/SkusGetResponseBody.php create mode 100644 src/Model/SkusImportCsvCreateResponseBody.php create mode 100644 src/Model/SkusListForProduct.php create mode 100644 src/Model/StackingRules.php create mode 100644 src/Model/ValidationRule.php create mode 100644 src/Model/ValidationRuleApplicableTo.php create mode 100644 src/Model/ValidationRuleAssignment.php create mode 100644 src/Model/ValidationRuleAssignmentsList.php create mode 100644 src/Model/ValidationRuleError.php create mode 100644 src/Model/ValidationRulesAssignmentsCreateRequestBody.php create mode 100644 src/Model/ValidationRulesAssignmentsCreateResponseBody.php create mode 100644 src/Model/ValidationRulesAssignmentsList.php create mode 100644 src/Model/ValidationRulesAssignmentsListResponseBody.php create mode 100644 src/Model/ValidationRulesCreateRequestBody.php create mode 100644 src/Model/ValidationRulesCreateRequestBodyApplicableTo.php create mode 100644 src/Model/ValidationRulesCreateRequestBodyError.php create mode 100644 src/Model/ValidationRulesCreateResponseBody.php create mode 100644 src/Model/ValidationRulesCreateResponseBodyApplicableTo.php create mode 100644 src/Model/ValidationRulesCreateResponseBodyError.php create mode 100644 src/Model/ValidationRulesGetResponseBody.php create mode 100644 src/Model/ValidationRulesGetResponseBodyApplicableTo.php create mode 100644 src/Model/ValidationRulesGetResponseBodyError.php create mode 100644 src/Model/ValidationRulesListResponseBody.php create mode 100644 src/Model/ValidationRulesUpdateRequestBody.php create mode 100644 src/Model/ValidationRulesUpdateRequestBodyApplicableTo.php create mode 100644 src/Model/ValidationRulesUpdateRequestBodyError.php create mode 100644 src/Model/ValidationRulesUpdateResponseBody.php create mode 100644 src/Model/ValidationRulesUpdateResponseBodyApplicableTo.php create mode 100644 src/Model/ValidationRulesUpdateResponseBodyError.php create mode 100644 src/Model/ValidationsRedeemableInapplicable.php create mode 100644 src/Model/ValidationsRedeemableInapplicableResult.php create mode 100644 src/Model/ValidationsRedeemableInapplicableResultDetails.php create mode 100644 src/Model/ValidationsRedeemableSkipped.php create mode 100644 src/Model/ValidationsRedeemableSkippedResult.php create mode 100644 src/Model/ValidationsRedeemableSkippedResultDetails.php create mode 100644 src/Model/ValidationsValidateRequestBody.php create mode 100644 src/Model/ValidationsValidateRequestBodyOptions.php create mode 100644 src/Model/ValidationsValidateRequestBodyRedeemablesItem.php create mode 100644 src/Model/ValidationsValidateRequestBodyRedeemablesItemGift.php create mode 100644 src/Model/ValidationsValidateRequestBodyRedeemablesItemReward.php create mode 100644 src/Model/ValidationsValidateResponseBody.php create mode 100644 src/Model/ValidationsValidateResponseBodyRedeemablesItem.php create mode 100644 src/Model/ValidationsValidateResponseBodyRedeemablesItemResult.php create mode 100644 src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDetails.php create mode 100644 src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.php create mode 100644 src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.php create mode 100644 src/Model/ValidationsValidateResponseBodyRedeemablesItemResultGift.php create mode 100644 src/Model/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.php create mode 100644 src/Model/ValidityHours.php create mode 100644 src/Model/ValidityHoursDailyItem.php create mode 100644 src/Model/ValidityTimeframe.php create mode 100644 src/Model/Voucher.php create mode 100644 src/Model/VoucherAssets.php create mode 100644 src/Model/VoucherAssetsBarcode.php create mode 100644 src/Model/VoucherAssetsQr.php create mode 100644 src/Model/VoucherGift.php create mode 100644 src/Model/VoucherLoyaltyCard.php create mode 100644 src/Model/VoucherPublish.php create mode 100644 src/Model/VoucherRedemption.php create mode 100644 src/Model/VoucherTransaction.php create mode 100644 src/Model/VoucherTransactionDetails.php create mode 100644 src/Model/VoucherTransactionDetailsBalance.php create mode 100644 src/Model/VoucherTransactionDetailsBalanceRelatedObject.php create mode 100644 src/Model/VoucherTransactionDetailsCustomEvent.php create mode 100644 src/Model/VoucherTransactionDetailsEarningRule.php create mode 100644 src/Model/VoucherTransactionDetailsEarningRuleSource.php create mode 100644 src/Model/VoucherTransactionDetailsEvent.php create mode 100644 src/Model/VoucherTransactionDetailsEventSchema.php create mode 100644 src/Model/VoucherTransactionDetailsLoyaltyTier.php create mode 100644 src/Model/VoucherTransactionDetailsOrder.php create mode 100644 src/Model/VoucherTransactionDetailsRedemption.php create mode 100644 src/Model/VoucherTransactionDetailsReward.php create mode 100644 src/Model/VoucherTransactionDetailsRollback.php create mode 100644 src/Model/VoucherTransactionDetailsSegment.php create mode 100644 src/Model/VoucherTransactionsExportFilterConditions.php create mode 100644 src/Model/VoucherTransactionsExportFilterConditionsVoucherId.php create mode 100644 src/Model/VoucherTransactionsExportFilterConditionsVoucherIdConditions.php create mode 100644 src/Model/VoucherTransactionsExportParameters.php create mode 100644 src/Model/VoucherTransactionsFilters.php create mode 100644 src/Model/VoucherWithCategories.php create mode 100644 src/Model/VoucherWithCategoriesGift.php create mode 100644 src/Model/VoucherWithCategoriesLoyaltyCard.php create mode 100644 src/Model/VoucherWithCategoriesPublish.php create mode 100644 src/Model/VoucherWithCategoriesRedemption.php create mode 100644 src/Model/VouchersBalanceUpdateRequestBody.php create mode 100644 src/Model/VouchersBalanceUpdateResponseBody.php create mode 100644 src/Model/VouchersBalanceUpdateResponseBodyRelatedObject.php create mode 100644 src/Model/VouchersCreateResponseBody.php create mode 100644 src/Model/VouchersCreateResponseBodyGift.php create mode 100644 src/Model/VouchersCreateResponseBodyLoyaltyCard.php create mode 100644 src/Model/VouchersCreateResponseBodyPublish.php create mode 100644 src/Model/VouchersCreateResponseBodyRedemption.php create mode 100644 src/Model/VouchersCreateWithSpecificCodeRequestBody.php create mode 100644 src/Model/VouchersCreateWithSpecificCodeRequestBodyRedemption.php create mode 100644 src/Model/VouchersDisableResponseBody.php create mode 100644 src/Model/VouchersDisableResponseBodyGift.php create mode 100644 src/Model/VouchersDisableResponseBodyLoyaltyCard.php create mode 100644 src/Model/VouchersDisableResponseBodyPublish.php create mode 100644 src/Model/VouchersDisableResponseBodyRedemption.php create mode 100644 src/Model/VouchersEnableResponseBody.php create mode 100644 src/Model/VouchersEnableResponseBodyGift.php create mode 100644 src/Model/VouchersEnableResponseBodyLoyaltyCard.php create mode 100644 src/Model/VouchersEnableResponseBodyPublish.php create mode 100644 src/Model/VouchersEnableResponseBodyRedemption.php create mode 100644 src/Model/VouchersGetResponseBody.php create mode 100644 src/Model/VouchersGetResponseBodyGift.php create mode 100644 src/Model/VouchersGetResponseBodyLoyaltyCard.php create mode 100644 src/Model/VouchersGetResponseBodyPublish.php create mode 100644 src/Model/VouchersGetResponseBodyRedemption.php create mode 100644 src/Model/VouchersImportCreateItemRequestBody.php create mode 100644 src/Model/VouchersImportCreateItemRequestBodyRedemption.php create mode 100644 src/Model/VouchersImportCreateResponseBody.php create mode 100644 src/Model/VouchersImportCsvCreateResponseBody.php create mode 100644 src/Model/VouchersListResponseBody.php create mode 100644 src/Model/VouchersMetadataUpdateInBulkRequestBody.php create mode 100644 src/Model/VouchersMetadataUpdateInBulkResponseBody.php create mode 100644 src/Model/VouchersRedemptionGetResponseBody.php create mode 100644 src/Model/VouchersTransactionsExportCreateRequestBody.php create mode 100644 src/Model/VouchersTransactionsExportCreateResponseBody.php create mode 100644 src/Model/VouchersTransactionsExportCreateResponseBodyResult.php create mode 100644 src/Model/VouchersTransactionsListResponseBody.php create mode 100644 src/Model/VouchersUpdateInBulkItemRequestBody.php create mode 100644 src/Model/VouchersUpdateInBulkResponseBody.php create mode 100644 src/Model/VouchersUpdateRequestBody.php create mode 100644 src/Model/VouchersUpdateResponseBody.php create mode 100644 src/Model/VouchersUpdateResponseBodyGift.php create mode 100644 src/Model/VouchersUpdateResponseBodyLoyaltyCard.php create mode 100644 src/Model/VouchersUpdateResponseBodyPublish.php create mode 100644 src/Model/VouchersUpdateResponseBodyRedemption.php create mode 100644 src/ObjectSerializer.php delete mode 100644 src/Orders.php delete mode 100644 src/Products.php delete mode 100644 src/PromotionTiers.php delete mode 100644 src/Promotions.php delete mode 100644 src/Redemptions.php delete mode 100644 src/Segments.php delete mode 100644 src/Utils.php delete mode 100644 src/ValidationRules.php delete mode 100644 src/Validations.php delete mode 100644 src/VoucherBuilder.php delete mode 100644 src/VoucherifyClient.php delete mode 100644 src/Vouchers.php delete mode 100644 src/autoload.php delete mode 100644 test/AsyncActionsTest.php delete mode 100644 test/CampaignsTest.php delete mode 100644 test/ClientTest.php delete mode 100644 test/CustomEventsTest.php delete mode 100644 test/CustomersTest.php delete mode 100644 test/DistributionsTest.php delete mode 100644 test/OrdersTest.php delete mode 100644 test/ProductsTest.php delete mode 100644 test/PromotionsTest.php delete mode 100644 test/RedemptionsTest.php delete mode 100644 test/SegmentsTest.php delete mode 100644 test/UtilsTest.php delete mode 100644 test/ValidationRulesTest.php delete mode 100644 test/ValidationsTest.php delete mode 100644 test/VouchersTest.php delete mode 100644 test/helpers/CurlMock.php delete mode 100644 test/helpers/CurlRequest.php diff --git a/.gitignore b/.gitignore index 6e1ebde..d3987a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,30 @@ -# Dependencies: -/.idea/ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar /vendor/ -.DS_Store -/.test/ -# Log and temporary files: -*.log -*.iml -/dist/ -# Editor configuraton files: -/typings/ -/.vscode/ -composer.phar \ No newline at end of file + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# makes sense since it's a library(client SDK) and not a project +composer.lock + +# php-cs-fixer cache +.php_cs.cache +.php-cs-fixer.cache + +# PHPUnit cache +.phpunit.result.cache + +# PHPLint cache +build/phplint.cache + + +/.openapi-generator/ +/tests/ +/.gitlab-ci.yml +/.openapi-generator-ignore +/.travis.yml +/git_push.sh +/test-requirements.txt +/.env +/.idea/ diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.phplint.yml b/.phplint.yml new file mode 100644 index 0000000..ef4be48 --- /dev/null +++ b/.phplint.yml @@ -0,0 +1,11 @@ +path: + - ./src + - ./tests +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true diff --git a/ENDPOINTS-COVERAGE.md b/ENDPOINTS-COVERAGE.md new file mode 100644 index 0000000..4316b42 --- /dev/null +++ b/ENDPOINTS-COVERAGE.md @@ -0,0 +1,352 @@ +# Endpoints Coverage + +## Table of Content + +- [Publications](#publications) +- [Qualifications](#qualifications) +- [Validations](#validations) +- [Redemptions](#redemptions) +- [Vouchers](#vouchers) +- [Campaigns](#campaigns) +- [Promotions](#promotions) +- [Rewards](#rewards) +- [Loyalties](#loyalties) +- [Customers](#customers) +- [Orders](#orders) +- [Products](#products) +- [Product Collections](#product-collections) +- [Validation Rules](#validation-rules) +- [Segments](#segments) +- [Events](#events) +- [Consents](#consents) +- [Async Actions](#async-actions) +- [Exports](#exports) +- [Categories](#categories) +- [Metadata Schemas](#metadata-schemas) +- [Locations](#locations) +- [Referrals](#referrals) +- [Bin](#bin) +- [Templates](#templates) +- [Management](#management) +- [Client-side](#client-side) +# Endpoints + +## Publications +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/publications/create | get | Create Publication | supported | | +| /v1/publications | get | List Publications | supported | | +| /v1/publications | post | Create Publication | supported | | +## Qualifications +| endpoint | method | summary | is supported | is deprecated | +| ------------------ | ------ | ----------------- | ------------------------------------ | ------------- | +| /v1/qualifications | post | Check Eligibility | supported | | +## Validations +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------- | ------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/validations | post | Validate Stackable Discounts | supported | | +| /v1/vouchers/{code}/validate | post | Validate Voucher [Deprecated] | | deprecated | +| /v1/promotions/validation | post | Validate Promotions [Deprecated] | | deprecated | +| /v1/promotions/tiers/{tierId}/validation | post | Validate Promotion Tier [Deprecated] | | deprecated | +## Redemptions +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------- | ------ | ------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/redemptions | get | List Redemptions | supported | | +| /v1/redemptions | post | Redeem Stackable Discounts | supported | | +| /v1/redemptions/{redemptionId} | get | Get Redemption | supported | | +| /v1/vouchers/{code}/redemption | get | Get Voucher's Redemptions | supported | | +| /v1/vouchers/{code}/redemption | post | Redeem Voucher [Deprecated] | | deprecated | +| /v1/redemptions/{redemptionId}/rollback | post | Rollback Redemption | supported | | +| /v1/promotions/tiers/{promotionTierId}/redemption | post | Redeem Promotion [Deprecated] | | deprecated | +| /v1/redemptions/{parentRedemptionId}/rollbacks | post | Rollback Stackable Redemptions | supported | | +## Vouchers +| endpoint | method | summary | is supported | is deprecated | +| ----------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------------------------------ | +| /v1/vouchers | get | List Vouchers | supported | | +| /v1/vouchers | post | Generate Random Code | supported | | +| /v1/vouchers/{code} | get | Get Voucher | supported | | +| /v1/vouchers/{code} | put | Update Voucher | supported | | +| /v1/vouchers/{code} | delete | Delete Voucher | supported | | +| /v1/vouchers/{code} | post | Create Voucher | supported | | +| /v1/vouchers/{code}/enable | post | Enable Voucher | supported | | +| /v1/vouchers/{code}/disable | post | Disable Voucher | supported | | +| /v1/vouchers/{code}/balance | post | Add or Remove Voucher Balance | supported | | +| /v1/vouchers/{code}/transactions | get | List Voucher Transactions | supported | | +| /v1/vouchers/{code}/transactions/export | post | Export Voucher Transactions | supported | | +| /v1/vouchers/import | post | Import Vouchers | supported | | +| /v1/vouchers/importCSV | post | Import Vouchers using CSV | supported | | +| /v1/vouchers/bulk/async | post | Update Vouchers in Bulk | supported | | +| /v1/vouchers/metadata/async | post | Update Vouchers' Metadata in Bulk | supported | | +| /v1/vouchers/{code}/sessions/{sessionKey} | delete | Release Validation Session | supported | | +| /v1/vouchers/qualification | post | Examine Qualification [Deprecated] | | deprecated | +## Campaigns +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------ | ------ | ------------------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/campaigns | post | Create Campaign | supported | | +| /v1/campaigns | get | List Campaigns | supported | | +| /v1/campaigns/{campaignId} | get | Get Campaign | supported | | +| /v1/campaigns/{campaignId} | put | Update Campaign | supported | | +| /v1/campaigns/{campaignId} | delete | Delete Campaign | supported | | +| /v1/campaigns/{campaignId}/vouchers | post | Add Vouchers to Campaign | supported | | +| /v1/campaigns/{campaignId}/vouchers/{code} | post | Add Voucher with Specific Code to Campaign | supported | | +| /v1/campaigns/{campaignId}/import | post | Import Vouchers to Campaign | supported | | +| /v1/campaigns/{campaignId}/importCSV | post | Import Vouchers to Campaign by CSV | supported | | +| /v1/campaigns/qualification | post | Examine Qualification [Deprecated] | | deprecated | +| /v1/campaigns/{campaignId}/enable | post | Enable Campaign | supported | | +| /v1/campaigns/{campaignId}/disable | post | Disable Campaign | supported | | +## Promotions +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------- | +| /v1/promotions/tiers | get | List Promotion Tiers | supported | | +| /v1/promotions/{campaignId}/tiers | get | List Promotion Tiers from Campaign | supported | | +| /v1/promotions/{campaignId}/tiers | post | Add Promotion Tier to Campaign | supported | | +| /v1/promotions/tiers/{promotionTierId} | get | Get Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId} | put | Update Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId} | delete | Delete Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId}/enable | post | Enable Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId}/disable | post | Disable Promotion Tier | supported | | +| /v1/promotions/stacks | get | List Promotion Stacks | supported | | +| /v1/promotions/{campaignId}/stacks | get | List Promotion Stacks in Campaign | supported | | +| /v1/promotions/{campaignId}/stacks | post | Create Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | get | Get Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | put | Update Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | delete | Delete Promotion Stack | supported | | +## Rewards +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------- | ------ | ------------------------ | ------------------------------------ | ------------- | +| /v1/rewards | get | List Rewards | supported | | +| /v1/rewards | post | Create Reward | supported | | +| /v1/rewards/{rewardId} | get | Get Reward | supported | | +| /v1/rewards/{rewardId} | put | Update Reward | supported | | +| /v1/rewards/{rewardId} | delete | Delete Reward | supported | | +| /v1/rewards/{rewardId}/assignments | get | List Reward Assignments | supported | | +| /v1/rewards/{rewardId}/assignments | post | Create Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | put | Update Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | delete | Delete Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | get | Get Reward Assignment | supported | | +## Loyalties +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------- | +| /v1/loyalties | get | List Loyalty Campaigns | supported | | +| /v1/loyalties | post | Create Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | get | Get Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | put | Update Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | delete | Delete Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId}/members | get | List Members | supported | | +| /v1/loyalties/{campaignId}/members | post | Add Member | supported | | +| /v1/loyalties/{campaignId}/members/{memberId} | get | Get Member | supported | | +| /v1/loyalties/members/{memberId} | get | Get Member | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/activity | get | List Member Activity | supported | | +| /v1/loyalties/members/{memberId}/activity | get | List Member Activity | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/balance | post | Add or Remove Loyalty Card Balance | supported | | +| /v1/loyalties/members/{memberId}/balance | post | Add or Remove Loyalty Card Balance | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transfers | post | Transfer Loyalty Points | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transactions | get | List Loyalty Card Transactions | supported | | +| /v1/loyalties/members/{memberId}/transactions | get | List Loyalty Card Transactions | supported | | +| /v1/loyalties/members/{memberId}/transactions/export | post | Export Loyalty Card Transactions | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | post | Export Loyalty Card Transactions | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | get | Get Points Expiration | supported | | +| /v1/loyalties/{campaignId}/points-expiration/export | post | Create Points Expiration Export | supported | | +| /v1/loyalties/{campaignId}/earning-rules | get | List Earning Rules | supported | | +| /v1/loyalties/{campaignId}/earning-rules | post | Create Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | get | Get Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | put | Update Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | delete | Delete Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable | post | Enable Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable | post | Disable Earning Rule | supported | | +| /v1/loyalties/members/{memberId}/rewards | get | List Member Rewards | supported | | +| /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | get | Get Reward Details | supported | | +| /v1/loyalties/{campaignId}/reward-assignments | get | List Reward Assignments | supported | | +| /v1/loyalties/{campaignId}/rewards | get | List Reward Assignments | supported | | +| /v1/loyalties/{campaignId}/rewards | post | Create Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | get | Get Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | get | Get Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | put | Update Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | delete | Delete Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/redemption | post | Redeem Reward | supported | | +| /v1/loyalties/members/{memberId}/redemption | post | Redeem Reward | supported | | +| /v1/loyalties/{campaignId}/tiers | get | List Loyalty Tiers | supported | | +| /v1/loyalties/{campaignId}/tiers | post | Create loyalty tiers | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | get | Get Loyalty Tier | supported | | +| /v1/loyalties/members/{memberId}/tiers | get | List Member's Loyalty Tiers | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | get | List Loyalty Tier Earning Rules | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | get | List Loyalty Tier Rewards | supported | | +## Customers +| endpoint | method | summary | is supported | is deprecated | +| --------------------------------------------- | ------ | --------------------------------------- | ------------------------------------ | ------------------------------------ | +| /v1/customers | get | List Customers | supported | | +| /v1/customers | post | Create Customer | supported | | +| /v1/customers/{customerId} | get | Get Customer | supported | | +| /v1/customers/{customerId} | delete | Delete Customer | supported | | +| /v1/customers/{customerId} | put | Update Customer | supported | | +| /v1/customers/{customerId}/permanent-deletion | post | Delete Customer Permanently | supported | | +| /v1/customers/importCSV | post | Import and Update Customers using CSV | supported | | +| /v1/customers/bulk/async | post | Update Customers in Bulk | supported | | +| /v1/customers/metadata/async | post | Update Customers' Metadata in Bulk | supported | | +| /v1/customers/{customerId}/consents | put | Update Customer's consents [Deprecated] | supported | deprecated | +| /v1/customers/{customerId}/activity | get | List Customer Activity | supported | | +| /v1/customers/{customerId}/activities | get | List Customer Activities [Deprecated] | | deprecated | +| /v1/customers/{customerId}/segments | get | List Customer's Segments | supported | | +| /v1/customers/{customerId}/redeemables | get | List Customer's Redeemables | supported | | +## Orders +| endpoint | method | summary | is supported | is deprecated | +| -------------------- | ------ | -------------------- | ------------------------------------ | ------------- | +| /v1/orders | get | List Orders | supported | | +| /v1/orders | post | Create Order | supported | | +| /v1/orders/{orderId} | get | Get Order | supported | | +| /v1/orders/{orderId} | put | Update Order | supported | | +| /v1/orders/import | post | Import Orders | supported | | +| /v1/orders/export | post | Create Orders Export | supported | | +## Products +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------- | ------ | --------------------------------- | ------------------------------------ | ------------- | +| /v1/products | get | List Products | supported | | +| /v1/products | post | Create Product | supported | | +| /v1/products/{productId} | get | Get Product | supported | | +| /v1/products/{productId} | put | Update Product | supported | | +| /v1/products/{productId} | delete | Delete Product | supported | | +| /v1/products/bulk/async | post | Update Products in Bulk | supported | | +| /v1/products/metadata/async | post | Update Products' Metadata in Bulk | supported | | +| /v1/skus/{skuId} | get | Get SKU | supported | | +| /v1/products/{productId}/skus | get | List SKUs in Product | supported | | +| /v1/products/{productId}/skus | post | Create SKU | supported | | +| /v1/products/{productId}/skus/{skuId} | put | Update SKU | supported | | +| /v1/products/{productId}/skus/{skuId} | delete | Delete SKU | supported | | +| /v1/products/importCSV | post | Import Products using CSV | supported | | +| /v1/skus/importCSV | post | Import SKUs using CSV | supported | | +## Product Collections +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------ | ------ | --------------------------- | ------------------------------------ | ------------- | +| /v1/product-collections | get | List Product Collections | supported | | +| /v1/product-collections | post | Create Product Collection | supported | | +| /v1/product-collections/{productCollectionId} | get | Get Product Collection | supported | | +| /v1/product-collections/{productCollectionId} | delete | Delete Product Collection | supported | | +| /v1/product-collections/{productCollectionId}/products | get | List Products in Collection | supported | | +## Validation Rules +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------ | ------ | ------------------------------------ | ------------------------------------ | ------------- | +| /v1/validation-rules | get | List Validation Rules | supported | | +| /v1/validation-rules | post | Create Validation Rules | supported | | +| /v1/validation-rules/{validationRuleId} | get | Get Validation Rule | supported | | +| /v1/validation-rules/{validationRuleId} | put | Update Validation Rule | supported | | +| /v1/validation-rules/{validationRuleId} | delete | Delete Validation Rule | supported | | +| /v1/validation-rules-assignments | get | List Validation Rules' Assignment(s) | supported | | +| /v1/validation-rules/{validationRuleId}/assignments | get | List Validation Rule Assignments | supported | | +| /v1/validation-rules/{validationRuleId}/assignments | post | Create Validation Rules Assignments | supported | | +| /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} | delete | Delete Validation Rule Assignment | supported | | +## Segments +| endpoint | method | summary | is supported | is deprecated | +| ------------------------ | ------ | -------------- | ------------------------------------ | ------------- | +| /v1/segments/{segmentId} | get | Get Segment | supported | | +| /v1/segments/{segmentId} | delete | Delete Segment | supported | | +| /v1/segments | post | Create Segment | supported | | +## Events +| endpoint | method | summary | is supported | is deprecated | +| ---------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/events | post | Track Custom Event | supported | | +## Consents +| endpoint | method | summary | is supported | is deprecated | +| ------------ | ------ | -------------------------- | ------------ | ------------------------------------ | +| /v1/consents | get | List Consents [Deprecated] | | deprecated | +## Async Actions +| endpoint | method | summary | is supported | is deprecated | +| --------------------------------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/async-actions | get | List Async Actions | supported | | +| /v1/async-actions/{asyncActionId} | get | Get Async Action | supported | | +## Exports +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | --------------- | ------------------------------------ | ------------- | +| /v1/exports | post | Create Export | supported | | +| /v1/exports | get | List Exports | supported | | +| /v1/exports/{exportId} | get | Get Export | supported | | +| /v1/exports/{exportId} | delete | Delete Export | supported | | +| /v1/exports/{export_Id} | get | Download Export | supported | | +## Categories +| endpoint | method | summary | is supported | is deprecated | +| --------------------------- | ------ | --------------- | ------------------------------------ | ------------- | +| /v1/categories | get | List Categories | supported | | +| /v1/categories | post | Create Category | supported | | +| /v1/categories/{categoryId} | get | Get Category | supported | | +| /v1/categories/{categoryId} | delete | Delete Category | supported | | +| /v1/categories/{categoryId} | put | Update Category | supported | | +## Metadata Schemas +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------- | ------ | --------------------- | ------------ | ------------- | +| /v1/metadata-schemas | get | List Metadata Schemas | | | +| /v1/metadata-schemas/{resource} | get | Get Metadata Schema | | | +## Locations +| endpoint | method | summary | is supported | is deprecated | +| -------------------------- | ------ | -------------- | ------------ | ------------- | +| /v1/locations | get | List Locations | | | +| /v1/locations/{locationId} | get | Get Location | | | +## Referrals +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------------------------------- | ------ | --------------------------- | ------------ | ------------- | +| /v1/referrals/{campaignId}/members/{memberId}/holders | post | Add Referral Code Holders | | | +| /v1/referrals/{campaignId}/members/{memberId}/holders | get | List Referral Code Holders | | | +| /v1/referrals/{campaignId}/members/{memberId}/holders/{holderId} | delete | Remove Referral Card Holder | | | +| /v1/referrals/members/{memberId}/holders | post | Add Referral Code Holders | | | +| /v1/referrals/members/{memberId}/holders | get | List Referral Code Holders | | | +| /v1/referrals/members/{memberId}/holders/{holderId} | delete | Remove Referral Card Holder | | | +## Bin +| endpoint | method | summary | is supported | is deprecated | +| -------------------------- | ------ | ---------------- | ------------ | ------------- | +| /v1/trash-bin | get | List Bin Entries | | | +| /v1/trash-bin/{binEntryId} | delete | Delete Bin Entry | | | +## Templates +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | ------------------------ | ------------ | ------------- | +| /v1/templates/campaigns | get | List Campaign Templates | | | +| /v1/templates/campaigns | post | Create Campaign Template | | | +## Management +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------------------ | ------ | -------------------------- | ------------ | ------------- | +| /management/v1/projects | post | Create Project | | | +| /management/v1/projects | get | List Projects | | | +| /management/v1/projects/{projectId} | get | Get Project | | | +| /management/v1/projects/{projectId} | put | Update Project | | | +| /management/v1/projects/{projectId} | delete | Delete Project | | | +| /management/v1/projects/{projectId}/users | post | Assign User | | | +| /management/v1/projects/{projectId}/users | get | List Users | | | +| /management/v1/projects/{projectId}/users/{userId} | get | Get User | | | +| /management/v1/projects/{projectId}/users/{userId} | put | Update User | | | +| /management/v1/projects/{projectId}/users/{userId} | delete | Unassign User | | | +| /management/v1/projects/users/invite | post | Invite a New User | | | +| /management/v1/projects/{projectId}/stacking-rules | post | Create Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules | get | List Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | get | Get Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | put | Update Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | delete | Delete Stacking Rules | | | +| /management/v1/projects/{projectId}/metadata-schemas | post | Create Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas | get | List Metadata Schemas | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | get | Get Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | put | Update Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | delete | Delete Metadata Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas | post | Create Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas | get | List Custom Event Schemas | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | get | Get Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | put | Update Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | delete | Delete Custom Event Schema | | | +| /management/v1/projects/{projectId}/webhooks | post | Create Webhook | | | +| /management/v1/projects/{projectId}/webhooks | get | List Webhooks | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | get | Get Webhook | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | put | Update Webhook | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | delete | Delete Webhook | | | +| /management/v1/projects/{projectId}/branding | post | Create Brand | | | +| /management/v1/projects/{projectId}/branding | get | List Brands | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | get | Get Brand | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | put | Update Brand | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | delete | Delete Brand | | | +## Client-side +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------ | ------ | ----------------------------------------------------- | ------------------------------------ | ------------------------------------ | +| /client/v1/qualifications | post | Check Eligibility (client-side) | supported | | +| /client/v1/promotions/tiers | get | List Promotion Tiers (client-side) | supported | | +| /client/v1/redemptions | post | Redeem Stackable Discounts (client-side) | supported | | +| /client/v1/validations | post | Validate Stackable Discounts (client-side) | supported | | +| /client/v1/customers/{customerId}/consents | put | Update Customer's consents (client-side) [Deprecated] | | deprecated | +| /client/v1/events | post | Track Custom Event (client-side) | supported | | +| /client/v1/consents | get | List Consents (client-side) [Deprecated] | | deprecated | +| /client/v1/validate | get | Validate Voucher (client-side) [Deprecated] | | deprecated | +| /client/v1/redeem | post | Redeem Voucher (client-side) [Deprecated] | | deprecated | +| /client/v1/publish | post | Create Publication (client-side) | | | \ No newline at end of file diff --git a/README.md b/README.md index e4a753f..56a838e 100644 --- a/README.md +++ b/README.md @@ -1,892 +1,1233 @@ -

- -

- -

Official Voucherify SDK for PHP

- -
- -

-Migration from 0.x -| -Setup -| -Error handling -| -Contributing -| -Changelog -

- -

-API: -Vouchers -| -Campaigns -| -Distributions -| -Validations -| -Redemptions -| -Customers -| -Orders -| -Products -| -Validation Rules -| -Segments -| -Events -| -Promotions -| -Async Actions -| -Utils -

- -## Setup - -Add Voucherify dependency into your `composer.json`: -``` -"rspective/voucherify": "v2.0.*" -``` -Update project dependencies: - -``` -$ composer install -``` -[Log-in](http://app.voucherify.io/#/login) to Voucherify web interace and obtain your Application Keys from [Configuration](https://app.voucherify.io/#/app/configuration): - -```php -require_once('vendor/autoload.php'); - -use Voucherify\VoucherifyClient; -use Voucherify\ClientException; - -$apiID = "YOUR-APPLICATION-ID"; -$apiKey = "YOUR-CLIENT-SECRET-KEY"; - -$client = new VoucherifyClient($apiID, $apiKey); -``` - -### Versioning -All requests will use your account API settings, unless you override the API version. The changelog lists every available version. - -```php -$apiVersion = "v2018-08-01"; - -$client = new VoucherifyClient($apiID, $apiKey, $apiVersion); -``` - -Check [versioning](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#versioning). - -### Custom API URL -By default client is sending request to `https://api.voucherify.io`. You can override `$apiUrl` while creating client instance if you want to use Voucherify running in a specific region - -```php -$apiVersion = null; -$apiUrl = "https://.api.voucherify.io"; - -$client = new VoucherifyClient($apiID, $apiKey, $apiVersion, $apiUrl); -``` - -### Custom Headers -It is possible to send custom headers in Voucherify API request. -```php -$apiVersion = null; -$apiUrl = null; -$customHeaders = [ - "X-Custom-1" => "Value-1" -]; - -$client = new VoucherifyClient($apiID, $apiKey, $apiVersion, $apiUrl, $customHeaders); - -# RESULT: -# x-custom-1: Value-1 -``` - -Special: Voucherify-Channel customization -```php -$apiVersion = null; -$apiUrl = null; -$customHeaders = [ - "V-Voucherify-Channel" => "Value-1" -]; - -$client = new VoucherifyClient($apiID, $apiKey, $apiVersion, $apiUrl, $customHeaders); - -# RESULT: -# x-voucherify-channel: PHP-SDK-Value-1 -``` - -### PHP autoloading - -When you aren't using composer you can load Voucherify module by including `autoload.php` file from `/src` directory. - -```php -require_once('{voucherify_src_path}/autoload.php'); - -use Voucherify\VoucherifyClient; -use Voucherify\ClientException; - -$client = new VoucherifyClient($apiID, $apiKey); -``` - -## API - -This SDK is fully consistent with restufl API Voucherify provides. -Detalied description and example responses you will find at [official docs](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq). -Method headers point to more detalied params description you can use. - -### Vouchers API -Methods are provided within `$client->vouchers->*` namespace. -- [Create Voucher](#create-voucher) -- [Get Voucher](#get-voucher) -- [Update Voucher](#update-voucher) -- [Delete Voucher](#delete-voucher) -- [List Vouchers](#list-vouchers) -- [Enable Voucher](#enable-voucher) -- [Disable Voucher](#disable-voucher) -- [Add balance to Gift-Card Voucher](#add-balance-to-gift-card-voucher) -- [Import Vouchers](#import-vouchers) - -Check [voucher object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-voucher-object). - -#### [Create Voucher] -```php -$client->vouchers->create($voucher); -``` -#### [Get Voucher] -```php -$client->vouchers->get($code); -``` -#### [Update Voucher] -```php -$client->vouchers->update($voucher_update); -``` -#### [Delete Voucher] -```php -$client->vouchers->delete($code); -$client->vouchers->delete($code, $force); -``` -#### [List Vouchers] -```php -$client->vouchers->getList(); -$client->vouchers->getList($params); -``` -#### [Enable Voucher] -```php -$client->vouchers->enable($code); -``` -#### [Disable Voucher] -```php -$client->vouchers->disable($code); -``` -#### [Add balance to Gift-Card Voucher] -```php -$client->vouchers->addBalance($code, $balance); -``` -#### [Import Vouchers] -```php -$client->vouchers->import($vouchers); -``` - ---- - -### Campaigns API - -Methods are provided within `$client->campaigns->*` namespace. - -- [Create Campaign](#create-campaign) -- [Get Campaign](#get-campaign) -- [Add Voucher to Campaign](#add-voucher-to-campaign) -- [Add Voucher with certain code to Campaign](#add-voucher-with-certain-code-to-campaign) -- [Import Vouchers to Campaign](#import-vouchers-to-campaign) -- [Delete Campaign](#delete-campaign) - -#### [Create Campaign] -```php -$client->campaigns->create($campaign); -``` -#### [Get Campaign] -```php -$client->campaigns->get($name); -``` -#### [Add Voucher to Campaign] -```php -$client->campaigns->addVoucher($campaignName); -$client->campaigns->addVoucher($campaignName, $params); -``` -#### [Add Voucher with certain code to Campaign] -```php -$client->campaigns->addVoucherWithCode($campaignName, $code); -$client->campaigns->addVoucherWithCode($campaignName, $code, $params); -``` -#### [Import Vouchers to Campaign] -```php -$client->campaigns->importVouchers($campaignName, $vouchers); -``` -#### [Delete Campaign] -```php -$client->campaigns->delete($campaignName); -``` - ---- - -### Distributions API -Methods are provided within `$client->distributions->*` namespace. - -- [Publish Voucher](#publish-voucher) -- [Create Export](#create-export) -- [Get Export](#get-export) -- [Delete Export](#delete-export) -- [List Publications](#list-publications) - -#### [Publish Voucher] -```php -$client->distributions->publish($campaign_name); -$client->distributions->publish($params); -``` -#### [Create Export] -```php -$client->distributions->createExport($params); -``` -#### [Get Export] -```php -$client->distributions->getExport($exportId); -``` -#### [Delete Export] -```php -$client->distributions->deleteExport($exportId); -``` -#### [List Publications] -```php -$client->distributions->getPublications(); -$client->distributions->getPublications($params); -``` - ---- - -### Validations API -Methods are provided within `$client->validations->*` namespace. - -- [Validate Voucher](#validate-voucher) -- [Validate Promotion Campaign](#validate-promotions-1) - -#### [Validate Voucher] -```php -$client->validations->validate($code); -$client->validations->validate($code, $params); - -// OR - -$client->validations->validateVoucher($code); -$client->validations->validateVoucher($code, $params); -``` - -#### [Validate Promotion Campaign] -```php -$client->validations->validate($params); -``` - ---- - -### Redemptions API -Methods are provided within `$client->redemptions->*` namespace. - -- [Redeem Voucher](#redeem-voucher) -- [Redeem Promotion's Tier](#redeem-promotion-tier) -- [Get Redemption](#get-redemption) -- [List Redemptions](#list-redemptions) -- [Get Voucher's Redemptions](#get-vouchers-redemptions) -- [Rollback Redemption](#rollback-redemption) - -Check [redemption rollback object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-redemption-rollback-object). - -#### [Redeem Voucher] -```php -$client->redemptions->redeem($code); -$client->redemptions->redeem($code, $params); -``` -#### [Redeem Promotion's Tier] -```php -$client->redemptions->redeem($promotionsTier, $params); -``` -#### [Get Redemption] -``` -$client->redemptions->get($redemptionId); -``` -#### [List Redemptions] -```php -$client->redemptions->getList(); -$client->redemptions->getList($params); -``` -#### [Get Voucher's Redemptions] -```php -$client->redemptions->getForVoucher($code); -``` -#### [Rollback Redemption] -```php -$client->redemptions->rollback($redemption_id); -$client->redemptions->rollback($redemption_id, $params); -$client->redemptions->rollback($redemption_id, $reason); -``` - ---- - -### Customers API -Methods are provided within `$client->customers->*` namespace. - -- [Create Customer](#create-customer) -- [Get Customer](#get-customer) -- [Update Customer](#update-customer) -- [Delete Customer](#delete-customer) -- [List Customers](#list-customers) - -Check [customer object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-customer-object). - -#### [Create Customer] -```php -$client->customers->create($customer); -``` -#### [Get Customer] -```php -$client->customers->get($customer_id); -``` -#### [Update Customer] -```php -$client->customers->update($customer_update); -``` -#### [Delete Customer] -```php -$client->customers->delete($customer_id); -``` -#### [List Customers] -```php -$client->customers->getList(); -$client->customers->getList($params); -``` - ---- - -### Orders API -Methods are provided within `$client->orders->*` namespace. - -- [Create Order](#create-order) -- [Get Order](#get-order) -- [Update Order](#update-order) -- [List Orders](#list-orders) - -Check [customer object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-order-object). - -#### [Create Order] -```php -$client->orders->create($order); -``` -#### [Get Order] -```php -$client->orders->get($order_id); -``` -#### [Update Order] -```php -$client->orders->update($order_update); -``` -#### [List Orders] -```php -$client->orders->getList(); -``` - ---- - -### Products API -Methods are provided within `$client->products->*` namespace. - -- [Create Product](#create-product) -- [Get Product](#get-product) -- [List Products](#list-products) -- [Update Product](#update-product) -- [Delete Product](#delete-product) -- [Create SKU](#create-sku) -- [Get SKU](#get-sku) -- [List SKUs](#list-skus) -- [Update SKU](#update-sku) -- [Delete SKU](#delete-sku) - -Check [product object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-product-object). - -Check [sku object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-sku-object). - -#### [Create Product] -```php -$client->products->create($product); -``` -#### [Get Product] -```php -$client->products->get($product_id); -``` -#### [List Products] -```php -$client->products->getList(); -``` -#### [Update Product] -```php -$client->products->update($product_update); -``` -#### [Delete Product] -```php -$client->products->delete($product_id); -$client->products->delete($product_id, $force); -``` -#### [Create SKU] -```php -$client->products->createSku($product_id, $sku); -``` -#### [Get SKU] -```php -$client->products->getSku($product_id, $sku_id); -``` -#### [List SKUs] -```php -$client->products->getSkus($product_id); -``` -#### [Update SKU] -```php -$client->products->updateSku($product_id, $sku_update); -``` -#### [Delete SKU] -```php -$client->products->deleteSku($product_id, $sku_id); -$client->products->deleteSku($product_id, $sku_id, $force); -``` - ---- - -### Validation Rules API -Methods are provided within `$client->validationRules->*` namespace. - -- [Create Validation Rule](#create-validation-rule) -- [Get Validation Rule](#get-validation-rule) -- [Update Validation Rule](#update-validation-rule) -- [Delete Validation Rule](#delete-validation-rule) - -Check [validation rule object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-validation-rule-object). - -#### [Create Validation Rule] -```php -$client->validationRules->create($rule); -``` -#### [Get Validation Rule] -```php -$client->validationRules->get($rule_id); -``` -#### [List Validation Rules] -```php -$client->validationRules->getList(); -``` -#### [Update Validation Rule] -```php -$client->validationRules->update($rule_update); -``` -#### [Delete Validation Rule] -```php -$client->validationRules->delete($rule_id); -``` -#### [Create Validation Rule Assignment] -```php -$client->validationRules->createAssignment($rule_id, $assignment); -``` -#### [List Validation Rule Assignments] -```php -$client->validationRules->getAssignments($rule_id); -``` -#### [Delete Validation Rule Assignment] -```php -$client->validationRules->deleteAssignment($rule_id, $assignment_id); -``` - ---- - -### Segments API -Methods are provided within `$client->segments->*` namespace. - -- [Create Segment](#create-segment) -- [Get Segment](#get-segment) -- [Delete Segment](#delete-segment) - -Check [segment object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-segment-object). - -#### [Create Segment] -```php -$client->segments->create($params); -``` -#### [Get Segment] -```php -$client->segments->get($segment_id); -``` -#### [Delete Segment] -```php -$client->segments->delete($segment_id); -``` - ---- -### Events API -Methods are provided within `$client->customEvents->*` namespace. -- [Track Custom Event](#track-custom-event) - -Check [event object](https://docs.voucherify.io/reference/the-custom-event-object?utm_source=github&utm_medium=sdk&utm_campaign=acq). - -#### [Track Custom Event] -```php -$client->customEvent->track($event, $customer); -``` - ---- +# OpenAPIClient-php -### Promotions API -Methods are provided within `$client->promotions->*` namespace. +Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. -- [Create Promotion Campaign](#create-promotion-campaign) -- [Validate Promotion Campaign](#validate-promotion-campaign) -- [List Promotion's Tiers](#list-promotions-tiers) -- [Create Promotion's Tier](#create-promotions-tier) -- [Redeem Promotion's Tier](#redeem-promotions-tier) -- [Update Promotion's Tier](#update-promotions-tier) -- [Delete Promotion's Tier](#delete-promotions-tier) -- [List Available Promotion Tiers](#list-available-promotion-tiers) +For more information, please visit [https://www.voucherify.io/contact-support](https://www.voucherify.io/contact-support). -Check [promotion campaign object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-promotion-campaign). +## Installation & Usage -Check [promotion's tier object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-promotion-object). +### Requirements -#### [Create Promotion Campaign] -```php -$client->promotions->create($promotionCampaign); -``` - -#### [Validate Promotion Campaign] -```php -$client->promotions->validate($validationContext); -``` - -#### [List Promotion's Tiers] -```php -$client->promotions->tiers->getList($promotionCampaignId); -``` - -#### [Create Promotion's Tier] -```php -$client->promotions->tiers->create($promotionCampaignId, $promotionsTier); -``` - -#### [Redeem Promotion's Tier] -```php -$client->promotions->tiers->redeem($promotionsTierId, $redemptionContext); -``` - -#### [Update Promotion's Tier] -```php -$client->promotions->tiers->update($promotionTierId); -``` - -#### [Delete Promotion's Tier] -```php -$client->promotions->tiers->delete($promotionTierId); -``` - -#### [List Available Promotion Tiers] -```php -$client->promotions->tiers->getAvailable(); -``` - ---- - -### Async Actions API -Methods are provided within `$client->asyncActions->*` namespace. -- [Get Async Action](#get-async-action) -- [List Async Actions](#list-async-actions) - -#### [Get Async Action] -```php -$client->asyncActions->get($id); -``` -#### [List Async Actions] -```php -$client->asyncActions->getList(); -$client->asyncActions->getList($params); -``` +PHP 8.1 and later. ---- +### Composer -### Utils -To use utils you have to import Voucherify Utils class. - -```php -require_once('vendor/autoload.php'); +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: -use Voucherify\Utils; -``` -Available methods: - -#### Verify Webhook Signature -```php -Utils::verifyWebhookSignature($signature, $message, $secretKey) -``` - ---- - -### Migration from 0.x - -Version 1.x of the PHP is fully backward compatible with version 0.x. -Changes made in version 1.x mostly relate to grouping methods within namespaces. -So all you need to do is to follow the list bellow and just replace deprecated methods -with their namespaced equivalent. - -#### Deprecated methods - -- `$client->vouchers($params)` - [$client->vouchers->getList](#list-vouchers) -- `$client->get($code)` - [$client->vouchers->get](#get-voucher) -- `$client->create($voucher)` - [$client->vouchers->create](#create-voucher) -- `$client->update($voucher_update)` - [$client->vouchers->update](#update-voucher) -- `$client->delete($code, $force)` - [$client->vouchers->delete](#delete-voucher) -- `$client->disable($code)` - [$client->vouchers->disable](#disable-voucher) -- `$client->enable($code)` - [$client->vouchers->enable](#enable-voucher) -- `$client->redemption($code)` - [$client->redemptions->getForVoucher](#get-vouchers-redemptions) -- `$client->publish($campaign_name|$params)` - [$client->distributions->publish](#publish-voucher) -- `$client->redeem($code, $tracking_id|$params)` - [$client->redemptions->redeem](#redeem-voucher) -- `$client->redemptions($params)` - [$client->redemptions->getList](#list-redemptions) -- `$client->rollback($redemption_id, $params)` - [$client->redemptions->rollback](#rollback-redemption) -- `$client->customer->*` - changed namespace to [$client->customers->\*](#customers-api) - ---- -## Error handling - -VoucherifyClient will throw custom `ClientException` object. To get sutructure described in our [API reference](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#errors) please use: -```php -try { - ... -} -catch (ClientException $e) { - $error = $e->getError(); +```json +{ + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" + } + ], + "require": { + "GIT_USER_ID/GIT_REPO_ID": "*@dev" + } } ``` -## Logging - -VoucherifyClient has method `setLogger()` which can be used to set PSR-3 logger interface. - -Set own logger if you want to preview curl request and response data. -```php -$logger = /* Initialaze logger i.e Monolog, Analog */ - -$client = new VoucherifyClient($apiID, $apiKey); -$client->setLogger($logger); -``` - -## Connection Options +Then run `composer install` -Use `setConnectionOptions()` method to set client connection options. +### Manual Installation -Options: -- `timeout` - curl 'CURLOPT_TIMEOUT_MS' -- `connectTimeout` - curl 'CURLOPT_CONNECTTIMEOUT' +Download the files and include `autoload.php`: ```php -$options = [ - "timeout" => 1500, - "connectTimeout" => 2 -]; - -$client = new VoucherifyClient($apiID, $apiKey); -$client->setConnectionOptions($options); +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'); -class Coupons { +// 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'); - public $voucherify; - public function __construct() { - $apiID = "YOUR-APPLICATION-ID"; - $apiKey = "YOUR-CLIENT-SECRET-KEY"; +$apiInstance = new OpenAPI\Client\Api\AsyncActionsApi( + // 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 +); +$asyncActionId = 'asyncActionId_example'; // string | Unique ID of the asynchronous operation. - $this->voucherify = new VoucherifyClient($apiId, $apiKey); - } +try { + $result = $apiInstance->getAsyncAction($asyncActionId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AsyncActionsApi->getAsyncAction: ', $e->getMessage(), PHP_EOL; } -``` - -### Using Voucherify -Load new library and start using voucherify client. -```php -load->library('coupons'); - - $voucherCode = "TEST-VOUCHER-CODE"; - $voucher = $this->coupons->voucherify->get($voucherCode); - - ... - } -} ``` -## Contributing - -Bug reports and pull requests are welcome through [GitHub Issues](https://github.com/rspective/voucherify-php-sdk/issues). - -### Changelog -- **2022-05-16** - `2.2.0` - Add CustomEvents support -- **2022-03-11** - `2.1.0` - Add AsyncActions support and a `$customHeaders` param -- **2019-07-19** - `2.0.0` - Hide API versioning in `$apiUrl` param -- **2018-12-28** - `1.7.10` - Add Validation Rule Assignments -- **2018-03-18** - `1.7.9` - Add Utils with verifyWebhookSignature method -- **2018-02-18** - `1.7.8` - Product delete force option support -- **2018-02-13** - `1.7.7` - Fix Promotions Tiers getAvailable method param -- **2018-02-13** - `1.7.6` - Promotions Tiers getAvailable method -- **2018-02-11** - `1.7.4` - Customers getList method -- **2018-01-14** - `1.7.3` - Promotions API -- **2017-07-24** - `1.7.2` - Fix get publications missing params -- **2017-07-23** - `1.7.1` - Api Client conneciton options -- **2017-07-12** - `1.7.0` - Orders API -- **2017-07-10** - `1.6.2` - PHP autoloading support -- **2017-07-07** - `1.6.1` - Remove Psr/Log dependency -- **2017-06-26** - `1.6.0` - Api Client logger support -- **2017-06-21** - `1.5.0` - Custom API URL support -- **2017-05-02** - `1.4.0` - API Version Header support -- **2017-05-02** - `1.3.0` - Validation rules API, Segments API, Products API -- **2017-04-27** - `1.2.0` - Validations API, Redemptions-Get, Distributions-Export -- **2017-04-26** - `1.1.0` - Campaigns API, Vouchers import method -- **2017-04-19** - `1.0.2` - Unit tests, bug fixes -- **2017-03-17** - `1.0.1` - Vouchers addBalance method -- **2017-02-19** - `1.0.0` - Namespace refectoring -- **2016-09-13** - `0.11.0` - Added new API method for voucher - publish -- **2016-09-13** - `0.10.0` - Added new API method for voucher - delete -- **2016-09-13** - `0.9.1` - Fix to maintain builder pattern. -- **2016-07-20** - `0.9.0` - Voucher code pattern. -- **2016-07-19** - `0.8.0` - Voucher update method. -- **2016-06-23** - `0.7.0` - Gift vouchers. -- **2016-04-27** - `0.6.0` - Added new API methods for customer - create, get, update, delete. -- **2016-04-27** - `0.5.0` - Rollback redemption. -- **2016-04-18** - `0.4.0` - List vouchers. Filter by customer. -- **2016-04-07** - `0.3.0` - List redemptions. -- **2016-04-04** - `0.2.2` - Updated API URL. -- **2016-03-03** - `0.2.1` - Fixed a typo (diasble -> disable). -- **2016-01-21** - `0.2.0` - Added new API methods - create, disable and enable. -- **2015-12-11** - `0.1.1` - New discount model. Added UNIT - a new discount type. -- **2015-12-02** - `0.1.0` - First version: - - Authentication - - Voucher informations: *get*, *redemption* - - Voucher operations: *redeem* - -[Get Async Action]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-async-actions-1 -[List Async Actions]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-async-actions - -[Create Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-voucher -[Get Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#vouchers-get -[Update Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-voucher -[Delete Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-voucher -[List Vouchers]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-vouchers -[Enable Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#enable-voucher -[Disable Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#disable-voucher -[Add balance to Gift-Card Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#add-gift-voucher-balance -[Import Vouchers]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#import-vouchers-1 - -[Create Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-campaign -[Get Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq -[Add Voucher to Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#add-voucher-to-campaign -[Add Voucher with certain code to Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#add-voucher-with-certain-code-to-campaign -[Import Vouchers to Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#import-vouchers -[Delete Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-campaign - -[Publish Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#publish-voucher -[Create Export]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-export -[Get Export]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-export -[Delete Export]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-export -[List Publications]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-publications - -[Validate Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#validate-voucher -[Validate Promotion Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#validate-promotions-1 - -[Redeem Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#redeem-voucher -[Redeem Promotion's Tier]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#redeem-promotion -[Get Redemption]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-redemption -[List Redemptions]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-redemptions -[Get Voucher's Redemptions]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#vouchers-redemptions -[Rollback Redemption]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#rollback-redemption - -[Create Customer]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-customer -[Get Customer]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#read-customer -[Update Customer]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-customer -[Delete Customer]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-customer -[List Customers]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-customers - -[Create Order]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-order -[Get Order]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-order -[Update Order]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-order -[List Orders]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-orders - -[Create Product]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-product -[Get Product]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-product -[List Products]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-products -[Update Product]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-product -[Delete Product]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-product - -[Create SKU]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-sku -[Get SKU]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-sku -[List SKUs]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-skus -[Update SKU]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-sku -[Delete SKU]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-sku - -[Create Validation Rule]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-validation-rules -[Get Validation Rule]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-validation-rules -[List Validation Rules]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-validation-rules -[Update Validation Rule]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-validation-rules -[Delete Validation Rule]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-validation-rules -[Create Validation Rule Assignment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-validation-rules-assignment -[List Validation Rule Assignments]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-validation-rule-assignments -[Delete Validation Rule Assignment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-validation-rules-assignment - -[Create Segment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-segment -[Get Segment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-segment -[Delete Segment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-segment - -[Create Promotion Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-promotion-campaign -[Validate Promotion Campaign]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#validate-promotions-1 -[List Promotion's Tiers]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-promotions -[Create Promotion's Tier]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#add-promotion-tier-to-campaign -[Redeem Promotion's Tier]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#redeem-promotion -[Update Promotion's Tier]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-promotion -[Delete Promotion's Tier]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-promotion -[List Available Promotion Tiers]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#introduction-1 - -[Track Custom Event]: https://docs.voucherify.io/reference/create-custom-event?utm_source=github&utm_medium=sdk&utm_campaign=acq \ No newline at end of file +## API Endpoints + +All URIs are relative to *https://api.voucherify.io* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AsyncActionsApi* | [**getAsyncAction**](docs/Api/AsyncActionsApi.md#getasyncaction) | **GET** /v1/async-actions/{asyncActionId} | Get Async Action +*AsyncActionsApi* | [**listAsyncActions**](docs/Api/AsyncActionsApi.md#listasyncactions) | **GET** /v1/async-actions | List Async Actions +*CampaignsApi* | [**addVoucherWithSpecificCodeToCampaign**](docs/Api/CampaignsApi.md#addvoucherwithspecificcodetocampaign) | **POST** /v1/campaigns/{campaignId}/vouchers/{code} | Add Voucher with Specific Code to Campaign +*CampaignsApi* | [**addVouchersToCampaign**](docs/Api/CampaignsApi.md#addvoucherstocampaign) | **POST** /v1/campaigns/{campaignId}/vouchers | Add Vouchers to Campaign +*CampaignsApi* | [**createCampaign**](docs/Api/CampaignsApi.md#createcampaign) | **POST** /v1/campaigns | Create Campaign +*CampaignsApi* | [**deleteCampaign**](docs/Api/CampaignsApi.md#deletecampaign) | **DELETE** /v1/campaigns/{campaignId} | Delete Campaign +*CampaignsApi* | [**disableCampaign**](docs/Api/CampaignsApi.md#disablecampaign) | **POST** /v1/campaigns/{campaignId}/disable | Disable Campaign +*CampaignsApi* | [**enableCampaign**](docs/Api/CampaignsApi.md#enablecampaign) | **POST** /v1/campaigns/{campaignId}/enable | Enable Campaign +*CampaignsApi* | [**getCampaign**](docs/Api/CampaignsApi.md#getcampaign) | **GET** /v1/campaigns/{campaignId} | Get Campaign +*CampaignsApi* | [**importVouchersToCampaign**](docs/Api/CampaignsApi.md#importvoucherstocampaign) | **POST** /v1/campaigns/{campaignId}/import | Import Vouchers to Campaign +*CampaignsApi* | [**importVouchersToCampaignUsingCsv**](docs/Api/CampaignsApi.md#importvoucherstocampaignusingcsv) | **POST** /v1/campaigns/{campaignId}/importCSV | Import Vouchers to Campaign by CSV +*CampaignsApi* | [**listCampaigns**](docs/Api/CampaignsApi.md#listcampaigns) | **GET** /v1/campaigns | List Campaigns +*CampaignsApi* | [**updateCampaign**](docs/Api/CampaignsApi.md#updatecampaign) | **PUT** /v1/campaigns/{campaignId} | Update Campaign +*CategoriesApi* | [**createCategory**](docs/Api/CategoriesApi.md#createcategory) | **POST** /v1/categories | Create Category +*CategoriesApi* | [**deleteCategory**](docs/Api/CategoriesApi.md#deletecategory) | **DELETE** /v1/categories/{categoryId} | Delete Category +*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* | [**listPromotionTiersClientSide**](docs/Api/ClientSideApi.md#listpromotiontiersclientside) | **GET** /client/v1/promotions/tiers | List Promotion Tiers (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* | [**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 +*CustomersApi* | [**getCustomer**](docs/Api/CustomersApi.md#getcustomer) | **GET** /v1/customers/{customerId} | Get Customer +*CustomersApi* | [**importCustomersUsingCsv**](docs/Api/CustomersApi.md#importcustomersusingcsv) | **POST** /v1/customers/importCSV | Import and Update Customers using CSV +*CustomersApi* | [**listCustomerActivity**](docs/Api/CustomersApi.md#listcustomeractivity) | **GET** /v1/customers/{customerId}/activity | List Customer Activity +*CustomersApi* | [**listCustomerRedeemables**](docs/Api/CustomersApi.md#listcustomerredeemables) | **GET** /v1/customers/{customerId}/redeemables | List Customer's Redeemables +*CustomersApi* | [**listCustomerSegments**](docs/Api/CustomersApi.md#listcustomersegments) | **GET** /v1/customers/{customerId}/segments | List Customer's Segments +*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 [Deprecated] +*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 +*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 +*ExportsApi* | [**getExport**](docs/Api/ExportsApi.md#getexport) | **GET** /v1/exports/{exportId} | Get Export +*ExportsApi* | [**listExports**](docs/Api/ExportsApi.md#listexports) | **GET** /v1/exports | List Exports +*LoyaltiesApi* | [**addMember**](docs/Api/LoyaltiesApi.md#addmember) | **POST** /v1/loyalties/{campaignId}/members | Add Member +*LoyaltiesApi* | [**createEarningRule**](docs/Api/LoyaltiesApi.md#createearningrule) | **POST** /v1/loyalties/{campaignId}/earning-rules | Create Earning Rule +*LoyaltiesApi* | [**createInBulkLoyaltyTiers**](docs/Api/LoyaltiesApi.md#createinbulkloyaltytiers) | **POST** /v1/loyalties/{campaignId}/tiers | Create loyalty tiers +*LoyaltiesApi* | [**createLoyaltyProgram**](docs/Api/LoyaltiesApi.md#createloyaltyprogram) | **POST** /v1/loyalties | Create Loyalty Campaign +*LoyaltiesApi* | [**createPointsExpirationExport**](docs/Api/LoyaltiesApi.md#createpointsexpirationexport) | **POST** /v1/loyalties/{campaignId}/points-expiration/export | Create Points Expiration Export +*LoyaltiesApi* | [**createRewardAssignment1**](docs/Api/LoyaltiesApi.md#createrewardassignment1) | **POST** /v1/loyalties/{campaignId}/rewards | Create Reward Assignment +*LoyaltiesApi* | [**deleteEarningRule**](docs/Api/LoyaltiesApi.md#deleteearningrule) | **DELETE** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Delete Earning Rule +*LoyaltiesApi* | [**deleteLoyaltyProgram**](docs/Api/LoyaltiesApi.md#deleteloyaltyprogram) | **DELETE** /v1/loyalties/{campaignId} | Delete Loyalty Campaign +*LoyaltiesApi* | [**deleteRewardAssignment1**](docs/Api/LoyaltiesApi.md#deleterewardassignment1) | **DELETE** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Delete Reward Assignment +*LoyaltiesApi* | [**disableEarningRule**](docs/Api/LoyaltiesApi.md#disableearningrule) | **POST** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable | Disable Earning Rule +*LoyaltiesApi* | [**enableEarningRule**](docs/Api/LoyaltiesApi.md#enableearningrule) | **POST** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable | Enable Earning Rule +*LoyaltiesApi* | [**exportLoyaltyCardTransactions**](docs/Api/LoyaltiesApi.md#exportloyaltycardtransactions) | **POST** /v1/loyalties/members/{memberId}/transactions/export | Export Loyalty Card Transactions +*LoyaltiesApi* | [**exportLoyaltyCardTransactions1**](docs/Api/LoyaltiesApi.md#exportloyaltycardtransactions1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | Export Loyalty Card Transactions +*LoyaltiesApi* | [**getEarningRule**](docs/Api/LoyaltiesApi.md#getearningrule) | **GET** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Get Earning Rule +*LoyaltiesApi* | [**getLoyaltyProgram**](docs/Api/LoyaltiesApi.md#getloyaltyprogram) | **GET** /v1/loyalties/{campaignId} | Get Loyalty Campaign +*LoyaltiesApi* | [**getLoyaltyTier**](docs/Api/LoyaltiesApi.md#getloyaltytier) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | Get Loyalty Tier +*LoyaltiesApi* | [**getMember**](docs/Api/LoyaltiesApi.md#getmember) | **GET** /v1/loyalties/members/{memberId} | Get Member +*LoyaltiesApi* | [**getMember1**](docs/Api/LoyaltiesApi.md#getmember1) | **GET** /v1/loyalties/{campaignId}/members/{memberId} | Get Member +*LoyaltiesApi* | [**getRewardAssignment1**](docs/Api/LoyaltiesApi.md#getrewardassignment1) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | Get Reward Assignment +*LoyaltiesApi* | [**getRewardAssignment2**](docs/Api/LoyaltiesApi.md#getrewardassignment2) | **GET** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Get Reward Assignment +*LoyaltiesApi* | [**getRewardDetails**](docs/Api/LoyaltiesApi.md#getrewarddetails) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | Get Reward Details +*LoyaltiesApi* | [**listEarningRules**](docs/Api/LoyaltiesApi.md#listearningrules) | **GET** /v1/loyalties/{campaignId}/earning-rules | List Earning Rules +*LoyaltiesApi* | [**listLoyaltyCardTransactions**](docs/Api/LoyaltiesApi.md#listloyaltycardtransactions) | **GET** /v1/loyalties/members/{memberId}/transactions | List Loyalty Card Transactions +*LoyaltiesApi* | [**listLoyaltyCardTransactions1**](docs/Api/LoyaltiesApi.md#listloyaltycardtransactions1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/transactions | List Loyalty Card Transactions +*LoyaltiesApi* | [**listLoyaltyPrograms**](docs/Api/LoyaltiesApi.md#listloyaltyprograms) | **GET** /v1/loyalties | List Loyalty Campaigns +*LoyaltiesApi* | [**listLoyaltyTierEarningRules**](docs/Api/LoyaltiesApi.md#listloyaltytierearningrules) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | List Loyalty Tier Earning Rules +*LoyaltiesApi* | [**listLoyaltyTierRewards**](docs/Api/LoyaltiesApi.md#listloyaltytierrewards) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | List Loyalty Tier Rewards +*LoyaltiesApi* | [**listLoyaltyTiers**](docs/Api/LoyaltiesApi.md#listloyaltytiers) | **GET** /v1/loyalties/{campaignId}/tiers | List Loyalty Tiers +*LoyaltiesApi* | [**listMemberActivity**](docs/Api/LoyaltiesApi.md#listmemberactivity) | **GET** /v1/loyalties/members/{memberId}/activity | List Member Activity +*LoyaltiesApi* | [**listMemberActivity1**](docs/Api/LoyaltiesApi.md#listmemberactivity1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/activity | List Member Activity +*LoyaltiesApi* | [**listMemberLoyaltyTier**](docs/Api/LoyaltiesApi.md#listmemberloyaltytier) | **GET** /v1/loyalties/members/{memberId}/tiers | List Member's Loyalty Tiers +*LoyaltiesApi* | [**listMemberRewards**](docs/Api/LoyaltiesApi.md#listmemberrewards) | **GET** /v1/loyalties/members/{memberId}/rewards | List Member Rewards +*LoyaltiesApi* | [**listMembers**](docs/Api/LoyaltiesApi.md#listmembers) | **GET** /v1/loyalties/{campaignId}/members | List Members +*LoyaltiesApi* | [**listPointsExpiration**](docs/Api/LoyaltiesApi.md#listpointsexpiration) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | Get Points Expiration +*LoyaltiesApi* | [**listRewardAssignments1**](docs/Api/LoyaltiesApi.md#listrewardassignments1) | **GET** /v1/loyalties/{campaignId}/reward-assignments | List Reward Assignments +*LoyaltiesApi* | [**listRewardAssignments2**](docs/Api/LoyaltiesApi.md#listrewardassignments2) | **GET** /v1/loyalties/{campaignId}/rewards | List Reward Assignments +*LoyaltiesApi* | [**redeemReward**](docs/Api/LoyaltiesApi.md#redeemreward) | **POST** /v1/loyalties/members/{memberId}/redemption | Redeem Reward +*LoyaltiesApi* | [**redeemReward1**](docs/Api/LoyaltiesApi.md#redeemreward1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/redemption | Redeem Reward +*LoyaltiesApi* | [**transferPoints**](docs/Api/LoyaltiesApi.md#transferpoints) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transfers | Transfer Loyalty Points +*LoyaltiesApi* | [**updateEarningRule**](docs/Api/LoyaltiesApi.md#updateearningrule) | **PUT** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Update Earning Rule +*LoyaltiesApi* | [**updateLoyaltyCardBalance**](docs/Api/LoyaltiesApi.md#updateloyaltycardbalance) | **POST** /v1/loyalties/members/{memberId}/balance | Add or Remove Loyalty Card Balance +*LoyaltiesApi* | [**updateLoyaltyCardBalance1**](docs/Api/LoyaltiesApi.md#updateloyaltycardbalance1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/balance | Add or Remove Loyalty Card Balance +*LoyaltiesApi* | [**updateLoyaltyProgram**](docs/Api/LoyaltiesApi.md#updateloyaltyprogram) | **PUT** /v1/loyalties/{campaignId} | Update Loyalty Campaign +*LoyaltiesApi* | [**updateRewardAssignment1**](docs/Api/LoyaltiesApi.md#updaterewardassignment1) | **PUT** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Update Reward Assignment +*OrdersApi* | [**createOrder**](docs/Api/OrdersApi.md#createorder) | **POST** /v1/orders | Create Order +*OrdersApi* | [**createOrderExport**](docs/Api/OrdersApi.md#createorderexport) | **POST** /v1/orders/export | Create Orders Export +*OrdersApi* | [**getOrder**](docs/Api/OrdersApi.md#getorder) | **GET** /v1/orders/{orderId} | Get Order +*OrdersApi* | [**importOrders**](docs/Api/OrdersApi.md#importorders) | **POST** /v1/orders/import | Import Orders +*OrdersApi* | [**listOrders**](docs/Api/OrdersApi.md#listorders) | **GET** /v1/orders | List Orders +*OrdersApi* | [**updateOrder**](docs/Api/OrdersApi.md#updateorder) | **PUT** /v1/orders/{orderId} | Update Order +*ProductCollectionsApi* | [**createProductCollection**](docs/Api/ProductCollectionsApi.md#createproductcollection) | **POST** /v1/product-collections | Create Product Collection +*ProductCollectionsApi* | [**deleteProductCollection**](docs/Api/ProductCollectionsApi.md#deleteproductcollection) | **DELETE** /v1/product-collections/{productCollectionId} | Delete Product Collection +*ProductCollectionsApi* | [**getProductCollection**](docs/Api/ProductCollectionsApi.md#getproductcollection) | **GET** /v1/product-collections/{productCollectionId} | Get Product Collection +*ProductCollectionsApi* | [**listProductCollections**](docs/Api/ProductCollectionsApi.md#listproductcollections) | **GET** /v1/product-collections | List Product Collections +*ProductCollectionsApi* | [**listProductsInCollection**](docs/Api/ProductCollectionsApi.md#listproductsincollection) | **GET** /v1/product-collections/{productCollectionId}/products | List Products in Collection +*ProductsApi* | [**createProduct**](docs/Api/ProductsApi.md#createproduct) | **POST** /v1/products | Create Product +*ProductsApi* | [**createSku**](docs/Api/ProductsApi.md#createsku) | **POST** /v1/products/{productId}/skus | Create SKU +*ProductsApi* | [**deleteProduct**](docs/Api/ProductsApi.md#deleteproduct) | **DELETE** /v1/products/{productId} | Delete Product +*ProductsApi* | [**deleteSku**](docs/Api/ProductsApi.md#deletesku) | **DELETE** /v1/products/{productId}/skus/{skuId} | Delete SKU +*ProductsApi* | [**getProduct**](docs/Api/ProductsApi.md#getproduct) | **GET** /v1/products/{productId} | Get Product +*ProductsApi* | [**getSku**](docs/Api/ProductsApi.md#getsku) | **GET** /v1/skus/{skuId} | Get SKU +*ProductsApi* | [**importProductsUsingCsv**](docs/Api/ProductsApi.md#importproductsusingcsv) | **POST** /v1/products/importCSV | Import Products using CSV +*ProductsApi* | [**importSkusUsingCsv**](docs/Api/ProductsApi.md#importskususingcsv) | **POST** /v1/skus/importCSV | Import SKUs using CSV +*ProductsApi* | [**listProducts**](docs/Api/ProductsApi.md#listproducts) | **GET** /v1/products | List Products +*ProductsApi* | [**listSkusInProduct**](docs/Api/ProductsApi.md#listskusinproduct) | **GET** /v1/products/{productId}/skus | List SKUs in Product +*ProductsApi* | [**updateProduct**](docs/Api/ProductsApi.md#updateproduct) | **PUT** /v1/products/{productId} | Update Product +*ProductsApi* | [**updateProductsInBulk**](docs/Api/ProductsApi.md#updateproductsinbulk) | **POST** /v1/products/bulk/async | Update Products in Bulk +*ProductsApi* | [**updateProductsMetadataInBulk**](docs/Api/ProductsApi.md#updateproductsmetadatainbulk) | **POST** /v1/products/metadata/async | Update Products' Metadata in Bulk +*ProductsApi* | [**updateSku**](docs/Api/ProductsApi.md#updatesku) | **PUT** /v1/products/{productId}/skus/{skuId} | Update SKU +*PromotionsApi* | [**addPromotionTierToCampaign**](docs/Api/PromotionsApi.md#addpromotiontiertocampaign) | **POST** /v1/promotions/{campaignId}/tiers | Add Promotion Tier to Campaign +*PromotionsApi* | [**createPromotionStack**](docs/Api/PromotionsApi.md#createpromotionstack) | **POST** /v1/promotions/{campaignId}/stacks | Create Promotion Stack +*PromotionsApi* | [**deletePromotionStack**](docs/Api/PromotionsApi.md#deletepromotionstack) | **DELETE** /v1/promotions/{campaignId}/stacks/{stackId} | Delete Promotion Stack +*PromotionsApi* | [**deletePromotionTier**](docs/Api/PromotionsApi.md#deletepromotiontier) | **DELETE** /v1/promotions/tiers/{promotionTierId} | Delete Promotion Tier +*PromotionsApi* | [**disablePromotionTier**](docs/Api/PromotionsApi.md#disablepromotiontier) | **POST** /v1/promotions/tiers/{promotionTierId}/disable | Disable Promotion Tier +*PromotionsApi* | [**enablePromotionTier**](docs/Api/PromotionsApi.md#enablepromotiontier) | **POST** /v1/promotions/tiers/{promotionTierId}/enable | Enable Promotion Tier +*PromotionsApi* | [**getPromotionStack**](docs/Api/PromotionsApi.md#getpromotionstack) | **GET** /v1/promotions/{campaignId}/stacks/{stackId} | Get Promotion Stack +*PromotionsApi* | [**getPromotionTier**](docs/Api/PromotionsApi.md#getpromotiontier) | **GET** /v1/promotions/tiers/{promotionTierId} | Get Promotion Tier +*PromotionsApi* | [**listAllPromotionStacks**](docs/Api/PromotionsApi.md#listallpromotionstacks) | **GET** /v1/promotions/stacks | List Promotion Stacks +*PromotionsApi* | [**listPromotionStacksInCampaign**](docs/Api/PromotionsApi.md#listpromotionstacksincampaign) | **GET** /v1/promotions/{campaignId}/stacks | List Promotion Stacks in Campaign +*PromotionsApi* | [**listPromotionTiers**](docs/Api/PromotionsApi.md#listpromotiontiers) | **GET** /v1/promotions/tiers | List Promotion Tiers +*PromotionsApi* | [**listPromotionTiersFromCampaign**](docs/Api/PromotionsApi.md#listpromotiontiersfromcampaign) | **GET** /v1/promotions/{campaignId}/tiers | List Promotion Tiers from Campaign +*PromotionsApi* | [**updatePromotionStack**](docs/Api/PromotionsApi.md#updatepromotionstack) | **PUT** /v1/promotions/{campaignId}/stacks/{stackId} | Update Promotion Stack +*PromotionsApi* | [**updatePromotionTier**](docs/Api/PromotionsApi.md#updatepromotiontier) | **PUT** /v1/promotions/tiers/{promotionTierId} | Update Promotion Tier +*PublicationsApi* | [**createPublication**](docs/Api/PublicationsApi.md#createpublication) | **POST** /v1/publications | Create Publication +*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 +*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* | [**createReward**](docs/Api/RewardsApi.md#createreward) | **POST** /v1/rewards | Create Reward +*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 +*RewardsApi* | [**getReward**](docs/Api/RewardsApi.md#getreward) | **GET** /v1/rewards/{rewardId} | Get Reward +*RewardsApi* | [**getRewardAssignment**](docs/Api/RewardsApi.md#getrewardassignment) | **GET** /v1/rewards/{rewardId}/assignments/{assignmentId} | Get Reward Assignment +*RewardsApi* | [**listRewardAssignments**](docs/Api/RewardsApi.md#listrewardassignments) | **GET** /v1/rewards/{rewardId}/assignments | List Reward Assignments +*RewardsApi* | [**listRewards**](docs/Api/RewardsApi.md#listrewards) | **GET** /v1/rewards | List Rewards +*RewardsApi* | [**updateReward**](docs/Api/RewardsApi.md#updatereward) | **PUT** /v1/rewards/{rewardId} | Update Reward +*RewardsApi* | [**updateRewardAssignment**](docs/Api/RewardsApi.md#updaterewardassignment) | **PUT** /v1/rewards/{rewardId}/assignments/{assignmentId} | Update Reward Assignment +*SegmentsApi* | [**createSegment**](docs/Api/SegmentsApi.md#createsegment) | **POST** /v1/segments | Create Segment +*SegmentsApi* | [**deleteSegment**](docs/Api/SegmentsApi.md#deletesegment) | **DELETE** /v1/segments/{segmentId} | Delete Segment +*SegmentsApi* | [**getSegment**](docs/Api/SegmentsApi.md#getsegment) | **GET** /v1/segments/{segmentId} | Get Segment +*ValidationRulesApi* | [**createValidationRuleAssignment**](docs/Api/ValidationRulesApi.md#createvalidationruleassignment) | **POST** /v1/validation-rules/{validationRuleId}/assignments | Create Validation Rules Assignments +*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 +*ValidationRulesApi* | [**getValidationRule**](docs/Api/ValidationRulesApi.md#getvalidationrule) | **GET** /v1/validation-rules/{validationRuleId} | Get Validation Rule +*ValidationRulesApi* | [**listValidationRuleAssignments**](docs/Api/ValidationRulesApi.md#listvalidationruleassignments) | **GET** /v1/validation-rules/{validationRuleId}/assignments | List Validation Rule Assignments +*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* | [**createVoucher**](docs/Api/VouchersApi.md#createvoucher) | **POST** /v1/vouchers/{code} | Create Voucher +*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 +*VouchersApi* | [**exportVoucherTransactions**](docs/Api/VouchersApi.md#exportvouchertransactions) | **POST** /v1/vouchers/{code}/transactions/export | Export Voucher Transactions +*VouchersApi* | [**generateRandomCode**](docs/Api/VouchersApi.md#generaterandomcode) | **POST** /v1/vouchers | Generate Random Code +*VouchersApi* | [**getVoucher**](docs/Api/VouchersApi.md#getvoucher) | **GET** /v1/vouchers/{code} | Get Voucher +*VouchersApi* | [**importVouchers**](docs/Api/VouchersApi.md#importvouchers) | **POST** /v1/vouchers/import | Import Vouchers +*VouchersApi* | [**importVouchersUsingCsv**](docs/Api/VouchersApi.md#importvouchersusingcsv) | **POST** /v1/vouchers/importCSV | Import Vouchers using CSV +*VouchersApi* | [**listVoucherTransactions**](docs/Api/VouchersApi.md#listvouchertransactions) | **GET** /v1/vouchers/{code}/transactions | List Voucher Transactions +*VouchersApi* | [**listVouchers**](docs/Api/VouchersApi.md#listvouchers) | **GET** /v1/vouchers | List Vouchers +*VouchersApi* | [**releaseValidationSession**](docs/Api/VouchersApi.md#releasevalidationsession) | **DELETE** /v1/vouchers/{code}/sessions/{sessionKey} | Release Validation Session +*VouchersApi* | [**updateVoucher**](docs/Api/VouchersApi.md#updatevoucher) | **PUT** /v1/vouchers/{code} | Update Voucher +*VouchersApi* | [**updateVoucherBalance**](docs/Api/VouchersApi.md#updatevoucherbalance) | **POST** /v1/vouchers/{code}/balance | Add or Remove Voucher Balance +*VouchersApi* | [**updateVouchersInBulk**](docs/Api/VouchersApi.md#updatevouchersinbulk) | **POST** /v1/vouchers/bulk/async | Update Vouchers in Bulk +*VouchersApi* | [**updateVouchersMetadataInBulk**](docs/Api/VouchersApi.md#updatevouchersmetadatainbulk) | **POST** /v1/vouchers/metadata/async | Update Vouchers' Metadata in Bulk + +## Models + +- [AccessSettingsCampaignAssignmentsList](docs/Model/AccessSettingsCampaignAssignmentsList.md) +- [ApplicableTo](docs/Model/ApplicableTo.md) +- [ApplicableToResultList](docs/Model/ApplicableToResultList.md) +- [AreaStoreCampaignAssignment](docs/Model/AreaStoreCampaignAssignment.md) +- [AsyncActionBase](docs/Model/AsyncActionBase.md) +- [AsyncActionGetResponseBody](docs/Model/AsyncActionGetResponseBody.md) +- [AsyncActionsListResponseBody](docs/Model/AsyncActionsListResponseBody.md) +- [BusValRuleAssignment](docs/Model/BusValRuleAssignment.md) +- [CampaignBase](docs/Model/CampaignBase.md) +- [CampaignLoyaltyCard](docs/Model/CampaignLoyaltyCard.md) +- [CampaignLoyaltyCardExpirationRules](docs/Model/CampaignLoyaltyCardExpirationRules.md) +- [CampaignLoyaltyVoucher](docs/Model/CampaignLoyaltyVoucher.md) +- [CampaignLoyaltyVoucherRedemption](docs/Model/CampaignLoyaltyVoucherRedemption.md) +- [CampaignVoucher](docs/Model/CampaignVoucher.md) +- [CampaignVoucherRedemption](docs/Model/CampaignVoucherRedemption.md) +- [CampaignsCreateRequestBody](docs/Model/CampaignsCreateRequestBody.md) +- [CampaignsCreateRequestBodyPromotion](docs/Model/CampaignsCreateRequestBodyPromotion.md) +- [CampaignsCreateRequestBodyVoucher](docs/Model/CampaignsCreateRequestBodyVoucher.md) +- [CampaignsCreateRequestBodyVoucherRedemption](docs/Model/CampaignsCreateRequestBodyVoucherRedemption.md) +- [CampaignsCreateResponseBody](docs/Model/CampaignsCreateResponseBody.md) +- [CampaignsDeleteResponseBody](docs/Model/CampaignsDeleteResponseBody.md) +- [CampaignsGetResponseBody](docs/Model/CampaignsGetResponseBody.md) +- [CampaignsImportCreateResponseBody](docs/Model/CampaignsImportCreateResponseBody.md) +- [CampaignsImportCsvCreateResponseBody](docs/Model/CampaignsImportCsvCreateResponseBody.md) +- [CampaignsImportVoucherItem](docs/Model/CampaignsImportVoucherItem.md) +- [CampaignsImportVoucherItemRedemption](docs/Model/CampaignsImportVoucherItemRedemption.md) +- [CampaignsListResponseBody](docs/Model/CampaignsListResponseBody.md) +- [CampaignsUpdateRequestBody](docs/Model/CampaignsUpdateRequestBody.md) +- [CampaignsUpdateRequestBodyOptions](docs/Model/CampaignsUpdateRequestBodyOptions.md) +- [CampaignsUpdateResponseBody](docs/Model/CampaignsUpdateResponseBody.md) +- [CampaignsVouchersCreateCombinedResponseBody](docs/Model/CampaignsVouchersCreateCombinedResponseBody.md) +- [CampaignsVouchersCreateCombinedResponseBodyGift](docs/Model/CampaignsVouchersCreateCombinedResponseBodyGift.md) +- [CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard](docs/Model/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md) +- [CampaignsVouchersCreateCombinedResponseBodyPublish](docs/Model/CampaignsVouchersCreateCombinedResponseBodyPublish.md) +- [CampaignsVouchersCreateCombinedResponseBodyRedemption](docs/Model/CampaignsVouchersCreateCombinedResponseBodyRedemption.md) +- [CampaignsVouchersCreateInBulkRequestBody](docs/Model/CampaignsVouchersCreateInBulkRequestBody.md) +- [CampaignsVouchersCreateInBulkRequestBodyRedemption](docs/Model/CampaignsVouchersCreateInBulkRequestBodyRedemption.md) +- [CampaignsVouchersCreateRequestBody](docs/Model/CampaignsVouchersCreateRequestBody.md) +- [CampaignsVouchersCreateRequestBodyRedemption](docs/Model/CampaignsVouchersCreateRequestBodyRedemption.md) +- [CampaignsVouchersCreateResponseBody](docs/Model/CampaignsVouchersCreateResponseBody.md) +- [CampaignsVouchersCreateResponseBodyGift](docs/Model/CampaignsVouchersCreateResponseBodyGift.md) +- [CampaignsVouchersCreateResponseBodyLoyaltyCard](docs/Model/CampaignsVouchersCreateResponseBodyLoyaltyCard.md) +- [CampaignsVouchersCreateResponseBodyPublish](docs/Model/CampaignsVouchersCreateResponseBodyPublish.md) +- [CampaignsVouchersCreateResponseBodyRedemption](docs/Model/CampaignsVouchersCreateResponseBodyRedemption.md) +- [CategoriesCreateRequestBody](docs/Model/CategoriesCreateRequestBody.md) +- [CategoriesCreateResponseBody](docs/Model/CategoriesCreateResponseBody.md) +- [CategoriesGetResponseBody](docs/Model/CategoriesGetResponseBody.md) +- [CategoriesListResponseBody](docs/Model/CategoriesListResponseBody.md) +- [CategoriesUpdateRequestBody](docs/Model/CategoriesUpdateRequestBody.md) +- [CategoriesUpdateResponseBody](docs/Model/CategoriesUpdateResponseBody.md) +- [Category](docs/Model/Category.md) +- [ClientEventsCreateRequestBody](docs/Model/ClientEventsCreateRequestBody.md) +- [ClientEventsCreateRequestBodyLoyalty](docs/Model/ClientEventsCreateRequestBodyLoyalty.md) +- [ClientEventsCreateRequestBodyReferral](docs/Model/ClientEventsCreateRequestBodyReferral.md) +- [ClientEventsCreateResponseBody](docs/Model/ClientEventsCreateResponseBody.md) +- [ClientPromotionsTiersListResponseBody](docs/Model/ClientPromotionsTiersListResponseBody.md) +- [ClientQualificationsCheckEligibilityRequestBody](docs/Model/ClientQualificationsCheckEligibilityRequestBody.md) +- [ClientQualificationsCheckEligibilityResponseBody](docs/Model/ClientQualificationsCheckEligibilityResponseBody.md) +- [ClientRedemptionsRedeemRequestBody](docs/Model/ClientRedemptionsRedeemRequestBody.md) +- [ClientRedemptionsRedeemRequestBodyOptions](docs/Model/ClientRedemptionsRedeemRequestBodyOptions.md) +- [ClientRedemptionsRedeemRequestBodyRedeemablesItem](docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md) +- [ClientRedemptionsRedeemRequestBodyRedeemablesItemGift](docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md) +- [ClientRedemptionsRedeemRequestBodyRedeemablesItemReward](docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md) +- [ClientRedemptionsRedeemResponseBody](docs/Model/ClientRedemptionsRedeemResponseBody.md) +- [ClientValidationsValidateRequestBody](docs/Model/ClientValidationsValidateRequestBody.md) +- [ClientValidationsValidateRequestBodyOptions](docs/Model/ClientValidationsValidateRequestBodyOptions.md) +- [ClientValidationsValidateRequestBodyRedeemablesItem](docs/Model/ClientValidationsValidateRequestBodyRedeemablesItem.md) +- [ClientValidationsValidateRequestBodyRedeemablesItemGift](docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemGift.md) +- [ClientValidationsValidateRequestBodyRedeemablesItemReward](docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemReward.md) +- [ClientValidationsValidateResponseBody](docs/Model/ClientValidationsValidateResponseBody.md) +- [ClientValidationsValidateResponseBodyRedeemablesItem](docs/Model/ClientValidationsValidateResponseBodyRedeemablesItem.md) +- [ClientValidationsValidateResponseBodyRedeemablesItemResult](docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResult.md) +- [ClientValidationsValidateResponseBodyRedeemablesItemResultDetails](docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md) +- [ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount](docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) +- [ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct](docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) +- [ClientValidationsValidateResponseBodyRedeemablesItemResultGift](docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md) +- [ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard](docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) +- [CodeConfig](docs/Model/CodeConfig.md) +- [CreatePublicationCampaign](docs/Model/CreatePublicationCampaign.md) +- [Customer](docs/Model/Customer.md) +- [CustomerActivity](docs/Model/CustomerActivity.md) +- [CustomerAddress](docs/Model/CustomerAddress.md) +- [CustomerId](docs/Model/CustomerId.md) +- [CustomerLoyalty](docs/Model/CustomerLoyalty.md) +- [CustomerLoyaltyCampaignsEntry](docs/Model/CustomerLoyaltyCampaignsEntry.md) +- [CustomerRedeemable](docs/Model/CustomerRedeemable.md) +- [CustomerRedeemableRedeemable](docs/Model/CustomerRedeemableRedeemable.md) +- [CustomerReferrals](docs/Model/CustomerReferrals.md) +- [CustomerReferralsCampaignsItem](docs/Model/CustomerReferralsCampaignsItem.md) +- [CustomerSummary](docs/Model/CustomerSummary.md) +- [CustomerSummaryOrders](docs/Model/CustomerSummaryOrders.md) +- [CustomerSummaryRedemptions](docs/Model/CustomerSummaryRedemptions.md) +- [CustomerSummaryRedemptionsGift](docs/Model/CustomerSummaryRedemptionsGift.md) +- [CustomerSummaryRedemptionsLoyaltyCard](docs/Model/CustomerSummaryRedemptionsLoyaltyCard.md) +- [CustomerWithSummaryLoyaltyReferrals](docs/Model/CustomerWithSummaryLoyaltyReferrals.md) +- [CustomerWithSummaryLoyaltyReferralsAddress](docs/Model/CustomerWithSummaryLoyaltyReferralsAddress.md) +- [CustomerWithSummaryLoyaltyReferralsAssets](docs/Model/CustomerWithSummaryLoyaltyReferralsAssets.md) +- [CustomersActivityListResponseBody](docs/Model/CustomersActivityListResponseBody.md) +- [CustomersCreateRequestBody](docs/Model/CustomersCreateRequestBody.md) +- [CustomersCreateRequestBodyAddress](docs/Model/CustomersCreateRequestBodyAddress.md) +- [CustomersCreateResponseBody](docs/Model/CustomersCreateResponseBody.md) +- [CustomersCreateResponseBodyAddress](docs/Model/CustomersCreateResponseBodyAddress.md) +- [CustomersCreateResponseBodyAssets](docs/Model/CustomersCreateResponseBodyAssets.md) +- [CustomersGetResponseBody](docs/Model/CustomersGetResponseBody.md) +- [CustomersGetResponseBodyAddress](docs/Model/CustomersGetResponseBodyAddress.md) +- [CustomersGetResponseBodyAssets](docs/Model/CustomersGetResponseBodyAssets.md) +- [CustomersImportCsvCreateResponseBody](docs/Model/CustomersImportCsvCreateResponseBody.md) +- [CustomersListResponseBody](docs/Model/CustomersListResponseBody.md) +- [CustomersMetadataUpdateInBulkRequestBody](docs/Model/CustomersMetadataUpdateInBulkRequestBody.md) +- [CustomersMetadataUpdateInBulkResponseBody](docs/Model/CustomersMetadataUpdateInBulkResponseBody.md) +- [CustomersPermanentDeletionCreateResponseBody](docs/Model/CustomersPermanentDeletionCreateResponseBody.md) +- [CustomersPermanentDeletionCreateResponseBodyDataJson](docs/Model/CustomersPermanentDeletionCreateResponseBodyDataJson.md) +- [CustomersRedeemablesListResponseBody](docs/Model/CustomersRedeemablesListResponseBody.md) +- [CustomersSegmentsListResponseBody](docs/Model/CustomersSegmentsListResponseBody.md) +- [CustomersUpdateInBulkRequestBody](docs/Model/CustomersUpdateInBulkRequestBody.md) +- [CustomersUpdateInBulkRequestBodyAddress](docs/Model/CustomersUpdateInBulkRequestBodyAddress.md) +- [CustomersUpdateInBulkResponseBody](docs/Model/CustomersUpdateInBulkResponseBody.md) +- [CustomersUpdateRequestBody](docs/Model/CustomersUpdateRequestBody.md) +- [CustomersUpdateRequestBodyAddress](docs/Model/CustomersUpdateRequestBodyAddress.md) +- [CustomersUpdateResponseBody](docs/Model/CustomersUpdateResponseBody.md) +- [CustomersUpdateResponseBodyAddress](docs/Model/CustomersUpdateResponseBodyAddress.md) +- [CustomersUpdateResponseBodyAssets](docs/Model/CustomersUpdateResponseBodyAssets.md) +- [Discount](docs/Model/Discount.md) +- [DiscountUnitMultipleOneUnit](docs/Model/DiscountUnitMultipleOneUnit.md) +- [EarningRule](docs/Model/EarningRule.md) +- [EarningRuleCustomEvent](docs/Model/EarningRuleCustomEvent.md) +- [EarningRuleLoyalty](docs/Model/EarningRuleLoyalty.md) +- [EarningRuleLoyaltyCustomEvent](docs/Model/EarningRuleLoyaltyCustomEvent.md) +- [EarningRuleLoyaltyCustomEventMetadata](docs/Model/EarningRuleLoyaltyCustomEventMetadata.md) +- [EarningRuleLoyaltyCustomer](docs/Model/EarningRuleLoyaltyCustomer.md) +- [EarningRuleLoyaltyCustomerMetadata](docs/Model/EarningRuleLoyaltyCustomerMetadata.md) +- [EarningRuleLoyaltyOrder](docs/Model/EarningRuleLoyaltyOrder.md) +- [EarningRuleLoyaltyOrderAmount](docs/Model/EarningRuleLoyaltyOrderAmount.md) +- [EarningRuleLoyaltyOrderItems](docs/Model/EarningRuleLoyaltyOrderItems.md) +- [EarningRuleLoyaltyOrderItemsAmount](docs/Model/EarningRuleLoyaltyOrderItemsAmount.md) +- [EarningRuleLoyaltyOrderItemsQuantity](docs/Model/EarningRuleLoyaltyOrderItemsQuantity.md) +- [EarningRuleLoyaltyOrderItemsSubtotalAmount](docs/Model/EarningRuleLoyaltyOrderItemsSubtotalAmount.md) +- [EarningRuleLoyaltyOrderMetadata](docs/Model/EarningRuleLoyaltyOrderMetadata.md) +- [EarningRuleLoyaltyOrderTotalAmount](docs/Model/EarningRuleLoyaltyOrderTotalAmount.md) +- [EarningRuleLoyaltyTier](docs/Model/EarningRuleLoyaltyTier.md) +- [EarningRuleSegment](docs/Model/EarningRuleSegment.md) +- [EarningRuleSource](docs/Model/EarningRuleSource.md) +- [Error](docs/Model/Error.md) +- [EventsCreateRequestBody](docs/Model/EventsCreateRequestBody.md) +- [EventsCreateRequestBodyLoyalty](docs/Model/EventsCreateRequestBodyLoyalty.md) +- [EventsCreateRequestBodyReferral](docs/Model/EventsCreateRequestBodyReferral.md) +- [EventsCreateResponseBody](docs/Model/EventsCreateResponseBody.md) +- [Export](docs/Model/Export.md) +- [ExportParameters](docs/Model/ExportParameters.md) +- [ExportParametersFilters](docs/Model/ExportParametersFilters.md) +- [ExportResult](docs/Model/ExportResult.md) +- [ExportVoucherTransactionsFilters](docs/Model/ExportVoucherTransactionsFilters.md) +- [ExportsCreateRequestBody](docs/Model/ExportsCreateRequestBody.md) +- [ExportsCreateRequestBodyParameters](docs/Model/ExportsCreateRequestBodyParameters.md) +- [ExportsCreateRequestBodyParametersFilters](docs/Model/ExportsCreateRequestBodyParametersFilters.md) +- [ExportsCreateResponseBody](docs/Model/ExportsCreateResponseBody.md) +- [ExportsCreateResponseBodyParameters](docs/Model/ExportsCreateResponseBodyParameters.md) +- [ExportsCreateResponseBodyParametersFilters](docs/Model/ExportsCreateResponseBodyParametersFilters.md) +- [ExportsGetResponseBody](docs/Model/ExportsGetResponseBody.md) +- [ExportsGetResponseBodyParameters](docs/Model/ExportsGetResponseBodyParameters.md) +- [ExportsGetResponseBodyParametersFilters](docs/Model/ExportsGetResponseBodyParametersFilters.md) +- [ExportsGetResponseBodyResult](docs/Model/ExportsGetResponseBodyResult.md) +- [ExportsListResponseBody](docs/Model/ExportsListResponseBody.md) +- [FieldConditions](docs/Model/FieldConditions.md) +- [FilterConditionsString](docs/Model/FilterConditionsString.md) +- [FiltersCondition](docs/Model/FiltersCondition.md) +- [Gift](docs/Model/Gift.md) +- [InapplicableTo](docs/Model/InapplicableTo.md) +- [InapplicableToResultList](docs/Model/InapplicableToResultList.md) +- [ListPublicationsItemVoucher](docs/Model/ListPublicationsItemVoucher.md) +- [LoyaltiesCreateCampaignRequestBody](docs/Model/LoyaltiesCreateCampaignRequestBody.md) +- [LoyaltiesCreateCampaignResponseBody](docs/Model/LoyaltiesCreateCampaignResponseBody.md) +- [LoyaltiesDeleteResponseBody](docs/Model/LoyaltiesDeleteResponseBody.md) +- [LoyaltiesEarningRulesCreateRequestBodyItem](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItem.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyalty](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemSegment](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md) +- [LoyaltiesEarningRulesCreateRequestBodyItemSource](docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemSource.md) +- [LoyaltiesEarningRulesCreateResponseBody](docs/Model/LoyaltiesEarningRulesCreateResponseBody.md) +- [LoyaltiesEarningRulesCreateResponseBodyCustomEvent](docs/Model/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyalty](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md) +- [LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier](docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md) +- [LoyaltiesEarningRulesCreateResponseBodySegment](docs/Model/LoyaltiesEarningRulesCreateResponseBodySegment.md) +- [LoyaltiesEarningRulesCreateResponseBodySource](docs/Model/LoyaltiesEarningRulesCreateResponseBodySource.md) +- [LoyaltiesEarningRulesDisableResponseBody](docs/Model/LoyaltiesEarningRulesDisableResponseBody.md) +- [LoyaltiesEarningRulesDisableResponseBodyCustomEvent](docs/Model/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyalty](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md) +- [LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier](docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md) +- [LoyaltiesEarningRulesDisableResponseBodySegment](docs/Model/LoyaltiesEarningRulesDisableResponseBodySegment.md) +- [LoyaltiesEarningRulesDisableResponseBodySource](docs/Model/LoyaltiesEarningRulesDisableResponseBodySource.md) +- [LoyaltiesEarningRulesEnableResponseBody](docs/Model/LoyaltiesEarningRulesEnableResponseBody.md) +- [LoyaltiesEarningRulesEnableResponseBodyCustomEvent](docs/Model/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyalty](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md) +- [LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier](docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md) +- [LoyaltiesEarningRulesEnableResponseBodySegment](docs/Model/LoyaltiesEarningRulesEnableResponseBodySegment.md) +- [LoyaltiesEarningRulesEnableResponseBodySource](docs/Model/LoyaltiesEarningRulesEnableResponseBodySource.md) +- [LoyaltiesEarningRulesGetResponseBody](docs/Model/LoyaltiesEarningRulesGetResponseBody.md) +- [LoyaltiesEarningRulesGetResponseBodyCustomEvent](docs/Model/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyalty](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyalty.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md) +- [LoyaltiesEarningRulesGetResponseBodyLoyaltyTier](docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md) +- [LoyaltiesEarningRulesGetResponseBodySegment](docs/Model/LoyaltiesEarningRulesGetResponseBodySegment.md) +- [LoyaltiesEarningRulesGetResponseBodySource](docs/Model/LoyaltiesEarningRulesGetResponseBodySource.md) +- [LoyaltiesEarningRulesListResponseBody](docs/Model/LoyaltiesEarningRulesListResponseBody.md) +- [LoyaltiesEarningRulesUpdateRequestBody](docs/Model/LoyaltiesEarningRulesUpdateRequestBody.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyalty](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md) +- [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount](docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md) +- [LoyaltiesEarningRulesUpdateRequestBodySource](docs/Model/LoyaltiesEarningRulesUpdateRequestBodySource.md) +- [LoyaltiesEarningRulesUpdateResponseBody](docs/Model/LoyaltiesEarningRulesUpdateResponseBody.md) +- [LoyaltiesEarningRulesUpdateResponseBodyCustomEvent](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyalty](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md) +- [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier](docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md) +- [LoyaltiesEarningRulesUpdateResponseBodySegment](docs/Model/LoyaltiesEarningRulesUpdateResponseBodySegment.md) +- [LoyaltiesEarningRulesUpdateResponseBodySource](docs/Model/LoyaltiesEarningRulesUpdateResponseBodySource.md) +- [LoyaltiesGetCampaignResponseBody](docs/Model/LoyaltiesGetCampaignResponseBody.md) +- [LoyaltiesListCampaignsResponseBody](docs/Model/LoyaltiesListCampaignsResponseBody.md) +- [LoyaltiesListMembersResponseBody](docs/Model/LoyaltiesListMembersResponseBody.md) +- [LoyaltiesLoyaltyTierReward](docs/Model/LoyaltiesLoyaltyTierReward.md) +- [LoyaltiesMemberActivityListResponseBody](docs/Model/LoyaltiesMemberActivityListResponseBody.md) +- [LoyaltiesMembersBalanceUpdateRequestBody](docs/Model/LoyaltiesMembersBalanceUpdateRequestBody.md) +- [LoyaltiesMembersBalanceUpdateResponseBody](docs/Model/LoyaltiesMembersBalanceUpdateResponseBody.md) +- [LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject](docs/Model/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md) +- [LoyaltiesMembersCreateRequestBody](docs/Model/LoyaltiesMembersCreateRequestBody.md) +- [LoyaltiesMembersCreateResponseBody](docs/Model/LoyaltiesMembersCreateResponseBody.md) +- [LoyaltiesMembersCreateResponseBodyLoyaltyCard](docs/Model/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md) +- [LoyaltiesMembersCreateResponseBodyPublish](docs/Model/LoyaltiesMembersCreateResponseBodyPublish.md) +- [LoyaltiesMembersCreateResponseBodyRedemption](docs/Model/LoyaltiesMembersCreateResponseBodyRedemption.md) +- [LoyaltiesMembersGetResponseBody](docs/Model/LoyaltiesMembersGetResponseBody.md) +- [LoyaltiesMembersGetResponseBodyLoyaltyCard](docs/Model/LoyaltiesMembersGetResponseBodyLoyaltyCard.md) +- [LoyaltiesMembersGetResponseBodyPublish](docs/Model/LoyaltiesMembersGetResponseBodyPublish.md) +- [LoyaltiesMembersGetResponseBodyRedemption](docs/Model/LoyaltiesMembersGetResponseBodyRedemption.md) +- [LoyaltiesMembersPointsExpirationListResponseBody](docs/Model/LoyaltiesMembersPointsExpirationListResponseBody.md) +- [LoyaltiesMembersPointsExpirationListResponseBodyDataItem](docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md) +- [LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket](docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md) +- [LoyaltiesMembersRedemptionRedeemRequestBody](docs/Model/LoyaltiesMembersRedemptionRedeemRequestBody.md) +- [LoyaltiesMembersRedemptionRedeemRequestBodyReward](docs/Model/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md) +- [LoyaltiesMembersRedemptionRedeemResponseBody](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBody.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyChannel](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyGift](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyVoucher](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md) +- [LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption](docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md) +- [LoyaltiesMembersRewardsListResponseBody](docs/Model/LoyaltiesMembersRewardsListResponseBody.md) +- [LoyaltiesMembersRewardsListResponseBodyDataItem](docs/Model/LoyaltiesMembersRewardsListResponseBodyDataItem.md) +- [LoyaltiesMembersTiersListResponseBody](docs/Model/LoyaltiesMembersTiersListResponseBody.md) +- [LoyaltiesMembersTransactionsExportCreateRequestBody](docs/Model/LoyaltiesMembersTransactionsExportCreateRequestBody.md) +- [LoyaltiesMembersTransactionsExportCreateRequestBodyParameters](docs/Model/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) +- [LoyaltiesMembersTransactionsExportCreateResponseBody](docs/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.md) +- [LoyaltiesMembersTransactionsExportCreateResponseBodyParameters](docs/Model/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md) +- [LoyaltiesMembersTransactionsListResponseBody](docs/Model/LoyaltiesMembersTransactionsListResponseBody.md) +- [LoyaltiesMembersTransfersCreateResponseBody](docs/Model/LoyaltiesMembersTransfersCreateResponseBody.md) +- [LoyaltiesMembersTransfersCreateResponseBodyAssets](docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssets.md) +- [LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode](docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md) +- [LoyaltiesMembersTransfersCreateResponseBodyAssetsQr](docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md) +- [LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard](docs/Model/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md) +- [LoyaltiesMembersTransfersCreateResponseBodyPublish](docs/Model/LoyaltiesMembersTransfersCreateResponseBodyPublish.md) +- [LoyaltiesMembersTransfersCreateResponseBodyRedemption](docs/Model/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md) +- [LoyaltiesPointsExpirationExportCreateRequestBody](docs/Model/LoyaltiesPointsExpirationExportCreateRequestBody.md) +- [LoyaltiesPointsExpirationExportCreateRequestBodyParameters](docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md) +- [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters](docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md) +- [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId](docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md) +- [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions](docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md) +- [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId](docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md) +- [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions](docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md) +- [LoyaltiesPointsExpirationExportCreateResponseBody](docs/Model/LoyaltiesPointsExpirationExportCreateResponseBody.md) +- [LoyaltiesPointsExpirationExportCreateResponseBodyParameters](docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md) +- [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters](docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md) +- [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId](docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md) +- [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions](docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md) +- [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId](docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md) +- [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions](docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md) +- [LoyaltiesRewardAssignmentsGetResponseBody](docs/Model/LoyaltiesRewardAssignmentsGetResponseBody.md) +- [LoyaltiesRewardAssignmentsGetResponseBodyParameters](docs/Model/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md) +- [LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty](docs/Model/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md) +- [LoyaltiesRewardAssignmentsListResponseBody](docs/Model/LoyaltiesRewardAssignmentsListResponseBody.md) +- [LoyaltiesRewardAssignmentsRewardGetResponseBody](docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.md) +- [LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes](docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md) +- [LoyaltiesRewardsCreateAssignmentItemRequestBody](docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBody.md) +- [LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters](docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md) +- [LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty](docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md) +- [LoyaltiesRewardsCreateAssignmentResponseBody](docs/Model/LoyaltiesRewardsCreateAssignmentResponseBody.md) +- [LoyaltiesRewardsCreateAssignmentResponseBodyParameters](docs/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md) +- [LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty](docs/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md) +- [LoyaltiesRewardsGetResponseBody](docs/Model/LoyaltiesRewardsGetResponseBody.md) +- [LoyaltiesRewardsGetResponseBodyParameters](docs/Model/LoyaltiesRewardsGetResponseBodyParameters.md) +- [LoyaltiesRewardsGetResponseBodyParametersLoyalty](docs/Model/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md) +- [LoyaltiesRewardsListAssignmentsResponseBody](docs/Model/LoyaltiesRewardsListAssignmentsResponseBody.md) +- [LoyaltiesRewardsUpdateAssignmentRequestBody](docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBody.md) +- [LoyaltiesRewardsUpdateAssignmentRequestBodyParameters](docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md) +- [LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty](docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md) +- [LoyaltiesRewardsUpdateAssignmentResponseBody](docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBody.md) +- [LoyaltiesRewardsUpdateAssignmentResponseBodyParameters](docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md) +- [LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty](docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md) +- [LoyaltiesTiersCreateInBulkRequestBodyItem](docs/Model/LoyaltiesTiersCreateInBulkRequestBodyItem.md) +- [LoyaltiesTiersEarningRulesListResponseBody](docs/Model/LoyaltiesTiersEarningRulesListResponseBody.md) +- [LoyaltiesTiersGetResponseBody](docs/Model/LoyaltiesTiersGetResponseBody.md) +- [LoyaltiesTiersGetResponseBodyConfig](docs/Model/LoyaltiesTiersGetResponseBodyConfig.md) +- [LoyaltiesTiersGetResponseBodyConfigPoints](docs/Model/LoyaltiesTiersGetResponseBodyConfigPoints.md) +- [LoyaltiesTiersGetResponseBodyPoints](docs/Model/LoyaltiesTiersGetResponseBodyPoints.md) +- [LoyaltiesTiersListResponseBody](docs/Model/LoyaltiesTiersListResponseBody.md) +- [LoyaltiesTiersRewardsListResponseBody](docs/Model/LoyaltiesTiersRewardsListResponseBody.md) +- [LoyaltiesTransferPoints](docs/Model/LoyaltiesTransferPoints.md) +- [LoyaltiesUpdateCampaignRequestBody](docs/Model/LoyaltiesUpdateCampaignRequestBody.md) +- [LoyaltiesUpdateCampaignRequestBodyOptions](docs/Model/LoyaltiesUpdateCampaignRequestBodyOptions.md) +- [LoyaltiesUpdateCampaignResponseBody](docs/Model/LoyaltiesUpdateCampaignResponseBody.md) +- [LoyaltyCampaign](docs/Model/LoyaltyCampaign.md) +- [LoyaltyCampaignVoucher](docs/Model/LoyaltyCampaignVoucher.md) +- [LoyaltyCampaignVoucherRedemption](docs/Model/LoyaltyCampaignVoucherRedemption.md) +- [LoyaltyCardTransaction](docs/Model/LoyaltyCardTransaction.md) +- [LoyaltyCardTransactionDetails](docs/Model/LoyaltyCardTransactionDetails.md) +- [LoyaltyCardTransactionDetailsBalance](docs/Model/LoyaltyCardTransactionDetailsBalance.md) +- [LoyaltyCardTransactionDetailsBalanceRelatedObject](docs/Model/LoyaltyCardTransactionDetailsBalanceRelatedObject.md) +- [LoyaltyCardTransactionDetailsCustomEvent](docs/Model/LoyaltyCardTransactionDetailsCustomEvent.md) +- [LoyaltyCardTransactionDetailsEarningRule](docs/Model/LoyaltyCardTransactionDetailsEarningRule.md) +- [LoyaltyCardTransactionDetailsEarningRuleSource](docs/Model/LoyaltyCardTransactionDetailsEarningRuleSource.md) +- [LoyaltyCardTransactionDetailsEvent](docs/Model/LoyaltyCardTransactionDetailsEvent.md) +- [LoyaltyCardTransactionDetailsEventSchema](docs/Model/LoyaltyCardTransactionDetailsEventSchema.md) +- [LoyaltyCardTransactionDetailsLoyaltyTier](docs/Model/LoyaltyCardTransactionDetailsLoyaltyTier.md) +- [LoyaltyCardTransactionDetailsOrder](docs/Model/LoyaltyCardTransactionDetailsOrder.md) +- [LoyaltyCardTransactionDetailsRedemption](docs/Model/LoyaltyCardTransactionDetailsRedemption.md) +- [LoyaltyCardTransactionDetailsReward](docs/Model/LoyaltyCardTransactionDetailsReward.md) +- [LoyaltyCardTransactionDetailsRollback](docs/Model/LoyaltyCardTransactionDetailsRollback.md) +- [LoyaltyCardTransactionDetailsSegment](docs/Model/LoyaltyCardTransactionDetailsSegment.md) +- [LoyaltyMember](docs/Model/LoyaltyMember.md) +- [LoyaltyMemberLoyaltyCard](docs/Model/LoyaltyMemberLoyaltyCard.md) +- [LoyaltyMemberPublish](docs/Model/LoyaltyMemberPublish.md) +- [LoyaltyMemberRedemption](docs/Model/LoyaltyMemberRedemption.md) +- [LoyaltyTier](docs/Model/LoyaltyTier.md) +- [LoyaltyTierBase](docs/Model/LoyaltyTierBase.md) +- [LoyaltyTierBasePoints](docs/Model/LoyaltyTierBasePoints.md) +- [LoyaltyTierConfig](docs/Model/LoyaltyTierConfig.md) +- [LoyaltyTierConfigPoints](docs/Model/LoyaltyTierConfigPoints.md) +- [LoyaltyTierExpiration](docs/Model/LoyaltyTierExpiration.md) +- [LoyaltyTierPoints](docs/Model/LoyaltyTierPoints.md) +- [LoyaltyTiersExpirationAll](docs/Model/LoyaltyTiersExpirationAll.md) +- [LoyaltyTiersExpirationAllExpirationDate](docs/Model/LoyaltyTiersExpirationAllExpirationDate.md) +- [LoyaltyTiersExpirationAllExpirationDateRounding](docs/Model/LoyaltyTiersExpirationAllExpirationDateRounding.md) +- [LoyaltyTiersExpirationAllStartDate](docs/Model/LoyaltyTiersExpirationAllStartDate.md) +- [LuckyDraw](docs/Model/LuckyDraw.md) +- [MappingPoints](docs/Model/MappingPoints.md) +- [MemberActivity](docs/Model/MemberActivity.md) +- [Order](docs/Model/Order.md) +- [OrderCalculated](docs/Model/OrderCalculated.md) +- [OrderCalculatedItem](docs/Model/OrderCalculatedItem.md) +- [OrderCalculatedItemProduct](docs/Model/OrderCalculatedItemProduct.md) +- [OrderCalculatedItemSku](docs/Model/OrderCalculatedItemSku.md) +- [OrderItem](docs/Model/OrderItem.md) +- [OrderItemProduct](docs/Model/OrderItemProduct.md) +- [OrderItemSku](docs/Model/OrderItemSku.md) +- [OrderRedemptionsEntry](docs/Model/OrderRedemptionsEntry.md) +- [OrdersCreateRequestBody](docs/Model/OrdersCreateRequestBody.md) +- [OrdersCreateResponseBody](docs/Model/OrdersCreateResponseBody.md) +- [OrdersExportCreateRequestBody](docs/Model/OrdersExportCreateRequestBody.md) +- [OrdersExportCreateRequestBodyParameters](docs/Model/OrdersExportCreateRequestBodyParameters.md) +- [OrdersExportCreateResponseBody](docs/Model/OrdersExportCreateResponseBody.md) +- [OrdersExportCreateResponseBodyParameters](docs/Model/OrdersExportCreateResponseBodyParameters.md) +- [OrdersGetResponseBody](docs/Model/OrdersGetResponseBody.md) +- [OrdersImportCreateRequestBodyItem](docs/Model/OrdersImportCreateRequestBodyItem.md) +- [OrdersImportCreateResponseBody](docs/Model/OrdersImportCreateResponseBody.md) +- [OrdersListResponseBody](docs/Model/OrdersListResponseBody.md) +- [OrdersUpdateRequestBody](docs/Model/OrdersUpdateRequestBody.md) +- [OrdersUpdateResponseBody](docs/Model/OrdersUpdateResponseBody.md) +- [ParameterActivityCategory](docs/Model/ParameterActivityCategory.md) +- [ParameterCampaignType](docs/Model/ParameterCampaignType.md) +- [ParameterCreatedBeforeAfter](docs/Model/ParameterCreatedBeforeAfter.md) +- [ParameterExpandListCampaigns](docs/Model/ParameterExpandListCampaigns.md) +- [ParameterFiltersListCustomerRedeemables](docs/Model/ParameterFiltersListCustomerRedeemables.md) +- [ParameterFiltersListCustomerRedeemablesCampaignId](docs/Model/ParameterFiltersListCustomerRedeemablesCampaignId.md) +- [ParameterFiltersListCustomerRedeemablesCampaignType](docs/Model/ParameterFiltersListCustomerRedeemablesCampaignType.md) +- [ParameterFiltersListCustomerRedeemablesCampaignTypeConditions](docs/Model/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md) +- [ParameterFiltersListCustomerRedeemablesCreatedAt](docs/Model/ParameterFiltersListCustomerRedeemablesCreatedAt.md) +- [ParameterFiltersListCustomerRedeemablesCreatedAtConditions](docs/Model/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md) +- [ParameterFiltersListCustomerRedeemablesHolderRole](docs/Model/ParameterFiltersListCustomerRedeemablesHolderRole.md) +- [ParameterFiltersListCustomerRedeemablesHolderRoleConditions](docs/Model/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md) +- [ParameterFiltersListCustomerRedeemablesId](docs/Model/ParameterFiltersListCustomerRedeemablesId.md) +- [ParameterFiltersListCustomerRedeemablesRedeemableId](docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableId.md) +- [ParameterFiltersListCustomerRedeemablesRedeemableObject](docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableObject.md) +- [ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions](docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md) +- [ParameterFiltersListCustomerRedeemablesVoucherType](docs/Model/ParameterFiltersListCustomerRedeemablesVoucherType.md) +- [ParameterFiltersListCustomerRedeemablesVoucherTypeConditions](docs/Model/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md) +- [ParameterFiltersListRedemptions](docs/Model/ParameterFiltersListRedemptions.md) +- [ParameterFiltersListRedemptionsCampaignName](docs/Model/ParameterFiltersListRedemptionsCampaignName.md) +- [ParameterFiltersListRedemptionsCustomerId](docs/Model/ParameterFiltersListRedemptionsCustomerId.md) +- [ParameterFiltersListRedemptionsFailureCode](docs/Model/ParameterFiltersListRedemptionsFailureCode.md) +- [ParameterFiltersListRedemptionsObject](docs/Model/ParameterFiltersListRedemptionsObject.md) +- [ParameterFiltersListRedemptionsParentRedemptionId](docs/Model/ParameterFiltersListRedemptionsParentRedemptionId.md) +- [ParameterFiltersListRedemptionsRelatedObjectId](docs/Model/ParameterFiltersListRedemptionsRelatedObjectId.md) +- [ParameterFiltersListRedemptionsRelatedObjectParentId](docs/Model/ParameterFiltersListRedemptionsRelatedObjectParentId.md) +- [ParameterFiltersListRedemptionsResult](docs/Model/ParameterFiltersListRedemptionsResult.md) +- [ParameterFiltersListRedemptionsUserLogin](docs/Model/ParameterFiltersListRedemptionsUserLogin.md) +- [ParameterFiltersListRedemptionsVoucherCode](docs/Model/ParameterFiltersListRedemptionsVoucherCode.md) +- [ParameterOrder](docs/Model/ParameterOrder.md) +- [ParameterOrderCreatedAt](docs/Model/ParameterOrderCreatedAt.md) +- [ParameterOrderListAllPromotionStacks](docs/Model/ParameterOrderListAllPromotionStacks.md) +- [ParameterOrderListCampaigns](docs/Model/ParameterOrderListCampaigns.md) +- [ParameterOrderListCustomers](docs/Model/ParameterOrderListCustomers.md) +- [ParameterOrderListEarningRules](docs/Model/ParameterOrderListEarningRules.md) +- [ParameterOrderListExports](docs/Model/ParameterOrderListExports.md) +- [ParameterOrderListLoyaltyTiers](docs/Model/ParameterOrderListLoyaltyTiers.md) +- [ParameterOrderListOrders](docs/Model/ParameterOrderListOrders.md) +- [ParameterOrderListPromotionTiers](docs/Model/ParameterOrderListPromotionTiers.md) +- [ParameterOrderListPromotionTiersClientSide](docs/Model/ParameterOrderListPromotionTiersClientSide.md) +- [ParameterOrderListPublications](docs/Model/ParameterOrderListPublications.md) +- [ParameterOrderListRedeemables](docs/Model/ParameterOrderListRedeemables.md) +- [ParameterOrderListRedemptions](docs/Model/ParameterOrderListRedemptions.md) +- [ParameterOrderListValidationRuleAssignments](docs/Model/ParameterOrderListValidationRuleAssignments.md) +- [ParameterOrderListValidationRules](docs/Model/ParameterOrderListValidationRules.md) +- [ParameterOrderVouchers](docs/Model/ParameterOrderVouchers.md) +- [ParameterResultListPublications](docs/Model/ParameterResultListPublications.md) +- [ParameterUpdatedBeforeAfter](docs/Model/ParameterUpdatedBeforeAfter.md) +- [ParameterVoucherTypeListPublications](docs/Model/ParameterVoucherTypeListPublications.md) +- [Product](docs/Model/Product.md) +- [ProductCollectionsCreateRequestBody](docs/Model/ProductCollectionsCreateRequestBody.md) +- [ProductCollectionsCreateRequestBodyFilter](docs/Model/ProductCollectionsCreateRequestBodyFilter.md) +- [ProductCollectionsCreateRequestBodyProductsItem](docs/Model/ProductCollectionsCreateRequestBodyProductsItem.md) +- [ProductCollectionsCreateResponseBody](docs/Model/ProductCollectionsCreateResponseBody.md) +- [ProductCollectionsCreateResponseBodyFilter](docs/Model/ProductCollectionsCreateResponseBodyFilter.md) +- [ProductCollectionsCreateResponseBodyProductsItem](docs/Model/ProductCollectionsCreateResponseBodyProductsItem.md) +- [ProductCollectionsGetResponseBody](docs/Model/ProductCollectionsGetResponseBody.md) +- [ProductCollectionsGetResponseBodyFilter](docs/Model/ProductCollectionsGetResponseBodyFilter.md) +- [ProductCollectionsGetResponseBodyProductsItem](docs/Model/ProductCollectionsGetResponseBodyProductsItem.md) +- [ProductCollectionsItem](docs/Model/ProductCollectionsItem.md) +- [ProductCollectionsItemFilter](docs/Model/ProductCollectionsItemFilter.md) +- [ProductCollectionsItemProductsItem](docs/Model/ProductCollectionsItemProductsItem.md) +- [ProductCollectionsListResponseBody](docs/Model/ProductCollectionsListResponseBody.md) +- [ProductCollectionsProductsListResponseBody](docs/Model/ProductCollectionsProductsListResponseBody.md) +- [ProductCollectionsProductsListResponseBodyDataItem](docs/Model/ProductCollectionsProductsListResponseBodyDataItem.md) +- [ProductWithoutSkus](docs/Model/ProductWithoutSkus.md) +- [ProductsCreateRequestBody](docs/Model/ProductsCreateRequestBody.md) +- [ProductsCreateResponseBody](docs/Model/ProductsCreateResponseBody.md) +- [ProductsGetResponseBody](docs/Model/ProductsGetResponseBody.md) +- [ProductsImportCsvCreateResponseBody](docs/Model/ProductsImportCsvCreateResponseBody.md) +- [ProductsListResponseBody](docs/Model/ProductsListResponseBody.md) +- [ProductsMetadataUpdateInBulkRequestBody](docs/Model/ProductsMetadataUpdateInBulkRequestBody.md) +- [ProductsMetadataUpdateInBulkResponseBody](docs/Model/ProductsMetadataUpdateInBulkResponseBody.md) +- [ProductsSkusCreateRequestBody](docs/Model/ProductsSkusCreateRequestBody.md) +- [ProductsSkusCreateResponseBody](docs/Model/ProductsSkusCreateResponseBody.md) +- [ProductsSkusListResponseBody](docs/Model/ProductsSkusListResponseBody.md) +- [ProductsSkusUpdateRequestBody](docs/Model/ProductsSkusUpdateRequestBody.md) +- [ProductsSkusUpdateResponseBody](docs/Model/ProductsSkusUpdateResponseBody.md) +- [ProductsUpdateInBulkRequestBody](docs/Model/ProductsUpdateInBulkRequestBody.md) +- [ProductsUpdateInBulkResponseBody](docs/Model/ProductsUpdateInBulkResponseBody.md) +- [ProductsUpdateRequestBody](docs/Model/ProductsUpdateRequestBody.md) +- [ProductsUpdateResponseBody](docs/Model/ProductsUpdateResponseBody.md) +- [PromotionStack](docs/Model/PromotionStack.md) +- [PromotionStackBase](docs/Model/PromotionStackBase.md) +- [PromotionStackBaseTiers](docs/Model/PromotionStackBaseTiers.md) +- [PromotionStackTiers](docs/Model/PromotionStackTiers.md) +- [PromotionTier](docs/Model/PromotionTier.md) +- [PromotionTierAction](docs/Model/PromotionTierAction.md) +- [PromotionTierCampaign](docs/Model/PromotionTierCampaign.md) +- [PromotionTierCreateParams](docs/Model/PromotionTierCreateParams.md) +- [PromotionTierCreateParamsAction](docs/Model/PromotionTierCreateParamsAction.md) +- [PromotionTierSummary](docs/Model/PromotionTierSummary.md) +- [PromotionTierSummaryOrders](docs/Model/PromotionTierSummaryOrders.md) +- [PromotionTierSummaryRedemptions](docs/Model/PromotionTierSummaryRedemptions.md) +- [PromotionTiersList](docs/Model/PromotionTiersList.md) +- [PromotionsStacksCreateRequestBody](docs/Model/PromotionsStacksCreateRequestBody.md) +- [PromotionsStacksCreateRequestBodyTiers](docs/Model/PromotionsStacksCreateRequestBodyTiers.md) +- [PromotionsStacksCreateResponseBody](docs/Model/PromotionsStacksCreateResponseBody.md) +- [PromotionsStacksCreateResponseBodyTiers](docs/Model/PromotionsStacksCreateResponseBodyTiers.md) +- [PromotionsStacksGetResponseBody](docs/Model/PromotionsStacksGetResponseBody.md) +- [PromotionsStacksGetResponseBodyTiers](docs/Model/PromotionsStacksGetResponseBodyTiers.md) +- [PromotionsStacksListResponseBody](docs/Model/PromotionsStacksListResponseBody.md) +- [PromotionsStacksUpdateRequestBody](docs/Model/PromotionsStacksUpdateRequestBody.md) +- [PromotionsStacksUpdateRequestBodyTiers](docs/Model/PromotionsStacksUpdateRequestBodyTiers.md) +- [PromotionsStacksUpdateResponseBody](docs/Model/PromotionsStacksUpdateResponseBody.md) +- [PromotionsStacksUpdateResponseBodyTiers](docs/Model/PromotionsStacksUpdateResponseBodyTiers.md) +- [PromotionsTiersCreateRequestBody](docs/Model/PromotionsTiersCreateRequestBody.md) +- [PromotionsTiersCreateRequestBodyAction](docs/Model/PromotionsTiersCreateRequestBodyAction.md) +- [PromotionsTiersCreateResponseBody](docs/Model/PromotionsTiersCreateResponseBody.md) +- [PromotionsTiersCreateResponseBodyAction](docs/Model/PromotionsTiersCreateResponseBodyAction.md) +- [PromotionsTiersCreateResponseBodyCampaign](docs/Model/PromotionsTiersCreateResponseBodyCampaign.md) +- [PromotionsTiersCreateResponseBodySummary](docs/Model/PromotionsTiersCreateResponseBodySummary.md) +- [PromotionsTiersCreateResponseBodySummaryOrders](docs/Model/PromotionsTiersCreateResponseBodySummaryOrders.md) +- [PromotionsTiersCreateResponseBodySummaryRedemptions](docs/Model/PromotionsTiersCreateResponseBodySummaryRedemptions.md) +- [PromotionsTiersDisableResponseBody](docs/Model/PromotionsTiersDisableResponseBody.md) +- [PromotionsTiersDisableResponseBodyAction](docs/Model/PromotionsTiersDisableResponseBodyAction.md) +- [PromotionsTiersDisableResponseBodyCampaign](docs/Model/PromotionsTiersDisableResponseBodyCampaign.md) +- [PromotionsTiersDisableResponseBodySummary](docs/Model/PromotionsTiersDisableResponseBodySummary.md) +- [PromotionsTiersDisableResponseBodySummaryOrders](docs/Model/PromotionsTiersDisableResponseBodySummaryOrders.md) +- [PromotionsTiersDisableResponseBodySummaryRedemptions](docs/Model/PromotionsTiersDisableResponseBodySummaryRedemptions.md) +- [PromotionsTiersEnableResponseBody](docs/Model/PromotionsTiersEnableResponseBody.md) +- [PromotionsTiersEnableResponseBodyAction](docs/Model/PromotionsTiersEnableResponseBodyAction.md) +- [PromotionsTiersEnableResponseBodyCampaign](docs/Model/PromotionsTiersEnableResponseBodyCampaign.md) +- [PromotionsTiersEnableResponseBodySummary](docs/Model/PromotionsTiersEnableResponseBodySummary.md) +- [PromotionsTiersEnableResponseBodySummaryOrders](docs/Model/PromotionsTiersEnableResponseBodySummaryOrders.md) +- [PromotionsTiersEnableResponseBodySummaryRedemptions](docs/Model/PromotionsTiersEnableResponseBodySummaryRedemptions.md) +- [PromotionsTiersGetResponseBody](docs/Model/PromotionsTiersGetResponseBody.md) +- [PromotionsTiersGetResponseBodyAction](docs/Model/PromotionsTiersGetResponseBodyAction.md) +- [PromotionsTiersGetResponseBodyCampaign](docs/Model/PromotionsTiersGetResponseBodyCampaign.md) +- [PromotionsTiersGetResponseBodySummary](docs/Model/PromotionsTiersGetResponseBodySummary.md) +- [PromotionsTiersGetResponseBodySummaryOrders](docs/Model/PromotionsTiersGetResponseBodySummaryOrders.md) +- [PromotionsTiersGetResponseBodySummaryRedemptions](docs/Model/PromotionsTiersGetResponseBodySummaryRedemptions.md) +- [PromotionsTiersListResponseBody](docs/Model/PromotionsTiersListResponseBody.md) +- [PromotionsTiersUpdateRequestBody](docs/Model/PromotionsTiersUpdateRequestBody.md) +- [PromotionsTiersUpdateRequestBodyAction](docs/Model/PromotionsTiersUpdateRequestBodyAction.md) +- [PromotionsTiersUpdateResponseBody](docs/Model/PromotionsTiersUpdateResponseBody.md) +- [PromotionsTiersUpdateResponseBodyAction](docs/Model/PromotionsTiersUpdateResponseBodyAction.md) +- [PromotionsTiersUpdateResponseBodyCampaign](docs/Model/PromotionsTiersUpdateResponseBodyCampaign.md) +- [PromotionsTiersUpdateResponseBodySummary](docs/Model/PromotionsTiersUpdateResponseBodySummary.md) +- [PromotionsTiersUpdateResponseBodySummaryOrders](docs/Model/PromotionsTiersUpdateResponseBodySummaryOrders.md) +- [PromotionsTiersUpdateResponseBodySummaryRedemptions](docs/Model/PromotionsTiersUpdateResponseBodySummaryRedemptions.md) +- [PublicationsCreateRequestBody](docs/Model/PublicationsCreateRequestBody.md) +- [PublicationsCreateRequestBodyCustomer](docs/Model/PublicationsCreateRequestBodyCustomer.md) +- [PublicationsCreateRequestBodyCustomerAddress](docs/Model/PublicationsCreateRequestBodyCustomerAddress.md) +- [PublicationsCreateResponseBody](docs/Model/PublicationsCreateResponseBody.md) +- [PublicationsListResponseBody](docs/Model/PublicationsListResponseBody.md) +- [PublicationsListResponseBodyPublicationsItem](docs/Model/PublicationsListResponseBodyPublicationsItem.md) +- [PublicationsListResponseBodyPublicationsItemMetadata](docs/Model/PublicationsListResponseBodyPublicationsItemMetadata.md) +- [QualificationsCheckEligibilityRequestBody](docs/Model/QualificationsCheckEligibilityRequestBody.md) +- [QualificationsCheckEligibilityResponseBody](docs/Model/QualificationsCheckEligibilityResponseBody.md) +- [QualificationsFieldConditions](docs/Model/QualificationsFieldConditions.md) +- [QualificationsFiltersCondition](docs/Model/QualificationsFiltersCondition.md) +- [QualificationsOption](docs/Model/QualificationsOption.md) +- [QualificationsOptionFilters](docs/Model/QualificationsOptionFilters.md) +- [QualificationsOptionFiltersCampaignType](docs/Model/QualificationsOptionFiltersCampaignType.md) +- [QualificationsOptionFiltersCampaignTypeConditions](docs/Model/QualificationsOptionFiltersCampaignTypeConditions.md) +- [QualificationsOptionFiltersHolderRole](docs/Model/QualificationsOptionFiltersHolderRole.md) +- [QualificationsOptionFiltersHolderRoleConditions](docs/Model/QualificationsOptionFiltersHolderRoleConditions.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) +- [RedeemableGift](docs/Model/RedeemableGift.md) +- [RedeemableLoyaltyCard](docs/Model/RedeemableLoyaltyCard.md) +- [RedeemableResult](docs/Model/RedeemableResult.md) +- [RedeemableVoucher](docs/Model/RedeemableVoucher.md) +- [RedeemableVoucherGift](docs/Model/RedeemableVoucherGift.md) +- [RedeemableVoucherLoyaltyCard](docs/Model/RedeemableVoucherLoyaltyCard.md) +- [RedeemableVoucherPublish](docs/Model/RedeemableVoucherPublish.md) +- [RedeemableVoucherRedemption](docs/Model/RedeemableVoucherRedemption.md) +- [Redemption](docs/Model/Redemption.md) +- [RedemptionChannel](docs/Model/RedemptionChannel.md) +- [RedemptionEntry](docs/Model/RedemptionEntry.md) +- [RedemptionEntryChannel](docs/Model/RedemptionEntryChannel.md) +- [RedemptionEntryCustomer](docs/Model/RedemptionEntryCustomer.md) +- [RedemptionEntryGift](docs/Model/RedemptionEntryGift.md) +- [RedemptionEntryLoyaltyCard](docs/Model/RedemptionEntryLoyaltyCard.md) +- [RedemptionEntryOrder](docs/Model/RedemptionEntryOrder.md) +- [RedemptionEntryOrderCustomer](docs/Model/RedemptionEntryOrderCustomer.md) +- [RedemptionEntryOrderReferrer](docs/Model/RedemptionEntryOrderReferrer.md) +- [RedemptionEntryPromotionTier](docs/Model/RedemptionEntryPromotionTier.md) +- [RedemptionEntryPromotionTierAction](docs/Model/RedemptionEntryPromotionTierAction.md) +- [RedemptionEntryPromotionTierCampaign](docs/Model/RedemptionEntryPromotionTierCampaign.md) +- [RedemptionEntryPromotionTierSummary](docs/Model/RedemptionEntryPromotionTierSummary.md) +- [RedemptionEntryPromotionTierSummaryOrders](docs/Model/RedemptionEntryPromotionTierSummaryOrders.md) +- [RedemptionEntryPromotionTierSummaryRedemptions](docs/Model/RedemptionEntryPromotionTierSummaryRedemptions.md) +- [RedemptionEntryRelatedRedemptions](docs/Model/RedemptionEntryRelatedRedemptions.md) +- [RedemptionEntryRelatedRedemptionsRedemptionsItem](docs/Model/RedemptionEntryRelatedRedemptionsRedemptionsItem.md) +- [RedemptionEntryRelatedRedemptionsRollbacksItem](docs/Model/RedemptionEntryRelatedRedemptionsRollbacksItem.md) +- [RedemptionEntryVoucher](docs/Model/RedemptionEntryVoucher.md) +- [RedemptionEntryVoucherGift](docs/Model/RedemptionEntryVoucherGift.md) +- [RedemptionEntryVoucherLoyaltyCard](docs/Model/RedemptionEntryVoucherLoyaltyCard.md) +- [RedemptionEntryVoucherPublish](docs/Model/RedemptionEntryVoucherPublish.md) +- [RedemptionEntryVoucherRedemption](docs/Model/RedemptionEntryVoucherRedemption.md) +- [RedemptionGift](docs/Model/RedemptionGift.md) +- [RedemptionLoyaltyCard](docs/Model/RedemptionLoyaltyCard.md) +- [RedemptionRelatedRedemptions](docs/Model/RedemptionRelatedRedemptions.md) +- [RedemptionRelatedRedemptionsRedemptionsItem](docs/Model/RedemptionRelatedRedemptionsRedemptionsItem.md) +- [RedemptionRelatedRedemptionsRollbacksItem](docs/Model/RedemptionRelatedRedemptionsRollbacksItem.md) +- [RedemptionRewardResult](docs/Model/RedemptionRewardResult.md) +- [RedemptionRewardResultParameters](docs/Model/RedemptionRewardResultParameters.md) +- [RedemptionRewardResultParametersCampaign](docs/Model/RedemptionRewardResultParametersCampaign.md) +- [RedemptionRewardResultParametersCoin](docs/Model/RedemptionRewardResultParametersCoin.md) +- [RedemptionRewardResultParametersProduct](docs/Model/RedemptionRewardResultParametersProduct.md) +- [RedemptionRollback](docs/Model/RedemptionRollback.md) +- [RedemptionRollbackChannel](docs/Model/RedemptionRollbackChannel.md) +- [RedemptionRollbackGift](docs/Model/RedemptionRollbackGift.md) +- [RedemptionRollbackLoyaltyCard](docs/Model/RedemptionRollbackLoyaltyCard.md) +- [RedemptionRollbackRelatedRedemptions](docs/Model/RedemptionRollbackRelatedRedemptions.md) +- [RedemptionRollbackRelatedRedemptionsRedemptionsItem](docs/Model/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md) +- [RedemptionRollbackRelatedRedemptionsRollbacksItem](docs/Model/RedemptionRollbackRelatedRedemptionsRollbacksItem.md) +- [RedemptionVoucher](docs/Model/RedemptionVoucher.md) +- [RedemptionVoucherGift](docs/Model/RedemptionVoucherGift.md) +- [RedemptionVoucherLoyaltyCard](docs/Model/RedemptionVoucherLoyaltyCard.md) +- [RedemptionVoucherPublish](docs/Model/RedemptionVoucherPublish.md) +- [RedemptionVoucherRedemption](docs/Model/RedemptionVoucherRedemption.md) +- [RedemptionsGetResponseBody](docs/Model/RedemptionsGetResponseBody.md) +- [RedemptionsGetResponseBodyChannel](docs/Model/RedemptionsGetResponseBodyChannel.md) +- [RedemptionsGetResponseBodyCustomer](docs/Model/RedemptionsGetResponseBodyCustomer.md) +- [RedemptionsGetResponseBodyGift](docs/Model/RedemptionsGetResponseBodyGift.md) +- [RedemptionsGetResponseBodyLoyaltyCard](docs/Model/RedemptionsGetResponseBodyLoyaltyCard.md) +- [RedemptionsGetResponseBodyOrder](docs/Model/RedemptionsGetResponseBodyOrder.md) +- [RedemptionsGetResponseBodyOrderCustomer](docs/Model/RedemptionsGetResponseBodyOrderCustomer.md) +- [RedemptionsGetResponseBodyOrderReferrer](docs/Model/RedemptionsGetResponseBodyOrderReferrer.md) +- [RedemptionsGetResponseBodyPromotionTier](docs/Model/RedemptionsGetResponseBodyPromotionTier.md) +- [RedemptionsGetResponseBodyPromotionTierAction](docs/Model/RedemptionsGetResponseBodyPromotionTierAction.md) +- [RedemptionsGetResponseBodyPromotionTierCampaign](docs/Model/RedemptionsGetResponseBodyPromotionTierCampaign.md) +- [RedemptionsGetResponseBodyPromotionTierSummary](docs/Model/RedemptionsGetResponseBodyPromotionTierSummary.md) +- [RedemptionsGetResponseBodyPromotionTierSummaryOrders](docs/Model/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md) +- [RedemptionsGetResponseBodyPromotionTierSummaryRedemptions](docs/Model/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md) +- [RedemptionsGetResponseBodyRelatedRedemptions](docs/Model/RedemptionsGetResponseBodyRelatedRedemptions.md) +- [RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem](docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md) +- [RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem](docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md) +- [RedemptionsGetResponseBodyVoucher](docs/Model/RedemptionsGetResponseBodyVoucher.md) +- [RedemptionsGetResponseBodyVoucherGift](docs/Model/RedemptionsGetResponseBodyVoucherGift.md) +- [RedemptionsGetResponseBodyVoucherLoyaltyCard](docs/Model/RedemptionsGetResponseBodyVoucherLoyaltyCard.md) +- [RedemptionsGetResponseBodyVoucherPublish](docs/Model/RedemptionsGetResponseBodyVoucherPublish.md) +- [RedemptionsGetResponseBodyVoucherRedemption](docs/Model/RedemptionsGetResponseBodyVoucherRedemption.md) +- [RedemptionsListResponseBody](docs/Model/RedemptionsListResponseBody.md) +- [RedemptionsListResponseBodyRedemptionsItem](docs/Model/RedemptionsListResponseBodyRedemptionsItem.md) +- [RedemptionsListResponseBodyRedemptionsItemChannel](docs/Model/RedemptionsListResponseBodyRedemptionsItemChannel.md) +- [RedemptionsListResponseBodyRedemptionsItemCustomer](docs/Model/RedemptionsListResponseBodyRedemptionsItemCustomer.md) +- [RedemptionsListResponseBodyRedemptionsItemGift](docs/Model/RedemptionsListResponseBodyRedemptionsItemGift.md) +- [RedemptionsListResponseBodyRedemptionsItemLoyaltyCard](docs/Model/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md) +- [RedemptionsListResponseBodyRedemptionsItemOrder](docs/Model/RedemptionsListResponseBodyRedemptionsItemOrder.md) +- [RedemptionsListResponseBodyRedemptionsItemOrderCustomer](docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md) +- [RedemptionsListResponseBodyRedemptionsItemOrderReferrer](docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md) +- [RedemptionsListResponseBodyRedemptionsItemPromotionTier](docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md) +- [RedemptionsListResponseBodyRedemptionsItemPromotionTierAction](docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md) +- [RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign](docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md) +- [RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary](docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md) +- [RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders](docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md) +- [RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions](docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md) +- [RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions](docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md) +- [RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem](docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md) +- [RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem](docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md) +- [RedemptionsListResponseBodyRedemptionsItemVoucher](docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucher.md) +- [RedemptionsListResponseBodyRedemptionsItemVoucherGift](docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md) +- [RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard](docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md) +- [RedemptionsListResponseBodyRedemptionsItemVoucherPublish](docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md) +- [RedemptionsListResponseBodyRedemptionsItemVoucherRedemption](docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md) +- [RedemptionsRedeemRequestBody](docs/Model/RedemptionsRedeemRequestBody.md) +- [RedemptionsRedeemRequestBodyOptions](docs/Model/RedemptionsRedeemRequestBodyOptions.md) +- [RedemptionsRedeemRequestBodyRedeemablesItem](docs/Model/RedemptionsRedeemRequestBodyRedeemablesItem.md) +- [RedemptionsRedeemRequestBodyRedeemablesItemGift](docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemGift.md) +- [RedemptionsRedeemRequestBodyRedeemablesItemReward](docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemReward.md) +- [RedemptionsRedeemResponseBody](docs/Model/RedemptionsRedeemResponseBody.md) +- [RedemptionsRollbackCreateRequestBody](docs/Model/RedemptionsRollbackCreateRequestBody.md) +- [RedemptionsRollbackCreateResponseBody](docs/Model/RedemptionsRollbackCreateResponseBody.md) +- [RedemptionsRollbackCreateResponseBodyChannel](docs/Model/RedemptionsRollbackCreateResponseBodyChannel.md) +- [RedemptionsRollbackCreateResponseBodyGift](docs/Model/RedemptionsRollbackCreateResponseBodyGift.md) +- [RedemptionsRollbackCreateResponseBodyLoyaltyCard](docs/Model/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md) +- [RedemptionsRollbackCreateResponseBodyRelatedRedemptions](docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md) +- [RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem](docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md) +- [RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem](docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md) +- [RedemptionsRollbacksCreateRequestBody](docs/Model/RedemptionsRollbacksCreateRequestBody.md) +- [RedemptionsRollbacksCreateResponseBody](docs/Model/RedemptionsRollbacksCreateResponseBody.md) +- [ReferralProgram](docs/Model/ReferralProgram.md) +- [ReferralProgramCustomEvent](docs/Model/ReferralProgramCustomEvent.md) +- [ReferralProgramRefereeReward](docs/Model/ReferralProgramRefereeReward.md) +- [ReferralProgramRefereeRewardRelatedObjectParent](docs/Model/ReferralProgramRefereeRewardRelatedObjectParent.md) +- [Referrer](docs/Model/Referrer.md) +- [ReferrerAddress](docs/Model/ReferrerAddress.md) +- [ReferrerId](docs/Model/ReferrerId.md) +- [Reward](docs/Model/Reward.md) +- [RewardAssignment](docs/Model/RewardAssignment.md) +- [RewardAssignmentParameters](docs/Model/RewardAssignmentParameters.md) +- [RewardAssignmentParametersLoyalty](docs/Model/RewardAssignmentParametersLoyalty.md) +- [RewardAttributes](docs/Model/RewardAttributes.md) +- [RewardType](docs/Model/RewardType.md) +- [RewardTypeCampaign](docs/Model/RewardTypeCampaign.md) +- [RewardTypeCoin](docs/Model/RewardTypeCoin.md) +- [RewardTypeProduct](docs/Model/RewardTypeProduct.md) +- [RewardsAssignmentsCreateRequestBody](docs/Model/RewardsAssignmentsCreateRequestBody.md) +- [RewardsAssignmentsCreateRequestBodyParameters](docs/Model/RewardsAssignmentsCreateRequestBodyParameters.md) +- [RewardsAssignmentsCreateRequestBodyParametersLoyalty](docs/Model/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md) +- [RewardsAssignmentsCreateResponseBody](docs/Model/RewardsAssignmentsCreateResponseBody.md) +- [RewardsAssignmentsCreateResponseBodyParameters](docs/Model/RewardsAssignmentsCreateResponseBodyParameters.md) +- [RewardsAssignmentsCreateResponseBodyParametersLoyalty](docs/Model/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md) +- [RewardsAssignmentsGetResponseBody](docs/Model/RewardsAssignmentsGetResponseBody.md) +- [RewardsAssignmentsGetResponseBodyParameters](docs/Model/RewardsAssignmentsGetResponseBodyParameters.md) +- [RewardsAssignmentsGetResponseBodyParametersLoyalty](docs/Model/RewardsAssignmentsGetResponseBodyParametersLoyalty.md) +- [RewardsAssignmentsListResponseBody](docs/Model/RewardsAssignmentsListResponseBody.md) +- [RewardsAssignmentsUpdateRequestBody](docs/Model/RewardsAssignmentsUpdateRequestBody.md) +- [RewardsAssignmentsUpdateRequestBodyParameters](docs/Model/RewardsAssignmentsUpdateRequestBodyParameters.md) +- [RewardsAssignmentsUpdateRequestBodyParametersLoyalty](docs/Model/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md) +- [RewardsAssignmentsUpdateResponseBody](docs/Model/RewardsAssignmentsUpdateResponseBody.md) +- [RewardsAssignmentsUpdateResponseBodyParameters](docs/Model/RewardsAssignmentsUpdateResponseBodyParameters.md) +- [RewardsAssignmentsUpdateResponseBodyParametersLoyalty](docs/Model/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md) +- [RewardsCreateRequestBody](docs/Model/RewardsCreateRequestBody.md) +- [RewardsCreateRequestBodyAttributes](docs/Model/RewardsCreateRequestBodyAttributes.md) +- [RewardsCreateRequestBodyParameters](docs/Model/RewardsCreateRequestBodyParameters.md) +- [RewardsCreateRequestBodyParametersCampaign](docs/Model/RewardsCreateRequestBodyParametersCampaign.md) +- [RewardsCreateRequestBodyParametersCoin](docs/Model/RewardsCreateRequestBodyParametersCoin.md) +- [RewardsCreateRequestBodyParametersProduct](docs/Model/RewardsCreateRequestBodyParametersProduct.md) +- [RewardsCreateResponseBody](docs/Model/RewardsCreateResponseBody.md) +- [RewardsCreateResponseBodyAttributes](docs/Model/RewardsCreateResponseBodyAttributes.md) +- [RewardsListResponseBody](docs/Model/RewardsListResponseBody.md) +- [RewardsUpdateRequestBody](docs/Model/RewardsUpdateRequestBody.md) +- [RewardsUpdateRequestBodyAttributes](docs/Model/RewardsUpdateRequestBodyAttributes.md) +- [RewardsUpdateRequestBodyParameters](docs/Model/RewardsUpdateRequestBodyParameters.md) +- [RewardsUpdateRequestBodyParametersCampaign](docs/Model/RewardsUpdateRequestBodyParametersCampaign.md) +- [RewardsUpdateRequestBodyParametersCoin](docs/Model/RewardsUpdateRequestBodyParametersCoin.md) +- [RewardsUpdateRequestBodyParametersProduct](docs/Model/RewardsUpdateRequestBodyParametersProduct.md) +- [RewardsUpdateResponseBody](docs/Model/RewardsUpdateResponseBody.md) +- [RewardsUpdateResponseBodyAttributes](docs/Model/RewardsUpdateResponseBodyAttributes.md) +- [SegmentsCreateRequestBody](docs/Model/SegmentsCreateRequestBody.md) +- [SegmentsCreateResponseBody](docs/Model/SegmentsCreateResponseBody.md) +- [SegmentsGetResponseBody](docs/Model/SegmentsGetResponseBody.md) +- [Session](docs/Model/Session.md) +- [SimpleCustomer](docs/Model/SimpleCustomer.md) +- [SimpleCustomerRequiredObjectType](docs/Model/SimpleCustomerRequiredObjectType.md) +- [SimpleLoyaltyCard](docs/Model/SimpleLoyaltyCard.md) +- [SimpleProductDiscountUnit](docs/Model/SimpleProductDiscountUnit.md) +- [SimpleSegment](docs/Model/SimpleSegment.md) +- [SimpleSkuDiscountUnit](docs/Model/SimpleSkuDiscountUnit.md) +- [SimpleVoucher](docs/Model/SimpleVoucher.md) +- [SimpleVoucherRedemption](docs/Model/SimpleVoucherRedemption.md) +- [Sku](docs/Model/Sku.md) +- [SkusGetResponseBody](docs/Model/SkusGetResponseBody.md) +- [SkusImportCsvCreateResponseBody](docs/Model/SkusImportCsvCreateResponseBody.md) +- [SkusListForProduct](docs/Model/SkusListForProduct.md) +- [StackingRules](docs/Model/StackingRules.md) +- [ValidationRule](docs/Model/ValidationRule.md) +- [ValidationRuleApplicableTo](docs/Model/ValidationRuleApplicableTo.md) +- [ValidationRuleAssignment](docs/Model/ValidationRuleAssignment.md) +- [ValidationRuleAssignmentsList](docs/Model/ValidationRuleAssignmentsList.md) +- [ValidationRuleError](docs/Model/ValidationRuleError.md) +- [ValidationRulesAssignmentsCreateRequestBody](docs/Model/ValidationRulesAssignmentsCreateRequestBody.md) +- [ValidationRulesAssignmentsCreateResponseBody](docs/Model/ValidationRulesAssignmentsCreateResponseBody.md) +- [ValidationRulesAssignmentsList](docs/Model/ValidationRulesAssignmentsList.md) +- [ValidationRulesAssignmentsListResponseBody](docs/Model/ValidationRulesAssignmentsListResponseBody.md) +- [ValidationRulesCreateRequestBody](docs/Model/ValidationRulesCreateRequestBody.md) +- [ValidationRulesCreateRequestBodyApplicableTo](docs/Model/ValidationRulesCreateRequestBodyApplicableTo.md) +- [ValidationRulesCreateRequestBodyError](docs/Model/ValidationRulesCreateRequestBodyError.md) +- [ValidationRulesCreateResponseBody](docs/Model/ValidationRulesCreateResponseBody.md) +- [ValidationRulesCreateResponseBodyApplicableTo](docs/Model/ValidationRulesCreateResponseBodyApplicableTo.md) +- [ValidationRulesCreateResponseBodyError](docs/Model/ValidationRulesCreateResponseBodyError.md) +- [ValidationRulesGetResponseBody](docs/Model/ValidationRulesGetResponseBody.md) +- [ValidationRulesGetResponseBodyApplicableTo](docs/Model/ValidationRulesGetResponseBodyApplicableTo.md) +- [ValidationRulesGetResponseBodyError](docs/Model/ValidationRulesGetResponseBodyError.md) +- [ValidationRulesListResponseBody](docs/Model/ValidationRulesListResponseBody.md) +- [ValidationRulesUpdateRequestBody](docs/Model/ValidationRulesUpdateRequestBody.md) +- [ValidationRulesUpdateRequestBodyApplicableTo](docs/Model/ValidationRulesUpdateRequestBodyApplicableTo.md) +- [ValidationRulesUpdateRequestBodyError](docs/Model/ValidationRulesUpdateRequestBodyError.md) +- [ValidationRulesUpdateResponseBody](docs/Model/ValidationRulesUpdateResponseBody.md) +- [ValidationRulesUpdateResponseBodyApplicableTo](docs/Model/ValidationRulesUpdateResponseBodyApplicableTo.md) +- [ValidationRulesUpdateResponseBodyError](docs/Model/ValidationRulesUpdateResponseBodyError.md) +- [ValidationsRedeemableInapplicable](docs/Model/ValidationsRedeemableInapplicable.md) +- [ValidationsRedeemableInapplicableResult](docs/Model/ValidationsRedeemableInapplicableResult.md) +- [ValidationsRedeemableInapplicableResultDetails](docs/Model/ValidationsRedeemableInapplicableResultDetails.md) +- [ValidationsRedeemableSkipped](docs/Model/ValidationsRedeemableSkipped.md) +- [ValidationsRedeemableSkippedResult](docs/Model/ValidationsRedeemableSkippedResult.md) +- [ValidationsRedeemableSkippedResultDetails](docs/Model/ValidationsRedeemableSkippedResultDetails.md) +- [ValidationsValidateRequestBody](docs/Model/ValidationsValidateRequestBody.md) +- [ValidationsValidateRequestBodyOptions](docs/Model/ValidationsValidateRequestBodyOptions.md) +- [ValidationsValidateRequestBodyRedeemablesItem](docs/Model/ValidationsValidateRequestBodyRedeemablesItem.md) +- [ValidationsValidateRequestBodyRedeemablesItemGift](docs/Model/ValidationsValidateRequestBodyRedeemablesItemGift.md) +- [ValidationsValidateRequestBodyRedeemablesItemReward](docs/Model/ValidationsValidateRequestBodyRedeemablesItemReward.md) +- [ValidationsValidateResponseBody](docs/Model/ValidationsValidateResponseBody.md) +- [ValidationsValidateResponseBodyRedeemablesItem](docs/Model/ValidationsValidateResponseBodyRedeemablesItem.md) +- [ValidationsValidateResponseBodyRedeemablesItemResult](docs/Model/ValidationsValidateResponseBodyRedeemablesItemResult.md) +- [ValidationsValidateResponseBodyRedeemablesItemResultDetails](docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md) +- [ValidationsValidateResponseBodyRedeemablesItemResultDiscount](docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) +- [ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct](docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) +- [ValidationsValidateResponseBodyRedeemablesItemResultGift](docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultGift.md) +- [ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard](docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) +- [ValidityHours](docs/Model/ValidityHours.md) +- [ValidityHoursDailyItem](docs/Model/ValidityHoursDailyItem.md) +- [ValidityTimeframe](docs/Model/ValidityTimeframe.md) +- [Voucher](docs/Model/Voucher.md) +- [VoucherAssets](docs/Model/VoucherAssets.md) +- [VoucherAssetsBarcode](docs/Model/VoucherAssetsBarcode.md) +- [VoucherAssetsQr](docs/Model/VoucherAssetsQr.md) +- [VoucherGift](docs/Model/VoucherGift.md) +- [VoucherLoyaltyCard](docs/Model/VoucherLoyaltyCard.md) +- [VoucherPublish](docs/Model/VoucherPublish.md) +- [VoucherRedemption](docs/Model/VoucherRedemption.md) +- [VoucherTransaction](docs/Model/VoucherTransaction.md) +- [VoucherTransactionDetails](docs/Model/VoucherTransactionDetails.md) +- [VoucherTransactionDetailsBalance](docs/Model/VoucherTransactionDetailsBalance.md) +- [VoucherTransactionDetailsBalanceRelatedObject](docs/Model/VoucherTransactionDetailsBalanceRelatedObject.md) +- [VoucherTransactionDetailsCustomEvent](docs/Model/VoucherTransactionDetailsCustomEvent.md) +- [VoucherTransactionDetailsEarningRule](docs/Model/VoucherTransactionDetailsEarningRule.md) +- [VoucherTransactionDetailsEarningRuleSource](docs/Model/VoucherTransactionDetailsEarningRuleSource.md) +- [VoucherTransactionDetailsEvent](docs/Model/VoucherTransactionDetailsEvent.md) +- [VoucherTransactionDetailsEventSchema](docs/Model/VoucherTransactionDetailsEventSchema.md) +- [VoucherTransactionDetailsLoyaltyTier](docs/Model/VoucherTransactionDetailsLoyaltyTier.md) +- [VoucherTransactionDetailsOrder](docs/Model/VoucherTransactionDetailsOrder.md) +- [VoucherTransactionDetailsRedemption](docs/Model/VoucherTransactionDetailsRedemption.md) +- [VoucherTransactionDetailsReward](docs/Model/VoucherTransactionDetailsReward.md) +- [VoucherTransactionDetailsRollback](docs/Model/VoucherTransactionDetailsRollback.md) +- [VoucherTransactionDetailsSegment](docs/Model/VoucherTransactionDetailsSegment.md) +- [VoucherTransactionsExportFilterConditions](docs/Model/VoucherTransactionsExportFilterConditions.md) +- [VoucherTransactionsExportFilterConditionsVoucherId](docs/Model/VoucherTransactionsExportFilterConditionsVoucherId.md) +- [VoucherTransactionsExportFilterConditionsVoucherIdConditions](docs/Model/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md) +- [VoucherTransactionsExportParameters](docs/Model/VoucherTransactionsExportParameters.md) +- [VoucherTransactionsFilters](docs/Model/VoucherTransactionsFilters.md) +- [VoucherWithCategories](docs/Model/VoucherWithCategories.md) +- [VoucherWithCategoriesGift](docs/Model/VoucherWithCategoriesGift.md) +- [VoucherWithCategoriesLoyaltyCard](docs/Model/VoucherWithCategoriesLoyaltyCard.md) +- [VoucherWithCategoriesPublish](docs/Model/VoucherWithCategoriesPublish.md) +- [VoucherWithCategoriesRedemption](docs/Model/VoucherWithCategoriesRedemption.md) +- [VouchersBalanceUpdateRequestBody](docs/Model/VouchersBalanceUpdateRequestBody.md) +- [VouchersBalanceUpdateResponseBody](docs/Model/VouchersBalanceUpdateResponseBody.md) +- [VouchersBalanceUpdateResponseBodyRelatedObject](docs/Model/VouchersBalanceUpdateResponseBodyRelatedObject.md) +- [VouchersCreateResponseBody](docs/Model/VouchersCreateResponseBody.md) +- [VouchersCreateResponseBodyGift](docs/Model/VouchersCreateResponseBodyGift.md) +- [VouchersCreateResponseBodyLoyaltyCard](docs/Model/VouchersCreateResponseBodyLoyaltyCard.md) +- [VouchersCreateResponseBodyPublish](docs/Model/VouchersCreateResponseBodyPublish.md) +- [VouchersCreateResponseBodyRedemption](docs/Model/VouchersCreateResponseBodyRedemption.md) +- [VouchersCreateWithSpecificCodeRequestBody](docs/Model/VouchersCreateWithSpecificCodeRequestBody.md) +- [VouchersCreateWithSpecificCodeRequestBodyRedemption](docs/Model/VouchersCreateWithSpecificCodeRequestBodyRedemption.md) +- [VouchersDisableResponseBody](docs/Model/VouchersDisableResponseBody.md) +- [VouchersDisableResponseBodyGift](docs/Model/VouchersDisableResponseBodyGift.md) +- [VouchersDisableResponseBodyLoyaltyCard](docs/Model/VouchersDisableResponseBodyLoyaltyCard.md) +- [VouchersDisableResponseBodyPublish](docs/Model/VouchersDisableResponseBodyPublish.md) +- [VouchersDisableResponseBodyRedemption](docs/Model/VouchersDisableResponseBodyRedemption.md) +- [VouchersEnableResponseBody](docs/Model/VouchersEnableResponseBody.md) +- [VouchersEnableResponseBodyGift](docs/Model/VouchersEnableResponseBodyGift.md) +- [VouchersEnableResponseBodyLoyaltyCard](docs/Model/VouchersEnableResponseBodyLoyaltyCard.md) +- [VouchersEnableResponseBodyPublish](docs/Model/VouchersEnableResponseBodyPublish.md) +- [VouchersEnableResponseBodyRedemption](docs/Model/VouchersEnableResponseBodyRedemption.md) +- [VouchersGetResponseBody](docs/Model/VouchersGetResponseBody.md) +- [VouchersGetResponseBodyGift](docs/Model/VouchersGetResponseBodyGift.md) +- [VouchersGetResponseBodyLoyaltyCard](docs/Model/VouchersGetResponseBodyLoyaltyCard.md) +- [VouchersGetResponseBodyPublish](docs/Model/VouchersGetResponseBodyPublish.md) +- [VouchersGetResponseBodyRedemption](docs/Model/VouchersGetResponseBodyRedemption.md) +- [VouchersImportCreateItemRequestBody](docs/Model/VouchersImportCreateItemRequestBody.md) +- [VouchersImportCreateItemRequestBodyRedemption](docs/Model/VouchersImportCreateItemRequestBodyRedemption.md) +- [VouchersImportCreateResponseBody](docs/Model/VouchersImportCreateResponseBody.md) +- [VouchersImportCsvCreateResponseBody](docs/Model/VouchersImportCsvCreateResponseBody.md) +- [VouchersListResponseBody](docs/Model/VouchersListResponseBody.md) +- [VouchersMetadataUpdateInBulkRequestBody](docs/Model/VouchersMetadataUpdateInBulkRequestBody.md) +- [VouchersMetadataUpdateInBulkResponseBody](docs/Model/VouchersMetadataUpdateInBulkResponseBody.md) +- [VouchersRedemptionGetResponseBody](docs/Model/VouchersRedemptionGetResponseBody.md) +- [VouchersTransactionsExportCreateRequestBody](docs/Model/VouchersTransactionsExportCreateRequestBody.md) +- [VouchersTransactionsExportCreateResponseBody](docs/Model/VouchersTransactionsExportCreateResponseBody.md) +- [VouchersTransactionsExportCreateResponseBodyResult](docs/Model/VouchersTransactionsExportCreateResponseBodyResult.md) +- [VouchersTransactionsListResponseBody](docs/Model/VouchersTransactionsListResponseBody.md) +- [VouchersUpdateInBulkItemRequestBody](docs/Model/VouchersUpdateInBulkItemRequestBody.md) +- [VouchersUpdateInBulkResponseBody](docs/Model/VouchersUpdateInBulkResponseBody.md) +- [VouchersUpdateRequestBody](docs/Model/VouchersUpdateRequestBody.md) +- [VouchersUpdateResponseBody](docs/Model/VouchersUpdateResponseBody.md) +- [VouchersUpdateResponseBodyGift](docs/Model/VouchersUpdateResponseBodyGift.md) +- [VouchersUpdateResponseBodyLoyaltyCard](docs/Model/VouchersUpdateResponseBodyLoyaltyCard.md) +- [VouchersUpdateResponseBodyPublish](docs/Model/VouchersUpdateResponseBodyPublish.md) +- [VouchersUpdateResponseBodyRedemption](docs/Model/VouchersUpdateResponseBodyRedemption.md) + +## Authorization + +### X-App-Id + +- **Type**: API key +- **API key parameter name**: X-App-Id +- **Location**: HTTP header + + + +### X-App-Token + +- **Type**: API key +- **API key parameter name**: X-App-Token +- **Location**: HTTP header + + + +### X-Client-Token + +- **Type**: API key +- **API key parameter name**: X-Client-Token +- **Location**: HTTP header + + + +### X-Client-Application-Id + +- **Type**: API key +- **API key parameter name**: X-Client-Application-Id +- **Location**: HTTP header + + +## Run local tests with docker + +1. Copy `.env.example` to `.env` and fill in the values. +2. Run `docker build -t php .` to build the image. +3. Run `docker run --rm php` to run the tests and delete container immediately after. + +## Author + +support@voucherify.io + +## About this package + +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: `v2018-08-01` + - Package version: `3.0.0` +- Build package: `org.openapitools.codegen.languages.PhpNextgenClientCodegen` diff --git a/__tests__/Support/AcceptanceTester.php b/__tests__/Support/AcceptanceTester.php new file mode 100644 index 0000000..6ccbabd --- /dev/null +++ b/__tests__/Support/AcceptanceTester.php @@ -0,0 +1,29 @@ +productsApiInstance = Config::productsApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + } + + public function testCreatedProductWithPrice2000AndPrice60000() + { + + $createdProduct = createProduct($this->productsApiInstance, 20000); + $createdProduct2 = createProduct($this->productsApiInstance, 60000); + + $snapshot = 'products/createdProduct'; + $snapshot2 = 'products/createdProduct2'; + $keysToRemove = ['id', 'source_id', 'name', 'created_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + $filteredSnapshot2 = filterSnapshot($snapshot2, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdProduct), 'Error during test with creating product'); + $this->assertTrue(validateDeepMatch($filteredSnapshot2, $createdProduct2), 'Error during test with creating product2'); + + $createdProductJSON = json_decode($createdProduct); + + $this->voucherify->setProduct($createdProductJSON); + $this->voucherify->addProductId($createdProductJSON->source_id); + } + + public function testGetPreviouslyCreatedProduct() + { + $product = getProduct($this->productsApiInstance, $this->voucherify->getProduct()->source_id); + + $snapshot = 'products/createdProduct'; + $keysToRemove = ['id', 'source_id', 'name', 'created_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $product), 'Error during test with getting previously created product'); + } + + public function testUpdatedProductToPrice55000() + { + $updatedProduct = updateProduct($this->productsApiInstance, $this->voucherify->getProduct()->source_id); + + $snapshot = 'products/updatedProduct'; + $keysToRemove = ['id', 'source_id', 'created_at', 'updated_at', 'name']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $updatedProduct), 'Error during test with updating product'); + } + + public function testListedProducts() + { + $products = $this->productsApiInstance->listProducts(2); + $productsJson = json_decode($products); + + $this->assertNotNull($products); + $this->assertGreaterThan(0, count($productsJson->products)); + } + + public function testUpdatedProductsInBulk() + { + $updatedProductsInBulk = updateProductsInBulk($this->productsApiInstance); + + $this->assertNotNull($updatedProductsInBulk); + } + + public function testUpdatedMetadataInBulk() + { + $updatedProductsMetadatas = updateProductsMetadataInBulk($this->productsApiInstance, $this->voucherify->getProductIds()); + + $this->assertNotNull($updatedProductsMetadatas); + } + + public function testAddedSkuToProductWithPrice5000() + { + $createdSku = createSku($this->productsApiInstance, $this->voucherify->getProduct()->source_id, 5000); + + $snapshot = 'products/createdSku'; + $keysToRemove = ['id', 'created_at', 'product_id', 'source_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdSku), 'Error during test with adding sku to product'); + + $createdSkuJSON = json_decode($createdSku); + $this->voucherify->setSku($createdSkuJSON); + } + + public function testUpdatedProductSkuWithPrice2000() + { + $sourceId = $this->voucherify->getProduct()->source_id; + $sku = $this->voucherify->getSku()->source_id; + $updatedSku = updateSku($this->productsApiInstance, $sourceId, $sku, 2000); + + $snapshot = 'products/updatedSku'; + $keysToRemove = ['id', 'source_id', 'product_id', 'created_at', 'updated_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $updatedSku), 'Error during test with updating product sku'); + } + + public function testGetSku() + { + $sku = $this->productsApiInstance->getSku($this->voucherify->getSku()->source_id); + + $snapshot = 'products/getSku'; + $keysToRemove = ['id', 'source_id', 'product_id', 'created_at', 'updated_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $sku), 'Error during test with getting sku'); + } + + public function testListSkusInProduct() + { + $skus = $this->productsApiInstance->listSkusInProduct($this->voucherify->getProduct()->source_id); + + $snapshot = 'products/listedSkusInProducts'; + $keysToRemove = ['id', 'source_id', 'product_id', 'created_at', 'updated_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $skus), 'Error during test with listing skus in product'); + } + + public function testRemoveProductSku() + { + $productId = $this->voucherify->getProduct()->source_id; + $skuId = $this->voucherify->getSku()->source_id; + $deletedSku = deleteSku($this->productsApiInstance, $productId, $skuId); + + $this->assertNull($deletedSku); + } + + public function testRemoveProduct() + { + $productId = $this->voucherify->getProduct()->source_id; + $deletedProduct = deleteProduct($this->productsApiInstance, $productId); + + $this->assertNull($deletedProduct); + } +} diff --git a/__tests__/Unit/02_CampaignsTest.php b/__tests__/Unit/02_CampaignsTest.php new file mode 100644 index 0000000..8d419a7 --- /dev/null +++ b/__tests__/Unit/02_CampaignsTest.php @@ -0,0 +1,141 @@ +campaignsApiInstance = Config::campaignsApiInstance(); + $this->validationRulesApiInstance = Config::validationRulesApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + } + + public function testCreateValidationRuleWithApplicableTo() + { + $createdValidationRule = createValidationRuleApplicableTo($this->validationRulesApiInstance, $this->voucherify->getProduct()->id); + + $snapshot = 'campaigns/createdValidationRuleApplicableTo'; + $keysToRemove = ['name', 'id', 'created_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdValidationRule), 'Error during test with creating validation rule applicable to'); + + $createdValidationRuleJSON = json_decode($createdValidationRule); + $this->voucherify->setValidationRule($createdValidationRuleJSON); + } + + public function testCreateDiscountCampaignWithApplicableToValidationRule() + { + $createdCampaign = createDiscountCampaign($this->campaignsApiInstance, $this->voucherify->getValidationRule()->id); + + $snapshot = 'campaigns/createdDiscountCampaignWithValidationRule'; + $keysToRemove = ['name', 'id', 'created_at', 'rule_id', 'related_object_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdCampaign), 'Error during test with creating discount campaign with applicable validation rule'); + + $createdCampaignJSON = json_decode($createdCampaign); + $this->voucherify->setDiscountCampaign($createdCampaignJSON); + } + + public function testCreatePromotionCampaign() + { + $createdCampaign = createPromotionCampaign($this->campaignsApiInstance); + + $snapshot = 'campaigns/createdPromotionCampaign'; + $keysToRemove = ['name', 'id', 'created_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdCampaign), 'Error during test with creating promotion campaign'); + + $createdCampaignJSON = json_decode($createdCampaign); + $this->voucherify->setPromotionCampaign($createdCampaignJSON); + } + + public function testCreateLoyaltyCampaign() + { + $createdCampaign = createLoyaltyCampaign($this->campaignsApiInstance); + + $snapshot = 'campaigns/createdLoyaltyCampaign'; + $keysToRemove = ['id', 'name', 'created_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdCampaign), 'Error during test with creating loyalty campaign'); + + $createdCampaignJSON = json_decode($createdCampaign); + $this->voucherify->setLoyaltyCampaign($createdCampaignJSON); + } + + public function testDeletePromotionCampaign() + { + $deletedPromotionCampaign = deleteCampaign($this->campaignsApiInstance, $this->voucherify->getPromotionCampaign()->id); + + $this->assertNotNull($deletedPromotionCampaign, 'Error during test with deleting promotion campaign'); + } + + public function testAddVoucherToCampaign() + { + $createdVoucher = addVouchersToCampaign($this->campaignsApiInstance, $this->voucherify->getDiscountCampaign()->id, 1); + $snapshot = 'campaigns/addedVoucherToCampaign'; + $keysToRemove = ['id', 'code', 'campaign', 'campaign_id', 'url', 'created_at', 'rule_id', 'related_object_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdVoucher), 'Error during test with adding voucher to campaign'); + + $createdVoucherJSON = json_decode($createdVoucher); + $this->voucherify->setVoucher($createdVoucherJSON); + } + + public function testCreateBundleOfVouchers() + { + $asyncAction = addVouchersToCampaign($this->campaignsApiInstance, $this->voucherify->getDiscountCampaign()->id, 5); + $snapshot = 'campaigns/createdBundleOfVouchers'; + $keysToRemove = ['async_action_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $asyncAction), 'Error during test with creating bundle of vouchers'); + } + + public function testAddLoyaltyCardToCampaign() + { + $createdLoyaltyCard = addVouchersToCampaign($this->campaignsApiInstance, $this->voucherify->getLoyaltyCampaign()->id, 1); + + $snapshot = 'campaigns/createdLoyaltyCard'; + $keysToRemove = ['id', 'code', 'campaign', 'campaign_id', 'url', 'created_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdLoyaltyCard), 'Error during test with adding loyalty card to campaign'); + + $createdLoyaltyCardJSON = json_decode($createdLoyaltyCard); + $this->voucherify->setLoyaltyCard($createdLoyaltyCardJSON); + } + + public function testCreateCampaignWithValidationRuleMoreThan() + { + $validationRule = createValidationRuleMoreThan($this->validationRulesApiInstance); + $campaign = createDiscountCampaign($this->campaignsApiInstance, $validationRule->getId()); + + $validationRuleSnapshot = 'campaigns/createdValidationRuleMoreThan'; + $campaignSnapshot = 'campaigns/createdDiscountCampaignWithValidationRule'; + $keysToRemove = ['name', 'id', 'created_at', 'rule_id', 'related_object_id']; + $filteredSnapshot = filterSnapshot($validationRuleSnapshot, $keysToRemove); + $filteredSnapshot2 = filterSnapshot($campaignSnapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $validationRule), 'Error during test with creating validation rule more than'); + $this->assertTrue(validateDeepMatch($filteredSnapshot2, $campaign), 'Error during test with creating discount campaign'); + + $voucher = addVouchersToCampaign($this->campaignsApiInstance, $campaign->getId(), 1); + $voucherJSON = json_decode($voucher); + + $this->voucherify->setVoucherWithMoreThanValidationRule($voucherJSON); + } +} diff --git a/__tests__/Unit/03_CustomersTest.php b/__tests__/Unit/03_CustomersTest.php new file mode 100644 index 0000000..d3f4f97 --- /dev/null +++ b/__tests__/Unit/03_CustomersTest.php @@ -0,0 +1,48 @@ +customersApiInstance = Config::customersApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + } + + public function testCreateCustomer() + { + $createdCustomer = createCustomer($this->customersApiInstance); + + $snapshot = 'customers/createdCustomer'; + $keysToRemove = ['id', 'source_id', 'created_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdCustomer), 'Error during test with creating customer'); + + $createdCustomerJSON = json_decode($createdCustomer); + $this->voucherify->setCustomer($createdCustomerJSON); + } + + public function testCreateAndDeleteCustomer() + { + $createdCustomer = createCustomer($this->customersApiInstance); + $deletedCustomer = deleteCustomer($this->customersApiInstance, $createdCustomer->getId()); + + $createdCustomerSnapshot = 'customers/createdCustomer'; + $deletedCustomerSnapshot = 'customers/deletedCustomerPermanently'; + $keysToRemove = ['id', 'source_id', 'created_at', 'related_object_id']; + $filteredSnapshot = filterSnapshot($createdCustomerSnapshot, $keysToRemove); + $filteredSnapshot2 = filterSnapshot($deletedCustomerSnapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdCustomer), 'Error during test with creating customer'); + $this->assertTrue(validateDeepMatch($filteredSnapshot2, $deletedCustomer), 'Error during test with deleting customer permanently'); + } +} diff --git a/__tests__/Unit/04_PublicationsTest.php b/__tests__/Unit/04_PublicationsTest.php new file mode 100644 index 0000000..ac4835b --- /dev/null +++ b/__tests__/Unit/04_PublicationsTest.php @@ -0,0 +1,32 @@ +publicationsApiInstance = Config::publicationsApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + } + + public function testCreatePublications() + { + $campaignName = $this->voucherify->getDiscountCampaign()->id; + $customerId = $this->voucherify->getCustomer()->id; + $createdPublication = createPublication($this->publicationsApiInstance, $customerId, $campaignName); + + $snapshot = 'publications/createdPublication'; + $keysToRemove = ['id', 'created_at', 'customer_id', 'tracking_id', 'source_id', 'vouchers_id', 'code', 'campaign', 'campaign_id', 'url', 'updated_at', 'holder_id', 'referrer_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdPublication), 'Error during test with creating publication'); + } +} diff --git a/__tests__/Unit/05_QualificationsTest.php b/__tests__/Unit/05_QualificationsTest.php new file mode 100644 index 0000000..edfa482 --- /dev/null +++ b/__tests__/Unit/05_QualificationsTest.php @@ -0,0 +1,34 @@ +qualificationsApiInstance = Config::qualificationsApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + } + + public function testCheckEligibility() + { + $customerId = $this->voucherify->getCustomer()->id; + $checkedEligibility = checkEligibility($this->qualificationsApiInstance, $customerId, 5); + + $snapshot = 'qualifications/checkedEligibility'; + $keysToRemove = ['id', 'created_at', 'tracking_id', 'more_starting_after', 'redeemables', 'stacking_rules']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $checkedEligibility), 'Error during test with checking eligibility'); + $this->assertEquals('voucher', $checkedEligibility->getRedeemables()->getData()[0]->getObject()); + $this->assertThat($checkedEligibility->getStackingRules()->getRedeemablesApplicationMode(), $this->logicalOr($this->stringContains('ALL'), $this->stringContains('PARTIAL'))); + $this->assertIsNumeric($checkedEligibility->getStackingRules()->getRedeemablesLimit()); + } +} diff --git a/__tests__/Unit/06_ValidationsTest.php b/__tests__/Unit/06_ValidationsTest.php new file mode 100644 index 0000000..d677176 --- /dev/null +++ b/__tests__/Unit/06_ValidationsTest.php @@ -0,0 +1,52 @@ +validationsApiInstance = Config::validationsApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + $this->voucherCode = $this->voucherify->getVoucher()->code; + $this->productId = $this->voucherify->getProduct()->id; + $this->customer = $this->voucherify->getCustomer(); + } + + public function testCreateValidateStackedApplicableDiscounts() + { + $validationResult = validateStackedDiscounts($this->validationsApiInstance, $this->voucherCode, $this->productId, $this->customer, 20000); + $snapshot = 'validations/validatedStackedApplicableDiscounts'; + $keysToRemove = ['id', 'product_id', 'customer_id', 'tracking_id', 'stacking_rules', 'repeat', 'skip_initially', 'target']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + $this->assertTrue(validateDeepMatch($filteredSnapshot, $validationResult), 'Error during test with creating validate stacked applicable discounts'); + $this->assertThat($validationResult->getStackingRules()->getRedeemablesApplicationMode(), $this->logicalOr($this->stringContains('ALL'), $this->stringContains('PARTIAL'))); + $this->assertIsNumeric($validationResult->getStackingRules()->getRedeemablesLimit()); + } + + + public function testCreateValidateStackedInapplicableDiscounts() + { + $voucherMoreThanValidationRule = $this->voucherify->getVoucherWithMoreThanValidationRule()->code; + $validationResult = validateStackedDiscounts($this->validationsApiInstance, $voucherMoreThanValidationRule, $this->productId, $this->customer, 1000); + + $snapshot = 'validations/validatedStackedInapplicableDiscounts'; + $keysToRemove = ['id', 'details', 'request_id', 'tracking_id', 'stacking_rules', 'redeemables']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $validationResult), 'Error during test with creating validate stacked inapplicable discounts'); + $this->assertIsArray($validationResult->getRedeemables()); + $this->assertThat($validationResult->getStackingRules()->getRedeemablesApplicationMode(), $this->logicalOr($this->stringContains('ALL'), $this->stringContains('PARTIAL'))); + $this->assertIsNumeric($validationResult->getStackingRules()->getRedeemablesLimit()); + } +} diff --git a/__tests__/Unit/07_VouchersTest.php b/__tests__/Unit/07_VouchersTest.php new file mode 100644 index 0000000..82a9afd --- /dev/null +++ b/__tests__/Unit/07_VouchersTest.php @@ -0,0 +1,65 @@ +vouchersApiInstance = Config::vouchersApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + $this->voucherCode = $this->voucherify->getVoucher()->code; + } + + public function testGetPreviouslyCreatedVoucher() + { + $voucher = getVoucher($this->vouchersApiInstance, $this->voucherCode); + + $snapshot = 'vouchers/voucher'; + $keysToRemove = ['id', 'code', 'campaign', 'campaign_id', 'url', 'created_at', 'updated_at', 'holder_id', 'related_object_id', 'rule_id', 'count']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $voucher), 'Error during test with getting previously created voucher'); + } + + public function testDisableVoucher() + { + $disabledVoucher = disableVoucher($this->vouchersApiInstance, $this->voucherCode); + + $snapshot = 'vouchers/disabledVoucher'; + $keysToRemove = ['id', 'code', 'campaign', 'campaign_id', 'url', 'created_at', 'updated_at', 'holder_id', 'related_object_id', 'rule_id', 'count']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $disabledVoucher), 'Error during test with disabling voucher'); + } + + public function testEnableVoucher() + { + $enabledVoucher = enableVoucher($this->vouchersApiInstance, $this->voucherCode); + + $snapshot = 'vouchers/voucher'; + $keysToRemove = ['id', 'code', 'campaign', 'campaign_id', 'url', 'created_at', 'updated_at', 'holder_id', 'related_object_id', 'rule_id', 'count']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $enabledVoucher), 'Error during test with enabling voucher'); + } + + public function testUpdateLoyaltyCardBalance() + { + $updatedLoyaltyCard = updateLoyaltyCardbalance($this->vouchersApiInstance, $this->voucherify->getLoyaltyCard()->code); + + $snapshot = 'vouchers/updatedLoyaltyCardBalance'; + $keysToRemove = ['id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $updatedLoyaltyCard), 'Error during test with updating loyalty card balance'); + } +} diff --git a/__tests__/Unit/08_EventsTest.php b/__tests__/Unit/08_EventsTest.php new file mode 100644 index 0000000..f08ff3e --- /dev/null +++ b/__tests__/Unit/08_EventsTest.php @@ -0,0 +1,28 @@ +eventsApiInstance = Config::eventsApiInstance(); + } + + public function testCreateAndTrackCustomEvent() + { + $createdEvent = createEvent($this->eventsApiInstance); + + $snapshot = 'events/createdEvent'; + $keysToRemove = ['id', 'source_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdEvent), 'Error during test with creating and tracking custom event'); + } +} diff --git a/__tests__/Unit/09_RedemptionsTest.php b/__tests__/Unit/09_RedemptionsTest.php new file mode 100644 index 0000000..611b50d --- /dev/null +++ b/__tests__/Unit/09_RedemptionsTest.php @@ -0,0 +1,48 @@ +redemptionsApiInstance = Config::redemptionsApiInstance(); + $this->campaignsApiInstance = Config::campaignsApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + $this->voucherCode = $this->voucherify->getVoucher()->code; + } + + public function testRedeemStackedApplicableDiscounts() + { + $redemptionResult = redeemStackedDiscounts($this->redemptionsApiInstance, $this->voucherCode); + + $this->assertNotNull($redemptionResult); + $this->assertIsArray($redemptionResult->getRedemptions()); + $this->assertNotEmpty($redemptionResult->getRedemptions()); + $this->assertIsArray($redemptionResult->getSkippedRedeemables()); + $this->assertIsArray($redemptionResult->getInapplicableRedeemables()); + } + + public function testRedeemStackedSkippedDiscounts() + { + $vouchers = generateAndReturnVouchersAddedToCampaign($this->campaignsApiInstance, $this->voucherify->getDiscountCampaign()->id, 30); + $redemptionResult = redeemStackedDiscounts($this->redemptionsApiInstance, $vouchers); + + $this->assertNotNull($redemptionResult); + $this->assertIsArray($redemptionResult->getRedemptions()); + $this->assertNotEmpty($redemptionResult->getRedemptions()); + $this->assertIsArray($redemptionResult->getSkippedRedeemables()); + $this->assertNotEmpty($redemptionResult->getSkippedRedeemables()); + $this->assertIsArray($redemptionResult->getInapplicableRedeemables()); + } +} diff --git a/__tests__/Unit/10_OdersTest.php b/__tests__/Unit/10_OdersTest.php new file mode 100644 index 0000000..6b50dae --- /dev/null +++ b/__tests__/Unit/10_OdersTest.php @@ -0,0 +1,54 @@ +ordersApiInstance = Config::ordersApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + } + + public function testCreateOrder() + { + $createdOrder = createOrder($this->ordersApiInstance, $this->voucherify->getCustomer()->id); + + $snapshot = 'orders/createdOrder'; + $keysToRemove = ['id', 'created_at', 'customer_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdOrder), 'Error during test with creating order'); + + $createdOrderJSON = json_decode($createdOrder); + $this->voucherify->setOrder($createdOrderJSON); + } + + public function testGetPreviouslyStatusCreatedOrder() + { + $order = getOrder($this->ordersApiInstance, $this->voucherify->getOrder()->id); + + $snapshot = 'orders/getOrder'; + $keysToRemove = ['id', 'created_at', 'customer_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $order), 'Error during test with getting previously created order'); + } + + public function testUpdateOrderAsPaid() + { + $updatedOrder = updateOrder($this->ordersApiInstance, $this->voucherify->getOrder()->id); + $snapshot = 'orders/updatedOrder'; + $keysToRemove = ['id', 'created_at', 'customer_id', 'updated_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $updatedOrder), 'Error during test with updating order'); + } +} diff --git a/__tests__/Unit/11_LoyaltiesTest.php b/__tests__/Unit/11_LoyaltiesTest.php new file mode 100644 index 0000000..53db96a --- /dev/null +++ b/__tests__/Unit/11_LoyaltiesTest.php @@ -0,0 +1,43 @@ +loyaltiesApiInstance = Config::loyaltiesApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + $this->loyaltyCardCode = $this->voucherify->getLoyaltyCard()->code; + } + + public function testUpdateLoyaltyMemberCardBalanceBy1000Points() + { + $updatedLoyaltyCard = updateLoyaltyMemberCardbalance($this->loyaltiesApiInstance, $this->loyaltyCardCode); + + $snapshot = 'loyalties/updatedLoyaltyMemberCardBalanceBy1000Points'; + $keysToRemove = ['id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $updatedLoyaltyCard), 'Error during test with updating loyalty member card balance'); + } + + public function testListLoyaltyMemberCardTransactions() + { + $transactions = listLoyaltyMemberCardTransactions($this->loyaltiesApiInstance, $this->loyaltyCardCode); + + $snapshot = 'loyalties/listedLoyaltyMemberCardTransactions'; + $keysToRemove = ['id', 'voucher_id', 'campaign_id', 'created_at', 'campaign_id', 'source_id']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $transactions), 'Error during test with listing loyalty member card transactions'); + } +} diff --git a/__tests__/Unit/12_ValidationRulesTest.php b/__tests__/Unit/12_ValidationRulesTest.php new file mode 100644 index 0000000..1cb47ef --- /dev/null +++ b/__tests__/Unit/12_ValidationRulesTest.php @@ -0,0 +1,32 @@ +validationRulesApiInstance = Config::validationRulesApiInstance(); + $this->voucherify = VoucherifyData::getInstance(); + } + + public function testCreateValidationRule() + { + $validationRuleId = $this->voucherify->getValidationRule()->id; + $voucherCode = $this->voucherify->getVoucher()->code; + $createdValRule = createValidationRuleAssignment($this->validationRulesApiInstance, $validationRuleId, $voucherCode); + + $snapshot = 'validationRules/createdValidationRule'; + $keysToRemove = ['id', 'rule_id', 'related_object_id', 'created_at']; + $filteredSnapshot = filterSnapshot($snapshot, $keysToRemove); + + $this->assertTrue(validateDeepMatch($filteredSnapshot, $createdValRule), 'Error during test with creating validation rule'); + } +} diff --git a/__tests__/_generated/UnitTesterActions.php b/__tests__/_generated/UnitTesterActions.php new file mode 100644 index 0000000..e52e04e --- /dev/null +++ b/__tests__/_generated/UnitTesterActions.php @@ -0,0 +1,1701 @@ +expectThrowable(MyThrowable::class, function() { + * $this->doSomethingBad(); + * }); + * + * $I->expectThrowable(new MyException(), function() { + * $this->doSomethingBad(); + * }); + * ``` + * If you want to check message or throwable code, you can pass them with throwable instance: + * ```php + * expectThrowable(new MyError("Don't do bad things"), function() { + * $this->doSomethingBad(); + * }); + * ``` + * + * @param \Throwable|string $throwable + * @see \Codeception\Module\Asserts::expectThrowable() + */ + public function expectThrowable($throwable, callable $callback): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('expectThrowable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file does not exist. + * @see \Codeception\Module\AbstractAsserts::assertFileNotExists() + */ + public function assertFileNotExists(string $filename, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a value is greater than or equal to another value. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertGreaterOrEquals() + */ + public function assertGreaterOrEquals($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is empty. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsEmpty() + */ + public function assertIsEmpty($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a value is smaller than or equal to another value. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertLessOrEquals() + */ + public function assertLessOrEquals($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string does not match a given regular expression. + * @see \Codeception\Module\AbstractAsserts::assertNotRegExp() + */ + public function assertNotRegExp(string $pattern, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string matches a given regular expression. + * @see \Codeception\Module\AbstractAsserts::assertRegExp() + */ + public function assertRegExp(string $pattern, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Evaluates a PHPUnit\Framework\Constraint matcher object. + * + * @param mixed $value + * @see \Codeception\Module\AbstractAsserts::assertThatItsNot() + */ + public function assertThatItsNot($value, \PHPUnit\Framework\Constraint\Constraint $constraint, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertThatItsNot', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that an array has a specified key. + * + * @param int|string $key + * @param array|\ArrayAccess $array + * @see \Codeception\Module\AbstractAsserts::assertArrayHasKey() + */ + public function assertArrayHasKey($key, $array, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that an array does not have a specified key. + * + * @param int|string $key + * @param array|\ArrayAccess $array + * @see \Codeception\Module\AbstractAsserts::assertArrayNotHasKey() + */ + public function assertArrayNotHasKey($key, $array, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a class has a specified attribute. + * @see \Codeception\Module\AbstractAsserts::assertClassHasAttribute() + */ + public function assertClassHasAttribute(string $attributeName, string $className, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertClassHasAttribute', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a class has a specified static attribute. + * @see \Codeception\Module\AbstractAsserts::assertClassHasStaticAttribute() + */ + public function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertClassHasStaticAttribute', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a class does not have a specified attribute. + * @see \Codeception\Module\AbstractAsserts::assertClassNotHasAttribute() + */ + public function assertClassNotHasAttribute(string $attributeName, string $className, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertClassNotHasAttribute', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a class does not have a specified static attribute. + * @see \Codeception\Module\AbstractAsserts::assertClassNotHasStaticAttribute() + */ + public function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertClassNotHasStaticAttribute', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a haystack contains a needle. + * + * @param mixed $needle + * @see \Codeception\Module\AbstractAsserts::assertContains() + */ + public function assertContains($needle, iterable $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @param mixed $needle + * @see \Codeception\Module\AbstractAsserts::assertContainsEquals() + */ + public function assertContainsEquals($needle, iterable $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContainsEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a haystack contains only values of a given type. + * @see \Codeception\Module\AbstractAsserts::assertContainsOnly() + */ + public function assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = NULL, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContainsOnly', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a haystack contains only instances of a given class name. + * @see \Codeception\Module\AbstractAsserts::assertContainsOnlyInstancesOf() + */ + public function assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContainsOnlyInstancesOf', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param \Countable|iterable $haystack + * @see \Codeception\Module\AbstractAsserts::assertCount() + */ + public function assertCount(int $expectedCount, $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a directory does not exist. + * @see \Codeception\Module\AbstractAsserts::assertDirectoryDoesNotExist() + */ + public function assertDirectoryDoesNotExist(string $directory, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertDirectoryDoesNotExist', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a directory exists. + * @see \Codeception\Module\AbstractAsserts::assertDirectoryExists() + */ + public function assertDirectoryExists(string $directory, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertDirectoryExists', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a directory exists and is not readable. + * @see \Codeception\Module\AbstractAsserts::assertDirectoryIsNotReadable() + */ + public function assertDirectoryIsNotReadable(string $directory, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertDirectoryIsNotReadable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a directory exists and is not writable. + * @see \Codeception\Module\AbstractAsserts::assertDirectoryIsNotWritable() + */ + public function assertDirectoryIsNotWritable(string $directory, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertDirectoryIsNotWritable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a directory exists and is readable. + * @see \Codeception\Module\AbstractAsserts::assertDirectoryIsReadable() + */ + public function assertDirectoryIsReadable(string $directory, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertDirectoryIsReadable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a directory exists and is writable. + * @see \Codeception\Module\AbstractAsserts::assertDirectoryIsWritable() + */ + public function assertDirectoryIsWritable(string $directory, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertDirectoryIsWritable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string does not match a given regular expression. + * @see \Codeception\Module\AbstractAsserts::assertDoesNotMatchRegularExpression() + */ + public function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertDoesNotMatchRegularExpression', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is empty. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertEmpty() + */ + public function assertEmpty($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables are equal. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertEquals() + */ + public function assertEquals($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables are equal (canonicalizing). + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertEqualsCanonicalizing() + */ + public function assertEqualsCanonicalizing($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEqualsCanonicalizing', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables are equal (ignoring case). + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertEqualsIgnoringCase() + */ + public function assertEqualsIgnoringCase($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEqualsIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables are equal (with delta). + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertEqualsWithDelta() + */ + public function assertEqualsWithDelta($expected, $actual, float $delta, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEqualsWithDelta', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a condition is false. + * + * @param mixed $condition + * @see \Codeception\Module\AbstractAsserts::assertFalse() + */ + public function assertFalse($condition, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file does not exist. + * @see \Codeception\Module\AbstractAsserts::assertFileDoesNotExist() + */ + public function assertFileDoesNotExist(string $filename, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileDoesNotExist', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of one file is equal to the contents of another file. + * @see \Codeception\Module\AbstractAsserts::assertFileEquals() + */ + public function assertFileEquals(string $expected, string $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of one file is equal to the contents of another file (canonicalizing). + * @see \Codeception\Module\AbstractAsserts::assertFileEqualsCanonicalizing() + */ + public function assertFileEqualsCanonicalizing(string $expected, string $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileEqualsCanonicalizing', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of one file is equal to the contents of another file (ignoring case). + * @see \Codeception\Module\AbstractAsserts::assertFileEqualsIgnoringCase() + */ + public function assertFileEqualsIgnoringCase(string $expected, string $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileEqualsIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file exists. + * @see \Codeception\Module\AbstractAsserts::assertFileExists() + */ + public function assertFileExists(string $filename, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file exists and is not readable. + * @see \Codeception\Module\AbstractAsserts::assertFileIsNotReadable() + */ + public function assertFileIsNotReadable(string $file, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileIsNotReadable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file exists and is not writable. + * @see \Codeception\Module\AbstractAsserts::assertFileIsNotWritable() + */ + public function assertFileIsNotWritable(string $file, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileIsNotWritable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file exists and is readable. + * @see \Codeception\Module\AbstractAsserts::assertFileIsReadable() + */ + public function assertFileIsReadable(string $file, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileIsReadable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file exists and is writable. + * @see \Codeception\Module\AbstractAsserts::assertFileIsWritable() + */ + public function assertFileIsWritable(string $file, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileIsWritable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of one file is not equal to the contents of another file. + * @see \Codeception\Module\AbstractAsserts::assertFileNotEquals() + */ + public function assertFileNotEquals(string $expected, string $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of one file is not equal to the contents of another file (canonicalizing). + * @see \Codeception\Module\AbstractAsserts::assertFileNotEqualsCanonicalizing() + */ + public function assertFileNotEqualsCanonicalizing(string $expected, string $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotEqualsCanonicalizing', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of one file is not equal to the contents of another file (ignoring case). + * @see \Codeception\Module\AbstractAsserts::assertFileNotEqualsIgnoringCase() + */ + public function assertFileNotEqualsIgnoringCase(string $expected, string $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotEqualsIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is finite. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertFinite() + */ + public function assertFinite($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFinite', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a value is greater than another value. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertGreaterThan() + */ + public function assertGreaterThan($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a value is greater than or equal to another value. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertGreaterThanOrEqual() + */ + public function assertGreaterThanOrEqual($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is infinite. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertInfinite() + */ + public function assertInfinite($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInfinite', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of a given type. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertInstanceOf() + */ + public function assertInstanceOf(string $expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type array. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsArray() + */ + public function assertIsArray($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsArray', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type bool. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsBool() + */ + public function assertIsBool($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsBool', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type callable. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsCallable() + */ + public function assertIsCallable($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsCallable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type resource and is closed. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsClosedResource() + */ + public function assertIsClosedResource($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsClosedResource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type float. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsFloat() + */ + public function assertIsFloat($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsFloat', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type int. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsInt() + */ + public function assertIsInt($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsInt', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type iterable. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsIterable() + */ + public function assertIsIterable($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsIterable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type array. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotArray() + */ + public function assertIsNotArray($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotArray', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type bool. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotBool() + */ + public function assertIsNotBool($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotBool', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type callable. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotCallable() + */ + public function assertIsNotCallable($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotCallable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type resource. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotClosedResource() + */ + public function assertIsNotClosedResource($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotClosedResource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type float. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotFloat() + */ + public function assertIsNotFloat($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotFloat', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type int. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotInt() + */ + public function assertIsNotInt($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotInt', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type iterable. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotIterable() + */ + public function assertIsNotIterable($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotIterable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type numeric. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotNumeric() + */ + public function assertIsNotNumeric($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotNumeric', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type object. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotObject() + */ + public function assertIsNotObject($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotObject', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file/dir exists and is not readable. + * @see \Codeception\Module\AbstractAsserts::assertIsNotReadable() + */ + public function assertIsNotReadable(string $filename, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotReadable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type resource. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotResource() + */ + public function assertIsNotResource($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotResource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type scalar. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotScalar() + */ + public function assertIsNotScalar($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotScalar', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of type string. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNotString() + */ + public function assertIsNotString($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file/dir exists and is not writable. + * @see \Codeception\Module\AbstractAsserts::assertIsNotWritable() + */ + public function assertIsNotWritable(string $filename, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotWritable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type numeric. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsNumeric() + */ + public function assertIsNumeric($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNumeric', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type object. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsObject() + */ + public function assertIsObject($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsObject', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file/dir is readable. + * @see \Codeception\Module\AbstractAsserts::assertIsReadable() + */ + public function assertIsReadable(string $filename, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsReadable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type resource. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsResource() + */ + public function assertIsResource($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsResource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type scalar. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsScalar() + */ + public function assertIsScalar($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsScalar', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is of type string. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertIsString() + */ + public function assertIsString($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a file/dir exists and is writable. + * @see \Codeception\Module\AbstractAsserts::assertIsWritable() + */ + public function assertIsWritable(string $filename, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsWritable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string is a valid JSON string. + * @see \Codeception\Module\AbstractAsserts::assertJson() + */ + public function assertJson(string $actualJson, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertJson', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two JSON files are equal. + * @see \Codeception\Module\AbstractAsserts::assertJsonFileEqualsJsonFile() + */ + public function assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertJsonFileEqualsJsonFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two JSON files are not equal. + * @see \Codeception\Module\AbstractAsserts::assertJsonFileNotEqualsJsonFile() + */ + public function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertJsonFileNotEqualsJsonFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the generated JSON encoded object and the content of the given file are equal. + * @see \Codeception\Module\AbstractAsserts::assertJsonStringEqualsJsonFile() + */ + public function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertJsonStringEqualsJsonFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two given JSON encoded objects or arrays are equal. + * @see \Codeception\Module\AbstractAsserts::assertJsonStringEqualsJsonString() + */ + public function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertJsonStringEqualsJsonString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the generated JSON encoded object and the content of the given file are not equal. + * @see \Codeception\Module\AbstractAsserts::assertJsonStringNotEqualsJsonFile() + */ + public function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertJsonStringNotEqualsJsonFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two given JSON encoded objects or arrays are not equal. + * @see \Codeception\Module\AbstractAsserts::assertJsonStringNotEqualsJsonString() + */ + public function assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertJsonStringNotEqualsJsonString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a value is smaller than another value. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertLessThan() + */ + public function assertLessThan($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a value is smaller than or equal to another value. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertLessThanOrEqual() + */ + public function assertLessThanOrEqual($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string matches a given regular expression. + * @see \Codeception\Module\AbstractAsserts::assertMatchesRegularExpression() + */ + public function assertMatchesRegularExpression(string $pattern, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertMatchesRegularExpression', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is nan. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNan() + */ + public function assertNan($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a haystack does not contain a needle. + * + * @param mixed $needle + * @see \Codeception\Module\AbstractAsserts::assertNotContains() + */ + public function assertNotContains($needle, iterable $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\AbstractAsserts::assertNotContainsEquals() + */ + public function assertNotContainsEquals($needle, iterable $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContainsEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a haystack does not contain only values of a given type. + * @see \Codeception\Module\AbstractAsserts::assertNotContainsOnly() + */ + public function assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = NULL, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContainsOnly', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param \Countable|iterable $haystack + * @see \Codeception\Module\AbstractAsserts::assertNotCount() + */ + public function assertNotCount(int $expectedCount, $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotCount', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not empty. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNotEmpty() + */ + public function assertNotEmpty($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables are not equal. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNotEquals() + */ + public function assertNotEquals($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables are not equal (canonicalizing). + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNotEqualsCanonicalizing() + */ + public function assertNotEqualsCanonicalizing($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEqualsCanonicalizing', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables are not equal (ignoring case). + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNotEqualsIgnoringCase() + */ + public function assertNotEqualsIgnoringCase($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEqualsIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables are not equal (with delta). + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNotEqualsWithDelta() + */ + public function assertNotEqualsWithDelta($expected, $actual, float $delta, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEqualsWithDelta', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a condition is not false. + * + * @param mixed $condition + * @see \Codeception\Module\AbstractAsserts::assertNotFalse() + */ + public function assertNotFalse($condition, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not of a given type. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNotInstanceOf() + */ + public function assertNotInstanceOf(string $expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is not null. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNotNull() + */ + public function assertNotNull($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables do not have the same type and value. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNotSame() + */ + public function assertNotSame($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same. + * + * @param \Countable|iterable $expected + * @param \Countable|iterable $actual + * @see \Codeception\Module\AbstractAsserts::assertNotSameSize() + */ + public function assertNotSameSize($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSameSize', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a condition is not true. + * + * @param mixed $condition + * @see \Codeception\Module\AbstractAsserts::assertNotTrue() + */ + public function assertNotTrue($condition, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a variable is null. + * + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertNull() + */ + public function assertNull($actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that an object has a specified attribute. + * @see \Codeception\Module\AbstractAsserts::assertObjectHasAttribute() + */ + public function assertObjectHasAttribute(string $attributeName, object $object, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertObjectHasAttribute', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that an object does not have a specified attribute. + * @see \Codeception\Module\AbstractAsserts::assertObjectNotHasAttribute() + */ + public function assertObjectNotHasAttribute(string $attributeName, object $object, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertObjectNotHasAttribute', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two variables have the same type and value. + * + * @param mixed $expected + * @param mixed $actual + * @see \Codeception\Module\AbstractAsserts::assertSame() + */ + public function assertSame($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same. + * + * @param \Countable|iterable $expected + * @param \Countable|iterable $actual + * @see \Codeception\Module\AbstractAsserts::assertSameSize() + */ + public function assertSameSize($expected, $actual, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSameSize', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\AbstractAsserts::assertStringContainsString() + */ + public function assertStringContainsString(string $needle, string $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringContainsString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\AbstractAsserts::assertStringContainsStringIgnoringCase() + */ + public function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringContainsStringIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string ends not with a given suffix. + * @see \Codeception\Module\AbstractAsserts::assertStringEndsNotWith() + */ + public function assertStringEndsNotWith(string $suffix, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringEndsNotWith', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string ends with a given suffix. + * @see \Codeception\Module\AbstractAsserts::assertStringEndsWith() + */ + public function assertStringEndsWith(string $suffix, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringEndsWith', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of a string is equal to the contents of a file. + * @see \Codeception\Module\AbstractAsserts::assertStringEqualsFile() + */ + public function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringEqualsFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of a string is equal to the contents of a file (canonicalizing). + * @see \Codeception\Module\AbstractAsserts::assertStringEqualsFileCanonicalizing() + */ + public function assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringEqualsFileCanonicalizing', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of a string is equal to the contents of a file (ignoring case). + * @see \Codeception\Module\AbstractAsserts::assertStringEqualsFileIgnoringCase() + */ + public function assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringEqualsFileIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string matches a given format string. + * @see \Codeception\Module\AbstractAsserts::assertStringMatchesFormat() + */ + public function assertStringMatchesFormat(string $format, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringMatchesFormat', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string matches a given format file. + * @see \Codeception\Module\AbstractAsserts::assertStringMatchesFormatFile() + */ + public function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringMatchesFormatFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\AbstractAsserts::assertStringNotContainsString() + */ + public function assertStringNotContainsString(string $needle, string $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotContainsString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\AbstractAsserts::assertStringNotContainsStringIgnoringCase() + */ + public function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotContainsStringIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of a string is not equal to the contents of a file. + * @see \Codeception\Module\AbstractAsserts::assertStringNotEqualsFile() + */ + public function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotEqualsFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of a string is not equal to the contents of a file (canonicalizing). + * @see \Codeception\Module\AbstractAsserts::assertStringNotEqualsFileCanonicalizing() + */ + public function assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotEqualsFileCanonicalizing', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that the contents of a string is not equal to the contents of a file (ignoring case). + * @see \Codeception\Module\AbstractAsserts::assertStringNotEqualsFileIgnoringCase() + */ + public function assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotEqualsFileIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string does not match a given format string. + * @see \Codeception\Module\AbstractAsserts::assertStringNotMatchesFormat() + */ + public function assertStringNotMatchesFormat(string $format, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotMatchesFormat', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string does not match a given format string. + * @see \Codeception\Module\AbstractAsserts::assertStringNotMatchesFormatFile() + */ + public function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotMatchesFormatFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string starts not with a given prefix. + * @see \Codeception\Module\AbstractAsserts::assertStringStartsNotWith() + */ + public function assertStringStartsNotWith(string $prefix, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a string starts with a given prefix. + * @see \Codeception\Module\AbstractAsserts::assertStringStartsWith() + */ + public function assertStringStartsWith(string $prefix, string $string, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Evaluates a PHPUnit\Framework\Constraint matcher object. + * + * @param mixed $value + * @see \Codeception\Module\AbstractAsserts::assertThat() + */ + public function assertThat($value, \PHPUnit\Framework\Constraint\Constraint $constraint, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertThat', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that a condition is true. + * + * @param mixed $condition + * @see \Codeception\Module\AbstractAsserts::assertTrue() + */ + public function assertTrue($condition, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two XML files are equal. + * @see \Codeception\Module\AbstractAsserts::assertXmlFileEqualsXmlFile() + */ + public function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertXmlFileEqualsXmlFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two XML files are not equal. + * @see \Codeception\Module\AbstractAsserts::assertXmlFileNotEqualsXmlFile() + */ + public function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertXmlFileNotEqualsXmlFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two XML documents are equal. + * + * @param \DOMDocument|string $actualXml + * @see \Codeception\Module\AbstractAsserts::assertXmlStringEqualsXmlFile() + */ + public function assertXmlStringEqualsXmlFile(string $expectedFile, $actualXml, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertXmlStringEqualsXmlFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two XML documents are equal. + * + * @param \DOMDocument|string $expectedXml + * @param \DOMDocument|string $actualXml + * @see \Codeception\Module\AbstractAsserts::assertXmlStringEqualsXmlString() + */ + public function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertXmlStringEqualsXmlString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two XML documents are not equal. + * + * @param \DOMDocument|string $actualXml + * @see \Codeception\Module\AbstractAsserts::assertXmlStringNotEqualsXmlFile() + */ + public function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertXmlStringNotEqualsXmlFile', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Asserts that two XML documents are not equal. + * + * @param \DOMDocument|string $expectedXml + * @param \DOMDocument|string $actualXml + * @see \Codeception\Module\AbstractAsserts::assertXmlStringNotEqualsXmlString() + */ + public function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertXmlStringNotEqualsXmlString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fails a test with the given message. + * @see \Codeception\Module\AbstractAsserts::fail() + */ + public function fail(string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Mark the test as incomplete. + * @see \Codeception\Module\AbstractAsserts::markTestIncomplete() + */ + public function markTestIncomplete(string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('markTestIncomplete', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Mark the test as skipped. + * @see \Codeception\Module\AbstractAsserts::markTestSkipped() + */ + public function markTestSkipped(string $message = "") { + return $this->getScenario()->runStep(new \Codeception\Step\Action('markTestSkipped', func_get_args())); + } +} diff --git a/__tests__/lib/campaigns.php b/__tests__/lib/campaigns.php new file mode 100644 index 0000000..4bc686e --- /dev/null +++ b/__tests__/lib/campaigns.php @@ -0,0 +1,188 @@ +setObject("product"); + $applicableTo->setId($productId); + + $validationRuleApplicableTo->setIncluded([$applicableTo]); + + $validationRule->setName(generateRandomString()); + $validationRule->setApplicableTo($validationRuleApplicableTo); + $validationRule->setType('basic'); + + try { + $createdValidaitonRule = $validationRulesApiInstance->createValidationRules($validationRule); + return $createdValidaitonRule; + } catch (Error $err) { + error_log('Error during creating validation rule: ' . $err); + return null; + } +} + +function createValidationRuleMoreThan(ValidationRulesApi $validationRulesApiInstance,): ?ValidationRulesCreateResponseBody +{ + $validationRuleRequestBody = new ValidationRulesCreateRequestBody(); + $rule = new ValidationRule(); + + $conditions = [ + '$more_than' => [500000] + ]; + + $rule = [ + 'name' => 'order.amount', + 'conditions' => $conditions, + 'rules' => new stdClass() + ]; + + $validationRuleRequestBody->setName(generateRandomString()); + $validationRuleRequestBody->setRules((object) ["1" => $rule]); + $validationRuleRequestBody->setType('basic'); + + try { + $createdValidationRule = $validationRulesApiInstance->createValidationRules($validationRuleRequestBody); + return $createdValidationRule; + } catch (Error $err) { + error_log('Error during creating validation rule: ' . $err); + return null; + } +} + +function createDiscountCampaign(CampaignsApi $campaignsApiInstance, $validationRuleId): ?CampaignsCreateResponseBody +{ + $campaign = new CampaignsCreateRequestBody(); + $voucher = new CampaignsCreateRequestBodyVoucher(); + $discount = new Discount(); + + $discount->setType('AMOUNT'); + $discount->setAmountOff(1000); + + $voucher->setType('DISCOUNT_VOUCHER'); + $voucher->setDiscount($discount); + + $campaign->setCampaignType('DISCOUNT_COUPONS'); + $campaign->setName(generateRandomString()); + $campaign->setType('AUTO_UPDATE'); + $campaign->setValidationRules([$validationRuleId]); + $campaign->setVoucher($voucher); + + try { + $createdCampaign = $campaignsApiInstance->createCampaign($campaign); + return $createdCampaign; + } catch (Error $err) { + error_log('Error during creating discount campaign: ' . $err); + return null; + } +} + +function createPromotionCampaign(CampaignsApi $campaignsApiInstance): ?CampaignsCreateResponseBody +{ + $campaign = new CampaignsCreateRequestBody(); + $promotion = new CampaignsCreateRequestBodyPromotion(); + $discount = new Discount(); + + $discount->setType('AMOUNT'); + $discount->setAmountOff(1000); + + $promotion->setTiers([ + "name" => generateRandomString(), + "banner" => generateRandomString(), + "action" => $discount + ]); + + $campaign->setCampaignType('PROMOTION'); + $campaign->setName(generateRandomString()); + $campaign->setPromotion($promotion); + + try { + $createdCampaign = $campaignsApiInstance->createCampaign($campaign); + return $createdCampaign; + } catch (Error $err) { + error_log('Error during creating promotion campaign: ' . $err); + return null; + } +} + +function createLoyaltyCampaign(CampaignsApi $campaignsApiInstance): ?CampaignsCreateResponseBody +{ + $campaign = new CampaignsCreateRequestBody(); + $voucher = new CampaignsCreateRequestBodyVoucher(); + $loyaltyCard = new CampaignLoyaltyCard(); + + $loyaltyCard->setPoints(1000); + + $voucher->setType('LOYALTY_CARD'); + $voucher->setLoyaltyCard($loyaltyCard); + + $campaign->setCampaignType('LOYALTY_PROGRAM'); + $campaign->setName(generateRandomString()); + $campaign->setVoucher($voucher); + + try { + $createdCampaign = $campaignsApiInstance->createCampaign($campaign); + return $createdCampaign; + } catch (Error $err) { + error_log('Error during creating loyalty campaign: ' . $err); + return null; + } +} + +function deleteCampaign(CampaignsApi $campaignsApiInstance, string $campaignId) +{ + try { + $deletedCampaign = $campaignsApiInstance->deleteCampaign($campaignId); + return $deletedCampaign; + } catch (Error $err) { + error_log('Error during deleting campaign: ' . $err); + return null; + } +} + +function addVouchersToCampaign(CampaignsApi $campaignsApiInstance, string $campaignId, int $vouchersCount): ?CampaignsVouchersCreateCombinedResponseBody +{ + try { + $createdVoucher = $campaignsApiInstance->addVouchersToCampaign($campaignId, $vouchersCount); + return $createdVoucher; + } catch (Error $err) { + error_log('Error during adding vouchers to campaign: ' . $err); + return null; + } +} + +function generateAndReturnVouchersAddedToCampaign(CampaignsApi $campaignsApiInstance, string $campaignId, int $voucherCount) +{ + $vouchers = []; + + try { + for ($i = 0; $i < $voucherCount; $i++) { + $voucher = $campaignsApiInstance->addVouchersToCampaign($campaignId, 1); + $vouchers[] = $voucher->getCode(); + } + + return $vouchers; + } catch (Error $err) { + error_log('Error during adding vouchers to campaign: ' . $err); + return null; + } +} diff --git a/__tests__/lib/config.php b/__tests__/lib/config.php new file mode 100644 index 0000000..fe102de --- /dev/null +++ b/__tests__/lib/config.php @@ -0,0 +1,110 @@ +setApiKey('X-App-Id', $env['X_APP_ID']) + ->setApiKey('X-App-Token', $env['X_APP_TOKEN']) + ->setHost($env['VOUCHERIFY_HOST'] ?? 'https://api.voucherify.io'); + } + + return self::$config; + } + + private static function getClient() + { + return new Client(); + } + + public static function productsApiInstance(): ProductsApi + { + return new ProductsApi(self::getClient(), self::getConfig()); + } + + public static function campaignsApiInstance(): CampaignsApi + { + return new CampaignsApi(self::getClient(), self::getConfig()); + } + + public static function validationRulesApiInstance(): ValidationRulesApi + { + return new ValidationRulesApi(self::getClient(), self::getConfig()); + } + + public static function customersApiInstance(): CustomersApi + { + return new CustomersApi(self::getClient(), self::getConfig()); + } + + public static function exportsApiInstance(): ExportsApi + { + return new ExportsApi(self::getClient(), self::getConfig()); + } + + public static function redemptionsApiInstance(): RedemptionsApi + { + return new RedemptionsApi(self::getClient(), self::getConfig()); + } + + public static function publicationsApiInstance(): PublicationsApi + { + return new PublicationsApi(self::getClient(), self::getConfig()); + } + + public static function qualificationsApiInstance(): QualificationsApi + { + return new QualificationsApi(self::getClient(), self::getConfig()); + } + + public static function vouchersApiInstance(): VouchersApi + { + return new VouchersApi(self::getClient(), self::getConfig()); + } + + public static function eventsApiInstance(): EventsApi + { + return new EventsApi(self::getClient(), self::getConfig()); + } + + public static function ordersApiInstance(): OrdersApi + { + return new OrdersApi(self::getClient(), self::getConfig()); + } + + public static function loyaltiesApiInstance(): LoyaltiesApi + { + return new LoyaltiesApi(self::getClient(), self::getConfig()); + } + + public static function validationsApiInstance(): ValidationsApi + { + return new ValidationsApi(self::getClient(), self::getConfig()); + } +} + +?> diff --git a/__tests__/lib/customers.php b/__tests__/lib/customers.php new file mode 100644 index 0000000..50a5028 --- /dev/null +++ b/__tests__/lib/customers.php @@ -0,0 +1,41 @@ +setCountry('US'); + $address->setCity('New York'); + $address->setLine1('5th Avenue'); + $address->setLine2('1/2'); + $address->setPostalCode('11-111'); + + $customerRequestBody->setSourceId(generateRandomString()); + $customerRequestBody->setName('John Doe'); + $customerRequestBody->setAddress($address); + + try { + $createdCustomer = $customersApiInstance->createCustomer($customerRequestBody); + return $createdCustomer; + } catch (Error $err) { + error_log('Error during creating customer: ' . $err); + return null; + } +} + +function deleteCustomer(CustomersApi $customersApiInstance, string $customerId) { + try { + $deletedCustomer = $customersApiInstance->customerPermanentlyDeletion($customerId); + return $deletedCustomer; + } catch (Error $err) { + error_log('Error during deleting customer: ' . $err); + return null; + } +} +?> \ No newline at end of file diff --git a/__tests__/lib/events.php b/__tests__/lib/events.php new file mode 100644 index 0000000..b1e68bd --- /dev/null +++ b/__tests__/lib/events.php @@ -0,0 +1,29 @@ +setSourceId('test-customer'); + $event->setEvent('test-event'); + $event->setCustomer($customer); + $event->setMetadata(null); + $event->setReferral(null); + $event->setLoyalty(null); + + try { + $createdEvent = $eventsApiInstance->trackCustomEvent($event); + return $createdEvent; + } catch (Error $err) { + error_log('Error during creating customer: ' . $err); + return null; + } +} + +?> \ No newline at end of file diff --git a/__tests__/lib/loyalties.php b/__tests__/lib/loyalties.php new file mode 100644 index 0000000..8741797 --- /dev/null +++ b/__tests__/lib/loyalties.php @@ -0,0 +1,32 @@ +setPoints(2000); + + try { + $updatedLoyaltyCard = $loyaltiesApiInstance->updateLoyaltyCardBalance($memberId, $loyaltyCard); + return $updatedLoyaltyCard; + } catch (Error $err) { + error_log('Error during updating loyalty member card balance: ' . $err); + return null; + } +} + +function listLoyaltyMemberCardTransactions(LoyaltiesApi $loyaltiesApiInstance, string $memberId): ?LoyaltiesMembersTransactionsListResponseBody { + try { + $transactions = $loyaltiesApiInstance->listLoyaltyCardTransactions($memberId, 10, 1); + return $transactions; + } catch (Error $err) { + error_log('Error during listing loyalty member card transactions: ' . $err); + return null; + } +} + +?> \ No newline at end of file diff --git a/__tests__/lib/orders.php b/__tests__/lib/orders.php new file mode 100644 index 0000000..890c79a --- /dev/null +++ b/__tests__/lib/orders.php @@ -0,0 +1,70 @@ +setId($customerId); + + $calculatedItem->setName('test-order-item1'); + $calculatedItem2->setName('test-order-item2'); + $product1->setProduct($calculatedItem); + $product1->setQuantity(1); + $product2->setProduct($calculatedItem2); + $product2->setQuantity(1); + + $order->setItems([$product1, $product2]); + $order->setAmount(10000); + $order->setStatus('CREATED'); + $order->setCustomer($customer); + + try { + $createdOrder = $ordersApiInstance->createOrder($order); + return $createdOrder; + } catch (Error $err) { + error_log('Error during creating order: ' . $err); + return null; + } +} + +function getOrder(OrdersApi $ordersApiInstance, string $orderId): ?OrdersGetResponseBody +{ + try { + $order = $ordersApiInstance->getOrder($orderId); + return $order; + } catch (Error $err) { + error_log('Error during getting order: ' . $err); + return null; + } +} + +function updateOrder(OrdersApi $ordersApiInstance, string $orderId): ?OrdersUpdateResponseBody +{ + $order = new OrdersUpdateRequestBody(); + $order->setAmount(30000); + $order->setStatus('PAID'); + + try { + $updatedOrder = $ordersApiInstance->updateOrder($orderId, $order); + return $updatedOrder; + } catch (Error $err) { + error_log('Error during getting order: ' . $err); + return null; + } +} diff --git a/__tests__/lib/products.php b/__tests__/lib/products.php new file mode 100644 index 0000000..6fbf8cc --- /dev/null +++ b/__tests__/lib/products.php @@ -0,0 +1,158 @@ +setSourceId(generateRandomString()); + $product->setName(generateRandomString()); + $product->setPrice($price); + $product->setAttributes(['color', 'memory', 'processor']); + + try { + $createdProduct = $productsApiInstance->createProduct($product); + return $createdProduct; + } catch (Error $err) { + error_log('Error during creating product: ' . $err); + return null; + } +} + +function getProduct(ProductsApi $productsApiInstance, string $productId): ?ProductsGetResponseBody +{ + try { + $product = $productsApiInstance->getProduct($productId); + return $product; + } catch (Error $err) { + error_log('Error during getting product: ' . $err); + return null; + } +} + +function updateProduct(ProductsApi $productsApiInstance, string $sourceId): ?ProductsUpdateResponseBody +{ + $product = new ProductsUpdateRequestBody(); + $product->setPrice(55000); + $product->setPrice(55000); + + try { + $updatedProduct = $productsApiInstance->updateProduct($sourceId, $product); + return $updatedProduct; + } catch (Error $err) { + error_log('Error during updating product: ' . $err); + return null; + } +} + +function updateProductsInBulk(ProductsApi $productsApiInstance): ?ProductsUpdateInBulkResponseBody +{ + $product1 = new ProductsUpdateInBulkRequestBody(); + $product1->setSourceId(generateRandomString()); + $product1->setPrice(1000); + + $product2 = new ProductsUpdateInBulkRequestBody(); + $product2->setSourceId(generateRandomString()); + $product2->setPrice(2000); + + $updatedProducts = [$product1, $product2]; + + try { + $productsUpdatedInBulk = $productsApiInstance->updateProductsInBulk($updatedProducts); + return $productsUpdatedInBulk; + } catch (Error $err) { + error_log('Error during updating products in bulk: ' . $err); + return null; + } +} + +function updateProductsMetadataInBulk(ProductsApi $productsApiInstance, array $productIds): ?ProductsMetadataUpdateInBulkResponseBody +{ + $products = new ProductsMetadataUpdateInBulkRequestBody(); + + $randomStrings = array_map(function () { + return generateRandomString(); + }, $productIds); + + $products->setSourceIds($randomStrings); + $products->setMetadata((object) ["key1" => "value1", "key2" => "value2"]); + + try { + $updatedProductsMetadata = $productsApiInstance->updateProductsMetadataInBulk($products); + return $updatedProductsMetadata; + } catch (Error $err) { + error_log('Error during updating products metadatas in bulk: ' . $err); + return null; + } +} + +function createSku(ProductsApi $productsApiInstance, string $sourceId, int $price): ?ProductsSkusCreateResponseBody +{ + $sku = new ProductsSkusCreateRequestBody(); + $sku->setSourceId(generateRandomString()); + $sku->setPrice($price); + $sku->setAttributes((object) [ + "color" => "red", + "memory" => "16GB", + "processor" => "Intel Core i7" + ]); + + try { + $createdSku = $productsApiInstance->createSku($sourceId, $sku); + return $createdSku; + } catch (Error $err) { + error_log('Error during creating product sku: ' . $err); + return null; + } +} + +function updateSku(ProductsApi $productsApiInstance, string $sourceId, string $skuId, int $price): ?ProductsSkusUpdateResponseBody +{ + $sku = new ProductsSkusUpdateRequestBody(); + $sku->setPrice($price); + + try { + $updatedSku = $productsApiInstance->updateSku($sourceId, $skuId, $sku); + return $updatedSku; + } catch (Error $err) { + error_log('Error during updating product sku: ' . $err); + return null; + } +} + +function deleteProduct(ProductsApi $productsApiInstance, string $productId) +{ + try { + $deletedProduct = $productsApiInstance->deleteProduct($productId, true); + return $deletedProduct; + } catch (Error $err) { + error_log('Error during deleting product: ' . $err); + return null; + } +} + +function deleteSku(ProductsApi $productsApiInstance, string $productId, string $skuId) +{ + try { + $deletedSku = $productsApiInstance->deleteSku($productId, $skuId, true); + return $deletedSku; + } catch (Error $err) { + error_log('Error during deleting product sku: ' . $err); + return null; + } +} diff --git a/__tests__/lib/publications.php b/__tests__/lib/publications.php new file mode 100644 index 0000000..62dbfa6 --- /dev/null +++ b/__tests__/lib/publications.php @@ -0,0 +1,29 @@ +setId($customerId); + $campaign->setName($campaignName); + $publication->setCustomer($customer); + $publication->setCampaign($campaign); + + try { + $createdPublication = $publicationsApiInstance->createPublication(null, $publication); + return $createdPublication; + } catch (Error $err) { + error_log('Error during creating publication: ' . $err); + return null; + } +} + +?> \ No newline at end of file diff --git a/__tests__/lib/qualifications.php b/__tests__/lib/qualifications.php new file mode 100644 index 0000000..be90a6d --- /dev/null +++ b/__tests__/lib/qualifications.php @@ -0,0 +1,43 @@ +setId($customerId); + $order->setAmount(20000); + $filterCondition->setIn(['voucher']); + $resourceType->setConditions($filterCondition); + $filters->setResourceType($resourceType); + $qualificationOption->setLimit($limit); + $qualificationOption->setFilters($filters); + + $qualification->setCustomer($customer); + $qualification->setOrder($order); + $qualification->setOptions($qualificationOption); + + try { + $checkedEligibity = $qualificationsApiInstance->checkEligibility($qualification); + return $checkedEligibity; + } catch (Error $err) { + error_log('Error during checking eligibility: ' . $err); + return null; + } +} diff --git a/__tests__/lib/redemptions.php b/__tests__/lib/redemptions.php new file mode 100644 index 0000000..01e8b40 --- /dev/null +++ b/__tests__/lib/redemptions.php @@ -0,0 +1,46 @@ +setAmount(20000); + $redemptions->setOrder($order); + $redemptions->setRedeemables($redeemables); + + try { + $result = $redemptionsApiInstance->redeemStackedDiscounts($redemptions); + return $result; + } catch (Error $err) { + error_log('Error during redeeming stacked discounts: ' . $err); + return null; + } +} + +function createRedemptionsRequestBodyRedeemable($voucherId): RedemptionsRedeemRequestBodyRedeemablesItem +{ + $redeemable = new RedemptionsRedeemRequestBodyRedeemablesItem(); + $redeemable->setId($voucherId); + $redeemable->setObject('voucher'); + return $redeemable; +} diff --git a/__tests__/lib/utils.php b/__tests__/lib/utils.php new file mode 100644 index 0000000..19e351b --- /dev/null +++ b/__tests__/lib/utils.php @@ -0,0 +1,130 @@ + &$value) { + if (in_array($key, $fieldsToRemove)) { + unset($data[$key]); + } elseif (is_array($value) || is_object($value)) { + $data[$key] = removeDynamicFields($value, $fieldsToRemove); + } + } + } elseif (is_object($data)) { + $dataArray = (array)$data; + foreach ($dataArray as $key => $value) { + if (in_array($key, $fieldsToRemove)) { + unset($dataArray[$key]); + } elseif (is_array($value) || is_object($value)) { + $dataArray[$key] = removeDynamicFields($value, $fieldsToRemove); + } + } + $data = (object)$dataArray; + } + return $data; +} + +function loadSnapshot($path) +{ + error_log($path); + $path = __DIR__ . "/../snapshots/$path.json"; + if (!file_exists($path)) { + throw new Exception("File not found: $path"); + } + $jsonContent = file_get_contents($path); + return $jsonContent; +} + +function validatePayloads($snapshotPath, $response, $keysToRemove) +{ + $snapshot = loadSnapshot($snapshotPath); + $filteredSnapshot = removeDynamicFields(json_decode($snapshot), $keysToRemove); + $filteredResponse = removeDynamicFields(json_decode($response), $keysToRemove); + return [$filteredSnapshot, $filteredResponse]; +} + +function filterSnapshot($snapshotPath, $keysToRemove) +{ + $snapshot = loadSnapshot($snapshotPath); + $filteredSnapshot = removeDynamicFields(json_decode($snapshot), $keysToRemove); + return $filteredSnapshot; +} + +function consoleLog($value) +{ + return error_log(json_encode($value, JSON_PRETTY_PRINT)); +} + +function deepMatch($snapshot, $response, $path = [], &$errors = []) +{ + if (is_object($snapshot) && is_object($response)) { + foreach ($snapshot as $key => $value) { + $currentPath = array_merge($path, [$key]); + if (!property_exists($response, $key)) { + $errors[] = "Missing key in response: \"" . implode('->', $currentPath) . "\""; + return false; + } + if (!deepMatch($value, $response->$key, $currentPath, $errors)) { + return false; + } + } + return true; + } elseif (is_array($snapshot) && is_array($response)) { + if (count($snapshot) !== count($response)) { + $errors[] = "Array length mismatch at field: \"" . implode('->', $path) . "\". Snapshot: " . count($snapshot) . ", response: " . count($response); + return false; + } + foreach ($snapshot as $index => $item) { + $currentPath = array_merge($path, ["[$index]"]); + if (!deepMatch($item, $response[$index], $currentPath, $errors)) { + return false; + } + } + return true; + } else { + if ($snapshot !== $response) { + $snapshotStr = is_scalar($snapshot) ? (string)$snapshot : json_encode($snapshot); + $responseStr = is_scalar($response) ? (string)$response : json_encode($response); + $currentPath = implode('->', $path); + + $errors[] = "Mismatch at field: \"$currentPath\". Snapshot value: \"$snapshotStr\", response value: \"$responseStr\""; + + return false; + } + return true; + } +} + +function validateDeepMatch($snapshot, $response) +{ + $errors = []; + $jsonDecodedResponse = json_decode($response); + + if (deepMatch($snapshot, $jsonDecodedResponse, [], $errors)) { + return true; + } else { + return implode("\n", $errors); + } +} diff --git a/__tests__/lib/validationRules.php b/__tests__/lib/validationRules.php new file mode 100644 index 0000000..ab253be --- /dev/null +++ b/__tests__/lib/validationRules.php @@ -0,0 +1,21 @@ +setRelatedObjectId('voucher'); + $validationRule->setRelatedObjectId($voucherCode); + + try { + $createdValRule = $validationRulesApiInstance->createValidationRuleAssignment($validationRuleId, null, $validationRule); + return $createdValRule; + } catch (Error $err) { + error_log('Error during creating validation rule: ' . $err); + return null; + } +} +?> \ No newline at end of file diff --git a/__tests__/lib/validations.php b/__tests__/lib/validations.php new file mode 100644 index 0000000..b801901 --- /dev/null +++ b/__tests__/lib/validations.php @@ -0,0 +1,68 @@ +setRelatedObject("product"); + $orderItem->setQuantity(1); + $orderItem->setDiscountQuantity(1); + $orderItem->setAmount($amount); + $orderItem->setPrice($amount); + $orderItem->setProductId($productId); + + $product->setId($productId); + $orderItem->setProduct($product); + + $customerObject->setSourceId($customer->source_id); + + $order->setItems([$orderItem]); + $order->setAmount($amount); + $order->setCustomer($customerObject); + + + $validations->setRedeemables($redeemables); + $validations->setOrder($order); + $validations->setCustomer($customerObject); + + try { + $result = $validationsApiInstance->validateStackedDiscounts($validations); + return $result; + } catch (Error $err) { + error_log('Error during validating stacked discounts: ' . $err); + return null; + } +} + +function createValidationsRequestBodyRedeemable($voucherId): ValidationsValidateRequestBodyRedeemablesItem +{ + $redeemable = new ValidationsValidateRequestBodyRedeemablesItem(); + $redeemable->setId($voucherId); + $redeemable->setObject('voucher'); + return $redeemable; +} diff --git a/__tests__/lib/voucherify.php b/__tests__/lib/voucherify.php new file mode 100644 index 0000000..883faed --- /dev/null +++ b/__tests__/lib/voucherify.php @@ -0,0 +1,153 @@ +discountCampaign = $discountCampaign; + } + + public function getDiscountCampaign() + { + return $this->discountCampaign; + } + + public function setPromotionCampaign($promotionCampaign) + { + $this->promotionCampaign = $promotionCampaign; + } + + public function getPromotionCampaign() + { + return $this->promotionCampaign; + } + + public function setProduct($product) + { + $this->product = $product; + } + + public function getProduct() + { + return $this->product; + } + + public function setCustomer($customer) + { + $this->customer = $customer; + } + + public function getCustomer() + { + return $this->customer; + } + + public function addProductId($productId) + { + $this->productIds[] = $productId; + } + + public function getProductIds() + { + return $this->productIds; + } + + public function setValidationRule($validationRule) + { + $this->validationRule = $validationRule; + } + + public function getValidationRule() + { + return $this->validationRule; + } + + public function setVoucherWithMoreThanValidationRule($voucher) + { + $this->voucherWithMoreThanValidationRule = $voucher; + } + + public function getVoucherWithMoreThanValidationRule() + { + return $this->voucherWithMoreThanValidationRule; + } + + public function setSku($sku) + { + $this->sku = $sku; + } + + public function getSku() + { + return $this->sku; + } + + public function setVoucher($voucher) + { + $this->voucher = $voucher; + } + + public function getVoucher() + { + return $this->voucher; + } + + public function setLoyaltyCampaign($loyaltyCampaign) + { + $this->loyaltyCampaign = $loyaltyCampaign; + } + + public function getLoyaltyCampaign() + { + return $this->loyaltyCampaign; + } + + public function setLoyaltyCard($loyaltyCard) + { + $this->loyaltyCard = $loyaltyCard; + } + + public function getLoyaltyCard() + { + return $this->loyaltyCard; + } + + public function setOrder($order) + { + $this->order = $order; + } + + public function getOrder() + { + return $this->order; + } +} + +?> diff --git a/__tests__/lib/vouchers.php b/__tests__/lib/vouchers.php new file mode 100644 index 0000000..6335df6 --- /dev/null +++ b/__tests__/lib/vouchers.php @@ -0,0 +1,55 @@ +getVoucher($voucherCode); + return $voucher; + } catch (Error $err) { + error_log('Error during getting previously created voucher: ' . $err); + return null; + } +} + +function disableVoucher(VouchersApi $vouchersApiInstance, string $voucherCode): ?VouchersDisableResponseBody { + try { + $disabledVoucher = $vouchersApiInstance->disableVoucher($voucherCode); + return $disabledVoucher; + } catch (Error $err) { + error_log('Error during getting previously created voucher: ' . $err); + return null; + } +} + +function enableVoucher(VouchersApi $vouchersApiInstance, string $voucherCode): ?VouchersEnableResponseBody { + try { + $enabledVoucher = $vouchersApiInstance->enableVoucher($voucherCode); + return $enabledVoucher; + } catch (Error $err) { + error_log('Error during getting previously created voucher: ' . $err); + return null; + } +} + +function updateLoyaltyCardbalance(VouchersApi $vouchersApiInstance, string $voucherCode): ?VouchersBalanceUpdateResponseBody { + $loyaltyCard = new VouchersBalanceUpdateRequestBody(); + $loyaltyCard->setSourceId(generateRandomString()); + $loyaltyCard->setAmount(10000); + $loyaltyCard->setReason("Regular customer"); + try { + $updatedLoyaltyCard = $vouchersApiInstance->updateVoucherBalance($voucherCode, $loyaltyCard); + return $updatedLoyaltyCard; + } catch (Error $err) { + error_log('Error during getting previously created voucher: ' . $err); + return null; + } +} + +?> \ No newline at end of file diff --git a/__tests__/snapshots/campaigns/addedVoucherToCampaign.json b/__tests__/snapshots/campaigns/addedVoucherToCampaign.json new file mode 100644 index 0000000..d0672e7 --- /dev/null +++ b/__tests__/snapshots/campaigns/addedVoucherToCampaign.json @@ -0,0 +1,82 @@ +{ + "id": "v_qufKTAte5Ldyz456CEqvvScXACSeo9xS", + "code": "2dLzEeLh", + "campaign": "gFTVDj601E", + "campaign_id": "camp_tk6MbB9NNlS1zO0lsq2nHuNc", + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "assets": { + "qr": { + "id": "13de49b9-9a0c-4a37-8b3d-b8f275f871ca", + "url": "https://dl.voucherify.io/api/v1/assets/qr/13de49b9-9a0c-4a37-8b3d-b8f275f871ca" + }, + "barcode": { + "id": "b2f989c3-ae4c-41c5-93bc-ef13830a06a4", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/b2f989c3-ae4c-41c5-93bc-ef13830a06a4" + } + }, + "is_referral_code": false, + "created_at": "2024-09-04T10:28:31+00:00", + "updated_at": null, + "holder_id": null, + "referrer_id": null, + "object": "voucher", + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2dLzEeLh/publications?page=1&limit=10" + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": null, + "object": "list", + "url": "/v1/vouchers/2dLzEeLh/redemptions?page=1&limit=10" + }, + "categories": [], + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_yISSzrcDyB4xqMXl", + "rule_id": "val_s6sxKnk77dRq", + "related_object_id": "camp_tk6MbB9NNlS1zO0lsq2nHuNc", + "related_object_type": "campaign", + "created_at": "2024-09-04T10:28:30+00:00", + "updated_at": null, + "object": "validation_rules_assignment", + "validation_status": null, + "validation_omitted_rules": null + } + ], + "total": 1 + }, + "async_action_id": null +} diff --git a/__tests__/snapshots/campaigns/createdBundleOfVouchers.json b/__tests__/snapshots/campaigns/createdBundleOfVouchers.json new file mode 100644 index 0000000..d1ca368 --- /dev/null +++ b/__tests__/snapshots/campaigns/createdBundleOfVouchers.json @@ -0,0 +1,27 @@ +{ + "id": null, + "code": null, + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": null, + "additional_info": null, + "metadata": null, + "is_referral_code": null, + "created_at": null, + "updated_at": null, + "holder_id": null, + "referrer_id": null, + "object": null, + "publish": null, + "redemption": null, + "categories": null, + "async_action_id": "aa_0f50e0ef31d5b605ab" +} diff --git a/__tests__/snapshots/campaigns/createdDiscountCampaignWithValidationRule.json b/__tests__/snapshots/campaigns/createdDiscountCampaignWithValidationRule.json new file mode 100644 index 0000000..c6b689c --- /dev/null +++ b/__tests__/snapshots/campaigns/createdDiscountCampaignWithValidationRule.json @@ -0,0 +1,79 @@ +{ + "id": "camp_MXqW0TaM5dOhk0x0p3N0XhSg", + "name": "cLXAcZCy8r", + "description": null, + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "prefix": null, + "postfix": null, + "pattern": "########", + "initial_count": null + }, + "is_referral_code": false, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "validity_day_of_week": null, + "activity_duration_after_publishing": null, + "vouchers_count": 0, + "start_date": null, + "expiration_date": null, + "active": true, + "metadata": null, + "created_at": "2024-09-04T10:20:41+00:00", + "updated_at": null, + "category": null, + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "categories": [], + "object": "campaign", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_PhxWqbBGcKNYNiJ5", + "rule_id": "val_TM17t4KjzN6V", + "related_object_id": "camp_MXqW0TaM5dOhk0x0p3N0XhSg", + "related_object_type": "campaign", + "created_at": "2024-09-04T10:20:41+00:00", + "updated_at": null, + "object": "validation_rules_assignment", + "validation_status": null, + "validation_omitted_rules": null + } + ], + "total": 1 + } +} diff --git a/__tests__/snapshots/campaigns/createdLoyaltyCampaign.json b/__tests__/snapshots/campaigns/createdLoyaltyCampaign.json new file mode 100644 index 0000000..238f33c --- /dev/null +++ b/__tests__/snapshots/campaigns/createdLoyaltyCampaign.json @@ -0,0 +1,54 @@ +{ + "id": "camp_XhlgXPmEdQTwOWJJn4ACtGxz", + "name": "7CiBxpEG0X", + "description": null, + "campaign_type": "LOYALTY_PROGRAM", + "type": "STATIC", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1000, + "expiration_rules": null + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "prefix": null, + "postfix": null, + "pattern": "########", + "initial_count": null + }, + "is_referral_code": false, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "validity_day_of_week": null, + "activity_duration_after_publishing": null, + "vouchers_count": 0, + "start_date": null, + "expiration_date": null, + "active": true, + "metadata": null, + "created_at": "2024-09-04T10:16:00+00:00", + "updated_at": null, + "category": null, + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "categories": [], + "object": "campaign", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + } +} diff --git a/__tests__/snapshots/campaigns/createdLoyaltyCard.json b/__tests__/snapshots/campaigns/createdLoyaltyCard.json new file mode 100644 index 0000000..f97037c --- /dev/null +++ b/__tests__/snapshots/campaigns/createdLoyaltyCard.json @@ -0,0 +1,58 @@ +{ + "id": "v_pqPA1icbrw6s9vLgQXZnVe1X7vAqJrbh", + "code": "URzk0Kb1", + "campaign": "5GU8kp1k7A", + "campaign_id": "camp_6WDGkLoI5xb8e5VgRozVB9I4", + "category": null, + "category_id": null, + "type": "LOYALTY_CARD", + "gift": null, + "loyalty_card": { + "points": 1000, + "balance": 1000, + "next_expiration_date": null, + "next_expiration_points": null + }, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "assets": { + "qr": { + "id": "931da50c-a0f5-4841-b1d1-abfe93eafe48", + "url": "https://dl.voucherify.io/api/v1/assets/qr/931da50c-a0f5-4841-b1d1-abfe93eafe48" + }, + "barcode": { + "id": "6a4f9a25-d5b4-4468-9136-57c0681ec94b", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/6a4f9a25-d5b4-4468-9136-57c0681ec94b" + } + }, + "is_referral_code": false, + "created_at": "2024-09-04T10:18:56+00:00", + "updated_at": null, + "holder_id": null, + "referrer_id": null, + "object": "voucher", + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/URzk0Kb1/publications?page=1&limit=10" + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/URzk0Kb1/redemptions?page=1&limit=10" + }, + "categories": [], + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "async_action_id": null +} diff --git a/__tests__/snapshots/campaigns/createdPromotionCampaign.json b/__tests__/snapshots/campaigns/createdPromotionCampaign.json new file mode 100644 index 0000000..059a958 --- /dev/null +++ b/__tests__/snapshots/campaigns/createdPromotionCampaign.json @@ -0,0 +1,33 @@ +{ + "id": "camp_iggvmrOwNrRqsIi0TFwIj84q", + "name": "PBsRnEppID", + "description": null, + "campaign_type": "PROMOTION", + "type": "STATIC", + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": false, + "validity_day_of_week": null, + "activity_duration_after_publishing": null, + "vouchers_count": null, + "start_date": null, + "expiration_date": null, + "active": true, + "metadata": null, + "created_at": "2024-09-04T10:16:00+00:00", + "updated_at": null, + "category": null, + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "categories": [], + "object": "campaign", + "promotion": { + "object": "list", + "data_ref": "tiers", + "tiers": [], + "total": 0, + "has_more": false + } +} diff --git a/__tests__/snapshots/campaigns/createdValidationRuleApplicableTo.json b/__tests__/snapshots/campaigns/createdValidationRuleApplicableTo.json new file mode 100644 index 0000000..c468186 --- /dev/null +++ b/__tests__/snapshots/campaigns/createdValidationRuleApplicableTo.json @@ -0,0 +1,34 @@ +{ + "name": "YFMukqDqnb", + "rules": [], + "error": null, + "applicable_to": { + "excluded": null, + "included": [ + { + "object": "product", + "id": "prod_0f267312dac8058d06", + "source_id": null, + "product_id": null, + "product_source_id": null, + "strict": false, + "price": null, + "price_formula": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": null, + "aggregated_quantity_limit": null, + "amount_limit": null, + "aggregated_amount_limit": null, + "order_item_indices": null + } + ], + "included_all": false + }, + "type": "basic", + "context_type": "global", + "id": "val_LxzewGp59iIK", + "created_at": "2024-08-02T11:32:23+00:00", + "updated_at": null, + "assignments_count": null, + "object": "validation_rules" +} diff --git a/__tests__/snapshots/campaigns/createdValidationRuleMoreThan.json b/__tests__/snapshots/campaigns/createdValidationRuleMoreThan.json new file mode 100644 index 0000000..eb03419 --- /dev/null +++ b/__tests__/snapshots/campaigns/createdValidationRuleMoreThan.json @@ -0,0 +1,22 @@ +{ + "name": "FxmNqTrDn0", + "rules": { + "1": { + "name": "order.amount", + "conditions": { + "$more_than": [500000] + }, + "rules": {} + }, + "logic": "1" + }, + "error": null, + "applicable_to": null, + "type": "basic", + "context_type": "global", + "id": "val_tdKWWozwHAjd", + "created_at": "2024-09-04T10:17:53+00:00", + "updated_at": null, + "assignments_count": null, + "object": "validation_rules" +} diff --git a/__tests__/snapshots/customers/createdCustomer.json b/__tests__/snapshots/customers/createdCustomer.json new file mode 100644 index 0000000..10f179f --- /dev/null +++ b/__tests__/snapshots/customers/createdCustomer.json @@ -0,0 +1,58 @@ +{ + "id": "cust_lx90NbayUfXq2HrnU5CS6yyh", + "source_id": "3aqjazWlPu", + "summary": { + "redemptions": { + "total_redeemed": 0, + "total_failed": 0, + "total_succeeded": 0, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 0 + } + }, + "orders": { + "total_amount": 0, + "total_count": 0, + "average_amount": 0, + "last_order_amount": 0, + "last_order_date": null + } + }, + "loyalty": { + "points": 0, + "referred_customers": 0, + "campaigns": [] + }, + "referrals": { + "total": 0, + "campaigns": [] + }, + "system_metadata": [], + "created_at": "2024-08-02T11:41:31+00:00", + "updated_at": null, + "assets": null, + "object": "customer", + "name": "John Doe", + "description": null, + "email": null, + "phone": null, + "birthday": null, + "birthdate": null, + "address": { + "city": "New York", + "state": null, + "line_1": "5th Avenue", + "line_2": "1/2", + "country": "US", + "postal_code": "11-111" + }, + "metadata": null +} diff --git a/__tests__/snapshots/customers/deletedCustomerPermanently.json b/__tests__/snapshots/customers/deletedCustomerPermanently.json new file mode 100644 index 0000000..de882a9 --- /dev/null +++ b/__tests__/snapshots/customers/deletedCustomerPermanently.json @@ -0,0 +1,17 @@ +{ + "id": "del_HEWX3b5GZTUAtROD9nmr124n", + "created_at": "2024-07-31T11:07:16+00:00", + "related_object_id": "cust_oUSA4t0C1d1L5WXOEyE73GSg", + "related_object": "customer", + "status": "DONE", + "data_json": { + "events": 0, + "customer_events": null, + "daily_events": 0, + "segments": 0, + "orders": 1, + "order_events": null, + "customer": 1 + }, + "object": "pernament_deletion" +} diff --git a/__tests__/snapshots/events/createdEvent.json b/__tests__/snapshots/events/createdEvent.json new file mode 100644 index 0000000..62cc51a --- /dev/null +++ b/__tests__/snapshots/events/createdEvent.json @@ -0,0 +1,14 @@ +{ + "object": "event", + "type": "test-event", + "customer": { + "id": "cust_t10PA85aLTW0t5iWX6jayAkI", + "source_id": "test-customer", + "name": null, + "email": null, + "metadata": null, + "object": "customer" + }, + "referral": null, + "loyalty": null +} diff --git a/__tests__/snapshots/loyalties/listedLoyaltyMemberCardTransactions.json b/__tests__/snapshots/loyalties/listedLoyaltyMemberCardTransactions.json new file mode 100644 index 0000000..5ba88eb --- /dev/null +++ b/__tests__/snapshots/loyalties/listedLoyaltyMemberCardTransactions.json @@ -0,0 +1,75 @@ +{ + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "vtx_0f26818b5548058f1a", + "source_id": null, + "voucher_id": "v_uMSsaZiN4SgrLv3D6WPTsjSVbrXqvvHM", + "campaign_id": "camp_MtDZCfUCDfWChsfipxq2kwuX", + "source": null, + "reason": null, + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 13000, + "object": "balance", + "points": 2000, + "balance": 13000, + "related_object": { + "id": "v_uMSsaZiN4SgrLv3D6WPTsjSVbrXqvvHM", + "type": "voucher" + } + }, + "order": null, + "event": null, + "earning_rule": null, + "segment": null, + "loyalty_tier": null, + "redemption": null, + "rollback": null, + "custom_event": null, + "event_schema": null, + "reward": null + }, + "related_transaction_id": null, + "created_at": "2024-08-02T12:35:33+00:00" + }, + { + "id": "vtx_0f268186d4803ac4f9", + "source_id": "X3uJklzyj3", + "voucher_id": "v_uMSsaZiN4SgrLv3D6WPTsjSVbrXqvvHM", + "campaign_id": "camp_MtDZCfUCDfWChsfipxq2kwuX", + "source": "API", + "reason": "Regular customer", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 11000, + "object": "balance", + "points": 10000, + "balance": 11000, + "related_object": { + "id": "v_uMSsaZiN4SgrLv3D6WPTsjSVbrXqvvHM", + "type": "voucher" + } + }, + "order": null, + "event": null, + "earning_rule": null, + "segment": null, + "loyalty_tier": null, + "redemption": null, + "rollback": null, + "custom_event": null, + "event_schema": null, + "reward": null + }, + "related_transaction_id": null, + "created_at": "2024-08-02T12:35:29+00:00" + } + ], + "has_more": false +} diff --git a/__tests__/snapshots/loyalties/updatedLoyaltyMemberCardBalanceBy1000Points.json b/__tests__/snapshots/loyalties/updatedLoyaltyMemberCardBalanceBy1000Points.json new file mode 100644 index 0000000..7c002ed --- /dev/null +++ b/__tests__/snapshots/loyalties/updatedLoyaltyMemberCardBalanceBy1000Points.json @@ -0,0 +1,12 @@ +{ + "points": 2000, + "total": 13000, + "balance": 13000, + "type": "loyalty_card", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_25WrWM56s05CbzL55QB4ierj2PyKjjkf" + }, + "operation_type": "MANUAL" +} diff --git a/__tests__/snapshots/orders/createdOrder.json b/__tests__/snapshots/orders/createdOrder.json new file mode 100644 index 0000000..e938773 --- /dev/null +++ b/__tests__/snapshots/orders/createdOrder.json @@ -0,0 +1,87 @@ +{ + "id": "ord_0f526da9f628175c22", + "source_id": null, + "status": "CREATED", + "amount": 10000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 10000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": [ + { + "id": null, + "sku_id": null, + "product_id": null, + "related_object": null, + "source_id": null, + "quantity": 1, + "discount_quantity": null, + "initial_quantity": null, + "amount": null, + "discount_amount": null, + "applied_discount_amount": null, + "applied_discount_quantity": null, + "applied_quantity": null, + "applied_quantity_amount": null, + "initial_amount": null, + "price": null, + "subtotal_amount": null, + "product": { + "id": null, + "source_id": null, + "override": null, + "name": "test-order-item1", + "metadata": null, + "price": null + }, + "sku": null, + "object": "order_item", + "metadata": null + }, + { + "id": null, + "sku_id": null, + "product_id": null, + "related_object": null, + "source_id": null, + "quantity": 1, + "discount_quantity": null, + "initial_quantity": null, + "amount": null, + "discount_amount": null, + "applied_discount_amount": null, + "applied_discount_quantity": null, + "applied_quantity": null, + "applied_quantity_amount": null, + "initial_amount": null, + "price": null, + "subtotal_amount": null, + "product": { + "id": null, + "source_id": null, + "override": null, + "name": "test-order-item2", + "metadata": null, + "price": null + }, + "sku": null, + "object": "order_item", + "metadata": null + } + ], + "metadata": null, + "object": "order", + "created_at": "2024-09-05T15:21:52+00:00", + "updated_at": null, + "customer_id": "cust_CF5ZjdMoEEkUKkKCC89T3tGd", + "referrer_id": null, + "customer": { + "id": "cust_CF5ZjdMoEEkUKkKCC89T3tGd", + "object": "customer" + }, + "redemptions": null +} diff --git a/__tests__/snapshots/orders/getOrder.json b/__tests__/snapshots/orders/getOrder.json new file mode 100644 index 0000000..4b1e9c0 --- /dev/null +++ b/__tests__/snapshots/orders/getOrder.json @@ -0,0 +1,85 @@ +{ + "id": "ord_0f50effd8d8104db06", + "source_id": null, + "status": "CREATED", + "amount": 10000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 10000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": [ + { + "sku_id": null, + "product_id": null, + "related_object": null, + "source_id": null, + "quantity": 1, + "discount_quantity": null, + "initial_quantity": null, + "amount": null, + "discount_amount": null, + "applied_discount_amount": null, + "applied_discount_quantity": null, + "applied_quantity": null, + "applied_quantity_amount": null, + "initial_amount": null, + "price": null, + "subtotal_amount": null, + "product": { + "id": null, + "source_id": null, + "override": null, + "name": "test-order-item1", + "metadata": null, + "price": null + }, + "sku": null, + "object": "order_item", + "metadata": null + }, + { + "sku_id": null, + "product_id": null, + "related_object": null, + "source_id": null, + "quantity": 1, + "discount_quantity": null, + "initial_quantity": null, + "amount": null, + "discount_amount": null, + "applied_discount_amount": null, + "applied_discount_quantity": null, + "applied_quantity": null, + "applied_quantity_amount": null, + "initial_amount": null, + "price": null, + "subtotal_amount": null, + "product": { + "id": null, + "source_id": null, + "override": null, + "name": "test-order-item2", + "metadata": null, + "price": null + }, + "sku": null, + "object": "order_item", + "metadata": null + } + ], + "metadata": null, + "object": "order", + "created_at": "2024-09-04T11:34:18+00:00", + "updated_at": null, + "customer_id": "cust_7FaDMv795IH11bXa0Ur8qrhV", + "referrer_id": null, + "customer": { + "id": "cust_7FaDMv795IH11bXa0Ur8qrhV", + "object": "customer" + }, + "redemptions": null +} diff --git a/__tests__/snapshots/orders/updatedOrder.json b/__tests__/snapshots/orders/updatedOrder.json new file mode 100644 index 0000000..612211b --- /dev/null +++ b/__tests__/snapshots/orders/updatedOrder.json @@ -0,0 +1,87 @@ +{ + "id": "ord_0f526e209e4a4c9e99", + "source_id": null, + "status": "PAID", + "amount": 30000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 30000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": [ + { + "id": null, + "sku_id": null, + "product_id": null, + "related_object": null, + "source_id": null, + "quantity": 1, + "discount_quantity": null, + "initial_quantity": null, + "amount": null, + "discount_amount": null, + "applied_discount_amount": null, + "applied_discount_quantity": null, + "applied_quantity": null, + "applied_quantity_amount": null, + "initial_amount": null, + "price": null, + "subtotal_amount": null, + "product": { + "id": null, + "source_id": null, + "override": null, + "name": "test-order-item1", + "metadata": null, + "price": null + }, + "sku": null, + "object": "order_item", + "metadata": null + }, + { + "id": null, + "sku_id": null, + "product_id": null, + "related_object": null, + "source_id": null, + "quantity": 1, + "discount_quantity": null, + "initial_quantity": null, + "amount": null, + "discount_amount": null, + "applied_discount_amount": null, + "applied_discount_quantity": null, + "applied_quantity": null, + "applied_quantity_amount": null, + "initial_amount": null, + "price": null, + "subtotal_amount": null, + "product": { + "id": null, + "source_id": null, + "override": null, + "name": "test-order-item2", + "metadata": null, + "price": null + }, + "sku": null, + "object": "order_item", + "metadata": null + } + ], + "metadata": null, + "object": "order", + "created_at": "2024-09-05T15:23:53+00:00", + "updated_at": "2024-09-05T15:23:54+00:00", + "customer_id": "cust_plkTtDLK659HBmBXCjDkwzOK", + "referrer_id": null, + "customer": { + "id": "cust_plkTtDLK659HBmBXCjDkwzOK", + "object": "customer" + }, + "redemptions": null +} diff --git a/__tests__/snapshots/products/createdProduct.json b/__tests__/snapshots/products/createdProduct.json new file mode 100644 index 0000000..af5b8d3 --- /dev/null +++ b/__tests__/snapshots/products/createdProduct.json @@ -0,0 +1,12 @@ +{ + "id": "prod_0f50dba1c30104a506", + "source_id": "ckIfVOy1oT", + "name": "wQeIqIunNI", + "price": 20000, + "attributes": ["color", "memory", "processor"], + "metadata": [], + "image_url": null, + "created_at": "2024-09-04T10:05:22+00:00", + "updated_at": null, + "object": "product" +} diff --git a/__tests__/snapshots/products/createdProduct2.json b/__tests__/snapshots/products/createdProduct2.json new file mode 100644 index 0000000..e9e6fcf --- /dev/null +++ b/__tests__/snapshots/products/createdProduct2.json @@ -0,0 +1,12 @@ +{ + "id": "prod_0f2670a856803a81fa", + "source_id": "EQKK6DQjAY", + "name": "oAzru8dkVD", + "price": 60000, + "attributes": ["color", "memory", "processor"], + "metadata": [], + "image_url": null, + "created_at": "2024-08-02T11:21:47+00:00", + "updated_at": null, + "object": "product" +} diff --git a/__tests__/snapshots/products/createdSku.json b/__tests__/snapshots/products/createdSku.json new file mode 100644 index 0000000..a42d801 --- /dev/null +++ b/__tests__/snapshots/products/createdSku.json @@ -0,0 +1,18 @@ +{ + "id": "sku_0f26727288803aafdb", + "source_id": "kYSxiYSSyC", + "product_id": "prod_0f26727114803aafc7", + "sku": null, + "price": 5000, + "currency": null, + "attributes": { + "color": "red", + "memory": "16GB", + "processor": "Intel Core i7" + }, + "image_url": null, + "metadata": [], + "created_at": "2024-08-02T11:29:36+00:00", + "updated_at": null, + "object": "sku" +} diff --git a/__tests__/snapshots/products/getSku.json b/__tests__/snapshots/products/getSku.json new file mode 100644 index 0000000..659e315 --- /dev/null +++ b/__tests__/snapshots/products/getSku.json @@ -0,0 +1,18 @@ +{ + "id": "sku_0f1c3fc53e88058ed8", + "source_id": "yXLsMVRYGx", + "product_id": "prod_0f1c3fc3c748058eb1", + "sku": null, + "price": 2000, + "currency": null, + "attributes": { + "color": "red", + "memory": "16GB", + "processor": "Intel Core i7" + }, + "image_url": null, + "metadata": [], + "created_at": "2024-07-25T13:23:23+00:00", + "updated_at": "2024-07-25T13:23:23+00:00", + "object": "sku" +} diff --git a/__tests__/snapshots/products/listedSkusInProducts.json b/__tests__/snapshots/products/listedSkusInProducts.json new file mode 100644 index 0000000..889fe2a --- /dev/null +++ b/__tests__/snapshots/products/listedSkusInProducts.json @@ -0,0 +1,25 @@ +{ + "object": "list", + "data_ref": "skus", + "skus": [ + { + "id": "sku_0f2278df8dc805aaa3", + "source_id": "T6xdIJ72yY", + "product_id": "prod_0f2278ddf84805aa5b", + "sku": null, + "price": 2000, + "currency": null, + "attributes": { + "color": "red", + "memory": "16GB", + "processor": "Intel Core i7" + }, + "image_url": null, + "metadata": [], + "created_at": "2024-07-30T09:23:45+00:00", + "updated_at": "2024-07-30T09:23:45+00:00", + "object": "sku" + } + ], + "total": 1 +} diff --git a/__tests__/snapshots/products/updatedProduct.json b/__tests__/snapshots/products/updatedProduct.json new file mode 100644 index 0000000..b8b8159 --- /dev/null +++ b/__tests__/snapshots/products/updatedProduct.json @@ -0,0 +1,12 @@ +{ + "id": "prod_0f2671239e003a8e14", + "source_id": "igqKGeFMd5", + "name": "4H3hhh5ZrW", + "price": 55000, + "attributes": ["color", "memory", "processor"], + "metadata": [], + "image_url": null, + "created_at": "2024-08-02T11:23:53+00:00", + "updated_at": "2024-08-02T11:23:53+00:00", + "object": "product" +} diff --git a/__tests__/snapshots/products/updatedSku.json b/__tests__/snapshots/products/updatedSku.json new file mode 100644 index 0000000..52fdba4 --- /dev/null +++ b/__tests__/snapshots/products/updatedSku.json @@ -0,0 +1,18 @@ +{ + "id": "sku_0f2672a77b003ab6b5", + "source_id": "MkESBauckM", + "product_id": "prod_0f2672a5d6c03ab66d", + "sku": null, + "price": 2000, + "currency": null, + "attributes": { + "color": "red", + "memory": "16GB", + "processor": "Intel Core i7" + }, + "image_url": null, + "metadata": [], + "created_at": "2024-08-02T11:30:30+00:00", + "updated_at": "2024-08-02T11:30:30+00:00", + "object": "sku" +} diff --git a/__tests__/snapshots/publications/createdPublication.json b/__tests__/snapshots/publications/createdPublication.json new file mode 100644 index 0000000..d91c59b --- /dev/null +++ b/__tests__/snapshots/publications/createdPublication.json @@ -0,0 +1,93 @@ +{ + "id": "pub_E80vbkTU4q1ISx2DukUVtWd8zcQnmHIb", + "object": "publication", + "created_at": "2024-09-05T14:28:51+00:00", + "customer_id": "cust_1e4yReLJg9XsJxQuK2XpPGaG", + "tracking_id": "BgBDSkz6ov", + "metadata": [], + "channel": "API", + "source_id": null, + "result": "SUCCESS", + "customer": { + "id": "cust_1e4yReLJg9XsJxQuK2XpPGaG", + "source_id": "BgBDSkz6ov", + "system_metadata": null, + "created_at": null, + "updated_at": null, + "assets": null, + "object": "customer", + "name": "John Doe", + "description": null, + "email": null, + "phone": null, + "birthday": null, + "birthdate": null, + "address": null, + "metadata": null + }, + "vouchers_id": ["v_mi3Au36An0LiMJPSc0SnM4yq4LhwIy3G"], + "voucher": { + "id": "v_mi3Au36An0LiMJPSc0SnM4yq4LhwIy3G", + "code": "aflktwUK", + "campaign": "beLQc6RyOW", + "campaign_id": "camp_AF29AHx1uu2z119NQEmPPk2F", + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "assets": { + "qr": { + "id": "b97efa40-be08-4f2a-b497-6a1632365d4a", + "url": "https://dev2.dl.voucherify.io/api/v1/assets/qr/b97efa40-be08-4f2a-b497-6a1632365d4a" + }, + "barcode": { + "id": "281c49f6-b89c-4a01-99b8-1decf94a40f8", + "url": "https://dev2.dl.voucherify.io/api/v1/assets/barcode/281c49f6-b89c-4a01-99b8-1decf94a40f8" + } + }, + "is_referral_code": false, + "created_at": "2024-09-05T14:28:49+00:00", + "updated_at": "2024-09-05T14:28:51+00:00", + "holder_id": "cust_1e4yReLJg9XsJxQuK2XpPGaG", + "referrer_id": null, + "object": "voucher", + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/aflktwUK/publications?page=1&limit=10" + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": null, + "object": "list", + "url": "/v1/vouchers/aflktwUK/redemptions?page=1&limit=10" + }, + "categories": [] + }, + "vouchers": null +} diff --git a/__tests__/snapshots/qualifications/checkedEligibility.json b/__tests__/snapshots/qualifications/checkedEligibility.json new file mode 100644 index 0000000..3a4e0c2 --- /dev/null +++ b/__tests__/snapshots/qualifications/checkedEligibility.json @@ -0,0 +1,406 @@ +{ + "redeemables": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "xRtmGye7", + "object": "voucher", + "created_at": "2024-09-04T10:54:03+00:00", + "result": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": "APPLY_TO_ITEMS", + "is_dynamic": false, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + } + }, + "order": { + "id": null, + "source_id": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "object": "order", + "created_at": null, + "updated_at": null, + "customer_id": null, + "referrer_id": null, + "customer": null, + "referrer": null, + "redemptions": null + }, + "validation_rule_id": null, + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0f50e6c2c60de1ffc7", + "source_id": null, + "product_id": null, + "product_source_id": null, + "strict": false, + "price": null, + "price_formula": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": null, + "aggregated_quantity_limit": null, + "amount_limit": null, + "aggregated_amount_limit": null, + "order_item_indices": null + } + ], + "total": 1, + "object": "list", + "data_ref": "data" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "object": "list", + "data_ref": "data" + }, + "metadata": null, + "categories": null, + "banner": null, + "name": null, + "campaign_name": null, + "campaign_id": null, + "redeemables": null + }, + { + "id": "camp_oMX6x73mQ2a1qHr7E5eHNww5", + "object": "campaign", + "created_at": "2024-09-04T10:54:03+00:00", + "result": { + "loyalty_card": { + "points": 0, + "balance": 1000, + "exchange_ratio": null, + "points_ratio": null, + "transfers": null + } + }, + "order": { + "id": null, + "source_id": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "object": "order", + "created_at": null, + "updated_at": null, + "customer_id": null, + "referrer_id": null, + "customer": null, + "referrer": null, + "redemptions": null + }, + "validation_rule_id": null, + "applicable_to": { + "data": [], + "total": 0, + "object": "list", + "data_ref": "data" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "object": "list", + "data_ref": "data" + }, + "metadata": null, + "categories": null, + "banner": null, + "name": null, + "campaign_name": null, + "campaign_id": null, + "redeemables": null + }, + { + "id": "camp_AYMExOYuIfFdy2hsLjgygla5", + "object": "campaign", + "created_at": "2024-09-04T10:54:02+00:00", + "result": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": "APPLY_TO_ITEMS", + "is_dynamic": false, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + } + }, + "order": { + "id": null, + "source_id": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "object": "order", + "created_at": null, + "updated_at": null, + "customer_id": null, + "referrer_id": null, + "customer": null, + "referrer": null, + "redemptions": null + }, + "validation_rule_id": null, + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0f50e6c2c60de1ffc7", + "source_id": null, + "product_id": null, + "product_source_id": null, + "strict": false, + "price": null, + "price_formula": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": null, + "aggregated_quantity_limit": null, + "amount_limit": null, + "aggregated_amount_limit": null, + "order_item_indices": null + } + ], + "total": 1, + "object": "list", + "data_ref": "data" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "object": "list", + "data_ref": "data" + }, + "metadata": null, + "categories": null, + "banner": null, + "name": null, + "campaign_name": null, + "campaign_id": null, + "redeemables": null + }, + { + "id": "camp_rAqTVAb1bVFxHrJUCMfRRZSI", + "object": "campaign", + "created_at": "2024-09-04T10:52:37+00:00", + "result": { + "loyalty_card": { + "points": 0, + "balance": 1000, + "exchange_ratio": null, + "points_ratio": null, + "transfers": null + } + }, + "order": { + "id": null, + "source_id": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "object": "order", + "created_at": null, + "updated_at": null, + "customer_id": null, + "referrer_id": null, + "customer": null, + "referrer": null, + "redemptions": null + }, + "validation_rule_id": null, + "applicable_to": { + "data": [], + "total": 0, + "object": "list", + "data_ref": "data" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "object": "list", + "data_ref": "data" + }, + "metadata": null, + "categories": null, + "banner": null, + "name": null, + "campaign_name": null, + "campaign_id": null, + "redeemables": null + }, + { + "id": "camp_LHEm115jsw7XdvfpXn7Gh6Zz", + "object": "campaign", + "created_at": "2024-09-04T10:52:37+00:00", + "result": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": "APPLY_TO_ITEMS", + "is_dynamic": false, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + } + }, + "order": { + "id": null, + "source_id": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "object": "order", + "created_at": null, + "updated_at": null, + "customer_id": null, + "referrer_id": null, + "customer": null, + "referrer": null, + "redemptions": null + }, + "validation_rule_id": null, + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0f50e66fbe8104d01f", + "source_id": null, + "product_id": null, + "product_source_id": null, + "strict": false, + "price": null, + "price_formula": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": null, + "aggregated_quantity_limit": null, + "amount_limit": null, + "aggregated_amount_limit": null, + "order_item_indices": null + } + ], + "total": 1, + "object": "list", + "data_ref": "data" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "object": "list", + "data_ref": "data" + }, + "metadata": null, + "categories": null, + "banner": null, + "name": null, + "campaign_name": null, + "campaign_id": null, + "redeemables": null + } + ], + "total": 5, + "has_more": true, + "more_starting_after": "2024-09-04T10:52:37+00:00" + }, + "tracking_id": "track_celJ4xALxdxUZt6U5dityQ==", + "order": { + "status": null, + "amount": 20000, + "discount_amount": null, + "initial_amount": null, + "items": null, + "customer_id": null, + "referrer_id": null, + "metadata": [], + "created_at": null, + "updated_at": null + }, + "stacking_rules": { + "redeemables_limit": 30, + "applicable_redeemables_limit": 5, + "applicable_redeemables_per_category_limit": null, + "applicable_exclusive_redeemables_limit": 1, + "applicable_exclusive_redeemables_per_category_limit": null, + "exclusive_categories": [], + "joint_categories": [], + "redeemables_application_mode": "ALL", + "redeemables_sorting_rule": "REQUESTED_ORDER" + } +} diff --git a/__tests__/snapshots/redemptions/redeemedStackedApplicableDiscounts.json b/__tests__/snapshots/redemptions/redeemedStackedApplicableDiscounts.json new file mode 100644 index 0000000..0339301 --- /dev/null +++ b/__tests__/snapshots/redemptions/redeemedStackedApplicableDiscounts.json @@ -0,0 +1,133 @@ +{ + "redemptions": [ + { + "id": "r_0f251d3e578805f8e9", + "object": "redemption", + "date": "2024-08-01T10:38:51+00:00", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "amount": null, + "redemption": null, + "result": "SUCCESS", + "status": "SUCCEEDED", + "related_redemptions": null, + "failure_code": null, + "failure_message": null, + "order": { + "id": "ord_0f251d3e518805f8e2", + "source_id": null, + "created_at": "2024-08-01T10:38:51+00:00", + "updated_at": null, + "status": "PAID", + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": 0, + "items_applied_discount_amount": null, + "total_applied_discount_amount": 0, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": null + }, + "channel": null, + "customer": null, + "related_object_type": null, + "related_object_id": null, + "voucher": { + "id": "v_JGIBUNPGr1tk5rcvNuRMO5Bj93MAHID6", + "code": "nCklW10j", + "campaign": "i9KNcb5z4U", + "campaign_id": "camp_jM1RLSqDmA0wNPEBYOAAVmIN", + "category": null, + "category_id": null, + "categories": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "is_referral_code": false, + "created_at": "2024-08-01T10:38:46+00:00", + "updated_at": "2024-08-01T10:38:51+00:00", + "holder_id": null, + "referrer_id": null, + "object": "voucher", + "publish": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": null, + "object": null, + "url": null + } + }, + "gift": null, + "loyalty_card": null + } + ], + "order": { + "id": "ord_0f251d3e518805f8e2", + "source_id": null, + "created_at": "2024-08-01T10:38:51+00:00", + "updated_at": null, + "status": "PAID", + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": 0, + "items_applied_discount_amount": null, + "total_applied_discount_amount": 0, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0f251d3e578805f8e9": { + "date": "2024-08-01T10:38:51+00:00", + "rollback_id": null, + "rollback_date": null, + "related_object_type": "voucher", + "related_object_id": "v_JGIBUNPGr1tk5rcvNuRMO5Bj93MAHID6", + "related_object_parent_id": "camp_jM1RLSqDmA0wNPEBYOAAVmIN", + "stacked": null, + "rollback_stacked": null + } + }, + "customer": null, + "referrer": null + }, + "inapplicable_redeemables": [], + "skipped_redeemables": [] +} diff --git a/__tests__/snapshots/redemptions/redeemedStackedSkippedDiscounts.json b/__tests__/snapshots/redemptions/redeemedStackedSkippedDiscounts.json new file mode 100644 index 0000000..f0b232d --- /dev/null +++ b/__tests__/snapshots/redemptions/redeemedStackedSkippedDiscounts.json @@ -0,0 +1,876 @@ +{ + "redemptions": [ + { + "id": "r_0f25294128803aba1a", + "object": "redemption", + "date": "2024-08-01T11:31:20+00:00", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "amount": null, + "redemption": "r_0f25294126c03aba19", + "result": "SUCCESS", + "status": "SUCCEEDED", + "related_redemptions": null, + "failure_code": null, + "failure_message": null, + "order": { + "id": "ord_0f25294119c03aba12", + "source_id": null, + "created_at": null, + "updated_at": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": null + }, + "channel": null, + "customer": null, + "related_object_type": null, + "related_object_id": null, + "voucher": { + "id": "v_eUaHyZPZ58Pmq2XdY47AzL5EcY2j0Xwj", + "code": "TsWbEYQw", + "campaign": "9xWjRdwN4E", + "campaign_id": "camp_M8vTVy3shjwO0Qfz55baMhDE", + "category": null, + "category_id": null, + "categories": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "is_referral_code": false, + "created_at": "2024-08-01T11:31:17+00:00", + "updated_at": "2024-08-01T11:31:20+00:00", + "holder_id": null, + "referrer_id": null, + "object": "voucher", + "publish": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": null, + "object": null, + "url": null + } + }, + "gift": null, + "loyalty_card": null + }, + { + "id": "r_0f25294128803aba1b", + "object": "redemption", + "date": "2024-08-01T11:31:20+00:00", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "amount": null, + "redemption": "r_0f25294126c03aba19", + "result": "SUCCESS", + "status": "SUCCEEDED", + "related_redemptions": null, + "failure_code": null, + "failure_message": null, + "order": { + "id": "ord_0f25294119c03aba12", + "source_id": null, + "created_at": null, + "updated_at": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": null + }, + "channel": null, + "customer": null, + "related_object_type": null, + "related_object_id": null, + "voucher": { + "id": "v_KIh6pj9zVxt7WAVpDWbdfvea0wugzgOi", + "code": "852ODzvC", + "campaign": "9xWjRdwN4E", + "campaign_id": "camp_M8vTVy3shjwO0Qfz55baMhDE", + "category": null, + "category_id": null, + "categories": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "is_referral_code": false, + "created_at": "2024-08-01T11:31:17+00:00", + "updated_at": "2024-08-01T11:31:20+00:00", + "holder_id": null, + "referrer_id": null, + "object": "voucher", + "publish": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": null, + "object": null, + "url": null + } + }, + "gift": null, + "loyalty_card": null + }, + { + "id": "r_0f25294128803aba1c", + "object": "redemption", + "date": "2024-08-01T11:31:20+00:00", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "amount": null, + "redemption": "r_0f25294126c03aba19", + "result": "SUCCESS", + "status": "SUCCEEDED", + "related_redemptions": null, + "failure_code": null, + "failure_message": null, + "order": { + "id": "ord_0f25294119c03aba12", + "source_id": null, + "created_at": null, + "updated_at": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": null + }, + "channel": null, + "customer": null, + "related_object_type": null, + "related_object_id": null, + "voucher": { + "id": "v_5UTdYv1x0kAB61qfUNAj1KfksSUdgQ4c", + "code": "eTbKqoaK", + "campaign": "9xWjRdwN4E", + "campaign_id": "camp_M8vTVy3shjwO0Qfz55baMhDE", + "category": null, + "category_id": null, + "categories": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "is_referral_code": false, + "created_at": "2024-08-01T11:31:17+00:00", + "updated_at": "2024-08-01T11:31:20+00:00", + "holder_id": null, + "referrer_id": null, + "object": "voucher", + "publish": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": null, + "object": null, + "url": null + } + }, + "gift": null, + "loyalty_card": null + }, + { + "id": "r_0f25294128803aba1d", + "object": "redemption", + "date": "2024-08-01T11:31:20+00:00", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "amount": null, + "redemption": "r_0f25294126c03aba19", + "result": "SUCCESS", + "status": "SUCCEEDED", + "related_redemptions": null, + "failure_code": null, + "failure_message": null, + "order": { + "id": "ord_0f25294119c03aba12", + "source_id": null, + "created_at": null, + "updated_at": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": null + }, + "channel": null, + "customer": null, + "related_object_type": null, + "related_object_id": null, + "voucher": { + "id": "v_QbphkEAqlj9EwWVh1lH8ZH7ZrSPEI39V", + "code": "uAA5uuL7", + "campaign": "9xWjRdwN4E", + "campaign_id": "camp_M8vTVy3shjwO0Qfz55baMhDE", + "category": null, + "category_id": null, + "categories": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "is_referral_code": false, + "created_at": "2024-08-01T11:31:17+00:00", + "updated_at": "2024-08-01T11:31:20+00:00", + "holder_id": null, + "referrer_id": null, + "object": "voucher", + "publish": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": null, + "object": null, + "url": null + } + }, + "gift": null, + "loyalty_card": null + }, + { + "id": "r_0f25294128803aba1e", + "object": "redemption", + "date": "2024-08-01T11:31:20+00:00", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "amount": null, + "redemption": "r_0f25294126c03aba19", + "result": "SUCCESS", + "status": "SUCCEEDED", + "related_redemptions": null, + "failure_code": null, + "failure_message": null, + "order": { + "id": "ord_0f25294119c03aba12", + "source_id": null, + "created_at": null, + "updated_at": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": null, + "items_applied_discount_amount": null, + "total_applied_discount_amount": null, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": null + }, + "channel": null, + "customer": null, + "related_object_type": null, + "related_object_id": null, + "voucher": { + "id": "v_CUVmgEqly4X1Dnw87b6nI9roARu23ssK", + "code": "GXNLaqQw", + "campaign": "9xWjRdwN4E", + "campaign_id": "camp_M8vTVy3shjwO0Qfz55baMhDE", + "category": null, + "category_id": null, + "categories": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "is_referral_code": false, + "created_at": "2024-08-01T11:31:17+00:00", + "updated_at": "2024-08-01T11:31:20+00:00", + "holder_id": null, + "referrer_id": null, + "object": "voucher", + "publish": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": null, + "object": null, + "url": null + } + }, + "gift": null, + "loyalty_card": null + } + ], + "parent_redemption": { + "id": "r_0f25294126c03aba19", + "object": "redemption", + "date": "2024-08-01T11:31:20+00:00", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "amount": null, + "redemption": null, + "result": "SUCCESS", + "status": "SUCCEEDED", + "related_redemptions": null, + "failure_code": null, + "failure_message": null, + "order": { + "id": "ord_0f25294119c03aba12", + "source_id": null, + "created_at": "2024-08-01T11:31:20+00:00", + "updated_at": null, + "status": "PAID", + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": 0, + "items_applied_discount_amount": null, + "total_applied_discount_amount": 0, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": null + }, + "channel": null, + "customer": null, + "related_object_type": null, + "related_object_id": null, + "gift": null, + "loyalty_card": null + }, + "order": { + "id": "ord_0f25294119c03aba12", + "source_id": null, + "created_at": "2024-08-01T11:31:20+00:00", + "updated_at": null, + "status": "PAID", + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": null, + "total_discount_amount": null, + "total_amount": 20000, + "applied_discount_amount": 0, + "items_applied_discount_amount": null, + "total_applied_discount_amount": 0, + "items": null, + "metadata": [], + "customer_id": null, + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0f25294126c03aba19": { + "date": "2024-08-01T11:31:20+00:00", + "rollback_id": null, + "rollback_date": null, + "related_object_type": "redemption", + "related_object_id": "r_0f25294126c03aba19", + "related_object_parent_id": null, + "stacked": [ + "r_0f25294128803aba1a", + "r_0f25294128803aba1b", + "r_0f25294128803aba1c", + "r_0f25294128803aba1d", + "r_0f25294128803aba1e" + ], + "rollback_stacked": null + } + }, + "customer": null, + "referrer": null + }, + "inapplicable_redeemables": [], + "skipped_redeemables": [ + { + "status": "SKIPPED", + "id": "iSqP69t1", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "W1bM0XSu", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "Z28iNrxZ", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "xzANaq2f", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "ROB0vkCI", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "H94TW4kz", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "AFeZFRPu", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "RIquWZCk", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "GjGnLQ90", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "d8T5blZ2", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "RTGzRE6L", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "r1zWdpsn", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "KJPQQUlW", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "n8X3A8QE", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "PAm12j7k", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "vACi9i6K", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "axt2u8KN", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "CvubSbAy", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "tANKHMH0", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "buqqbLex", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "FMv0lrvl", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "JshVkWEO", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "HkqWHRUE", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "FaMbRhzy", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + }, + { + "status": "SKIPPED", + "id": "3suXDgrb", + "object": "voucher", + "result": { + "details": { + "key": "applicable_redeemables_limit_exceeded", + "message": "Applicable redeemables limit exceeded" + } + }, + "metadata": [], + "categories": null + } + ] +} diff --git a/__tests__/snapshots/validationRules/createdValidationRule.json b/__tests__/snapshots/validationRules/createdValidationRule.json new file mode 100644 index 0000000..6073d3d --- /dev/null +++ b/__tests__/snapshots/validationRules/createdValidationRule.json @@ -0,0 +1,8 @@ +{ + "id": "asgm_4FJXckSSnRJyxvFU", + "rule_id": "val_dVFSY5eI7Mj6", + "related_object_id": "v_445OLEbnga3JD4dvL9cXKJfhiHW0yEdM", + "related_object_type": "voucher", + "created_at": "2024-08-02T10:44:46+00:00", + "object": "validation_rules_assignment" +} diff --git a/__tests__/snapshots/validations/validatedStackedApplicableDiscounts.json b/__tests__/snapshots/validations/validatedStackedApplicableDiscounts.json new file mode 100644 index 0000000..6f88006 --- /dev/null +++ b/__tests__/snapshots/validations/validatedStackedApplicableDiscounts.json @@ -0,0 +1,186 @@ +{ + "valid": true, + "redeemables": [ + { + "status": "APPLICABLE", + "id": "ee5YkVxm", + "object": "voucher", + "order": { + "id": null, + "source_id": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": 1000, + "total_discount_amount": 1000, + "total_amount": 19000, + "applied_discount_amount": null, + "items_applied_discount_amount": 1000, + "total_applied_discount_amount": 1000, + "items": [ + { + "id": null, + "sku_id": null, + "product_id": "prod_0f52707d7ee817656c", + "related_object": "product", + "source_id": null, + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": null, + "amount": 20000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "applied_discount_quantity": null, + "applied_quantity": null, + "applied_quantity_amount": null, + "initial_amount": null, + "price": 20000, + "subtotal_amount": 19000, + "product": { + "id": "prod_0f52707d7ee817656c", + "source_id": null, + "override": null, + "name": null, + "metadata": null, + "price": null + }, + "sku": null, + "object": "order_item", + "metadata": null + } + ], + "metadata": [], + "object": "order", + "created_at": null, + "updated_at": null, + "customer_id": null, + "referrer_id": null, + "redemptions": null + }, + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0f52707d7ee817656c", + "source_id": null, + "product_id": null, + "product_source_id": null, + "strict": false, + "price": null, + "price_formula": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": null, + "aggregated_quantity_limit": null, + "amount_limit": null, + "aggregated_amount_limit": null, + "order_item_indices": [0], + "repeat": 1, + "skip_initially": 0, + "target": "ITEM" + } + ], + "total": 1, + "object": "list", + "data_ref": "data" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "object": "list", + "data_ref": "data" + }, + "result": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": "APPLY_TO_ITEMS", + "is_dynamic": false, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null + }, + "metadata": [], + "categories": null + } + ], + "skipped_redeemables": null, + "inapplicable_redeemables": null, + "order": { + "id": null, + "source_id": null, + "status": null, + "amount": 20000, + "initial_amount": null, + "discount_amount": null, + "items_discount_amount": 1000, + "total_discount_amount": 1000, + "total_amount": 19000, + "applied_discount_amount": null, + "items_applied_discount_amount": 1000, + "total_applied_discount_amount": 1000, + "items": [ + { + "id": null, + "sku_id": null, + "product_id": "prod_0f52707d7ee817656c", + "related_object": "product", + "source_id": null, + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": null, + "amount": 20000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "applied_discount_quantity": null, + "applied_quantity": null, + "applied_quantity_amount": null, + "initial_amount": null, + "price": 20000, + "subtotal_amount": 19000, + "product": { + "id": "prod_0f52707d7ee817656c", + "source_id": null, + "override": null, + "name": null, + "metadata": null, + "price": null + }, + "sku": null, + "object": "order_item", + "metadata": null + } + ], + "metadata": [], + "object": "order", + "created_at": null, + "updated_at": null, + "customer_id": null, + "referrer_id": null, + "redemptions": null + }, + "tracking_id": "track_5Xf3G5TGNxnCX5ZDIrkMmg==", + "stacking_rules": { + "redeemables_limit": 30, + "applicable_redeemables_limit": 5, + "applicable_redeemables_per_category_limit": null, + "applicable_exclusive_redeemables_limit": 1, + "applicable_exclusive_redeemables_per_category_limit": null, + "exclusive_categories": [], + "joint_categories": [], + "redeemables_application_mode": "ALL", + "redeemables_sorting_rule": "REQUESTED_ORDER", + "redeemables_products_application_mode": "STACK", + "redeemables_no_effect_rule": "REDEEM_ANYWAY" + } +} diff --git a/__tests__/snapshots/validations/validatedStackedInapplicableDiscounts.json b/__tests__/snapshots/validations/validatedStackedInapplicableDiscounts.json new file mode 100644 index 0000000..313c20c --- /dev/null +++ b/__tests__/snapshots/validations/validatedStackedInapplicableDiscounts.json @@ -0,0 +1,65 @@ +{ + "valid": false, + "redeemables": [ + { + "status": "INAPPLICABLE", + "id": "8XwFdRFN", + "object": "voucher", + "result": { + "gift": null, + "error": { + "code": 400, + "key": "order_rules_violated", + "message": "order does not match validation rules", + "details": "Discount Coupon cannot be redeemed because of violated validation rules: val_vFDNQgDq76ky", + "request_id": "v-0f50ea612f469fd40a", + "resource_id": null, + "resource_type": null + }, + "details": { + "key": "order_rules_violated", + "message": "order does not match validation rules" + } + }, + "metadata": [], + "categories": null + } + ], + "skipped_redeemables": null, + "inapplicable_redeemables": [ + { + "status": "INAPPLICABLE", + "id": "8XwFdRFN", + "object": "voucher", + "result": { + "error": { + "code": 400, + "key": "order_rules_violated", + "message": "order does not match validation rules", + "details": "Discount Coupon cannot be redeemed because of violated validation rules: val_vFDNQgDq76ky", + "request_id": "v-0f50ea612f469fd40a", + "resource_id": null, + "resource_type": null + }, + "details": { + "message": "order does not match validation rules", + "key": "order_rules_violated" + } + }, + "metadata": [], + "categories": null + } + ], + "tracking_id": "track_HZSieN07flFvJ8vZiw4E9g==", + "stacking_rules": { + "redeemables_limit": 30, + "applicable_redeemables_limit": 5, + "applicable_redeemables_per_category_limit": null, + "applicable_exclusive_redeemables_limit": 1, + "applicable_exclusive_redeemables_per_category_limit": null, + "exclusive_categories": [], + "joint_categories": [], + "redeemables_application_mode": "ALL", + "redeemables_sorting_rule": "REQUESTED_ORDER" + } +} diff --git a/__tests__/snapshots/vouchers/disabledVoucher.json b/__tests__/snapshots/vouchers/disabledVoucher.json new file mode 100644 index 0000000..530a6ab --- /dev/null +++ b/__tests__/snapshots/vouchers/disabledVoucher.json @@ -0,0 +1,81 @@ +{ + "id": "v_2C8Z2e6NlA3nKD5vTOrHpmRL4GvvQYJ2", + "code": "kWyXCmFP", + "campaign": "Di5YkGmbRQ", + "campaign_id": "camp_cyuO0e2nOD3lPXLEI2lChac4", + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": false, + "additional_info": null, + "metadata": [], + "assets": { + "qr": { + "id": "262efb7b-d9a8-4edc-bca3-c664fc94c45d", + "url": "https://dl.voucherify.io/api/v1/assets/qr/262efb7b-d9a8-4edc-bca3-c664fc94c45d" + }, + "barcode": { + "id": "3c445d33-b7b8-42a7-9567-967a7e21aafa", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/3c445d33-b7b8-42a7-9567-967a7e21aafa" + } + }, + "is_referral_code": false, + "created_at": "2024-08-02T12:02:31+00:00", + "updated_at": "2024-08-02T12:02:34+00:00", + "holder_id": "cust_Wd3S7riOl01BvtZaIEtTO69w", + "referrer_id": null, + "object": "voucher", + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/kWyXCmFP/publications?page=1&limit=10" + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": null, + "object": "list", + "url": "/v1/vouchers/kWyXCmFP/redemptions?page=1&limit=10" + }, + "categories": [], + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_FpO5nJruiUx1RSwz", + "rule_id": "val_SJzxaKXbasc5", + "related_object_id": "camp_cyuO0e2nOD3lPXLEI2lChac4", + "related_object_type": "campaign", + "created_at": "2024-08-02T12:02:31+00:00", + "updated_at": null, + "object": "validation_rules_assignment", + "validation_status": null, + "validation_omitted_rules": null + } + ], + "total": 1 + } +} diff --git a/__tests__/snapshots/vouchers/updatedLoyaltyCardBalance.json b/__tests__/snapshots/vouchers/updatedLoyaltyCardBalance.json new file mode 100644 index 0000000..361d4e8 --- /dev/null +++ b/__tests__/snapshots/vouchers/updatedLoyaltyCardBalance.json @@ -0,0 +1,12 @@ +{ + "amount": 10000, + "total": 11000, + "balance": 11000, + "type": "loyalty_card", + "operation_type": "MANUAL", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_603CxRWtIC17ORye0aOT5W0tL7nRdhAv" + } +} diff --git a/__tests__/snapshots/vouchers/voucher.json b/__tests__/snapshots/vouchers/voucher.json new file mode 100644 index 0000000..0b13e26 --- /dev/null +++ b/__tests__/snapshots/vouchers/voucher.json @@ -0,0 +1,81 @@ +{ + "id": "v_UTlrjntV5pR5ox9KusK2OjpRMQvdt2j3", + "code": "ojklY0Y5", + "campaign": "Lp98leds7k", + "campaign_id": "camp_zLI3kwtHN9Ap74HxYy7oUZUz", + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "amount_off_formula": null, + "aggregated_amount_limit": null, + "effect": null, + "is_dynamic": null, + "unit_off": null, + "unit_off_formula": null, + "unit_type": null, + "units": null, + "percent_off": null, + "percent_off_formula": null, + "amount_limit": null, + "fixed_amount": null, + "fixed_amount_formula": null + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": [], + "assets": { + "qr": { + "id": "cd2fc7ef-966a-4932-b0d1-2bce44ddb2c2", + "url": "https://dl.voucherify.io/api/v1/assets/qr/cd2fc7ef-966a-4932-b0d1-2bce44ddb2c2" + }, + "barcode": { + "id": "d253d762-df48-4c9b-824c-d132b4f66e43", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/d253d762-df48-4c9b-824c-d132b4f66e43" + } + }, + "is_referral_code": false, + "created_at": "2024-08-02T12:01:51+00:00", + "updated_at": "2024-08-02T12:01:52+00:00", + "holder_id": "cust_jT7V62JdxTg9Ep5eR7sD9Rlf", + "referrer_id": null, + "object": "voucher", + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/ojklY0Y5/publications?page=1&limit=10" + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": null, + "object": "list", + "url": "/v1/vouchers/ojklY0Y5/redemptions?page=1&limit=10" + }, + "categories": [], + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_0WGhayddkebXnOPQ", + "rule_id": "val_BkFmghr1nID0", + "related_object_id": "camp_zLI3kwtHN9Ap74HxYy7oUZUz", + "related_object_type": "campaign", + "created_at": "2024-08-02T12:01:50+00:00", + "updated_at": null, + "object": "validation_rules_assignment", + "validation_status": null, + "validation_omitted_rules": null + } + ], + "total": 1 + } +} diff --git a/codeception.yml b/codeception.yml new file mode 100644 index 0000000..80a823d --- /dev/null +++ b/codeception.yml @@ -0,0 +1,12 @@ +namespace: Tests +support_namespace: Support +paths: + tests: __tests__ + output: __tests__/_output + data: __tests__/Support/Data + support: __tests__/Support + envs: __tests__/_envs +actor_suffix: Tester +extensions: + enabled: + - Codeception\Extension\RunFailed diff --git a/composer.json b/composer.json index 99ec3f1..e18e869 100644 --- a/composer.json +++ b/composer.json @@ -1,21 +1,47 @@ { "name": "rspective/voucherify", - "description": "PHP SDK for Voucherify. Please visit: www.voucherify.io", - "keywords": [ "rspective", "voucherify", "voucher" ], - "homepage": "http://www.voucherify.io/", - "license": "MIT", + "version": "3.0.0", + "description": "Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details.", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } + ], "require": { + "php": "^8.1", "ext-curl": "*", - "ext-json": "*" + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.5", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^9.0" }, "autoload": { - "psr-4": { - "Voucherify\\": "./src", - "Voucherify\\Test\\Helpers\\": "./test/helpers" - } + "psr-4": { "OpenAPI\\Client\\" : "src/" } }, - "require-dev": { - "phpunit/phpunit": "4.8.*", - "php-mock/php-mock": "1.0.*" + "autoload-dev": { + "psr-4": { "OpenAPI\\Client\\Test\\" : "tests/" } + }, + "scripts": { + "test": [ + "@phplint" + ], + "phplint": "phplint" } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 20a2a25..0000000 --- a/composer.lock +++ /dev/null @@ -1,1199 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "15de41bdcebc0c4b57ff4c1d5a8b454a", - "packages": [], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "php-mock/php-mock", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-mock/php-mock.git", - "reference": "bfa2d17d64dbf129073a7ba2051a96ce52749570" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-mock/php-mock/zipball/bfa2d17d64dbf129073a7ba2051a96ce52749570", - "reference": "bfa2d17d64dbf129073a7ba2051a96ce52749570", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpunit/php-text-template": "^1" - }, - "replace": { - "malkusch/php-mock": "*" - }, - "require-dev": { - "phpunit/phpunit": "^4|^5" - }, - "suggest": { - "php-mock/php-mock-mockery": "Allows using PHPMockery for Mockery integration", - "php-mock/php-mock-phpunit": "Allows integration into PHPUnit testcase with the trait PHPMock." - }, - "type": "library", - "autoload": { - "psr-4": { - "phpmock\\": [ - "classes/", - "tests/unit/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "WTFPL" - ], - "authors": [ - { - "name": "Markus Malkusch", - "email": "markus@malkusch.de", - "homepage": "http://markus.malkusch.de", - "role": "Developer" - } - ], - "description": "PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.", - "homepage": "https://github.com/php-mock/php-mock", - "keywords": [ - "BDD", - "TDD", - "function", - "mock", - "stub", - "test", - "test double" - ], - "time": "2015-11-11T22:37:09+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2015-12-27T11:43:31+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.2.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2016-11-25T06:54:22+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2017-03-02T20:05:34+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-10-06T15:47:00+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2016-10-03T07:40:28+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.11", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-02-27T10:12:30+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.36", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-06-21T08:07:12+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-10-02T06:51:40+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-05-22T07:24:03+00:00" - }, - { - "name": "sebastian/environment", - "version": "1.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-08-18T05:49:44+00:00" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-06-17T09:04:28+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03T07:41:43+00:00" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21T13:59:46+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "1f93a8d19b8241617f5074a123e282575b821df8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/1f93a8d19b8241617f5074a123e282575b821df8", - "reference": "1f93a8d19b8241617f5074a123e282575b821df8", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-06-15T12:58:50+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23T20:04:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "ext-curl": "*", - "ext-json": "*" - }, - "platform-dev": [] -} diff --git a/docs/Api/AsyncActionsApi.md b/docs/Api/AsyncActionsApi.md new file mode 100644 index 0000000..0e888c5 --- /dev/null +++ b/docs/Api/AsyncActionsApi.md @@ -0,0 +1,145 @@ +# OpenAPI\Client\AsyncActionsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getAsyncAction()**](AsyncActionsApi.md#getAsyncAction) | **GET** /v1/async-actions/{asyncActionId} | Get Async Action | +| [**listAsyncActions()**](AsyncActionsApi.md#listAsyncActions) | **GET** /v1/async-actions | List Async Actions | + + +## `getAsyncAction()` + +```php +getAsyncAction($asyncActionId): \OpenAPI\Client\Model\AsyncActionGetResponseBody +``` + +Get Async Action + +Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + +### 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\AsyncActionsApi( + // 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 +); +$asyncActionId = 'asyncActionId_example'; // string | Unique ID of the asynchronous operation. + +try { + $result = $apiInstance->getAsyncAction($asyncActionId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AsyncActionsApi->getAsyncAction: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **asyncActionId** | **string**| Unique ID of the asynchronous operation. | | + +### Return type + +[**\OpenAPI\Client\Model\AsyncActionGetResponseBody**](../Model/AsyncActionGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listAsyncActions()` + +```php +listAsyncActions($limit, $endDate): \OpenAPI\Client\Model\AsyncActionsListResponseBody +``` + +List Async Actions + +Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + +### 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\AsyncActionsApi( + // 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 +); +$limit = 56; // int | Limit the number of asynchronous actions that the API returns in the response. +$endDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). + +try { + $result = $apiInstance->listAsyncActions($limit, $endDate); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AsyncActionsApi->listAsyncActions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limit the number of asynchronous actions that the API returns in the response. | [optional] | +| **endDate** | **\DateTime**| Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\AsyncActionsListResponseBody**](../Model/AsyncActionsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[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/CampaignsApi.md b/docs/Api/CampaignsApi.md new file mode 100644 index 0000000..c2cff95 --- /dev/null +++ b/docs/Api/CampaignsApi.md @@ -0,0 +1,779 @@ +# OpenAPI\Client\CampaignsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addVoucherWithSpecificCodeToCampaign()**](CampaignsApi.md#addVoucherWithSpecificCodeToCampaign) | **POST** /v1/campaigns/{campaignId}/vouchers/{code} | Add Voucher with Specific Code to Campaign | +| [**addVouchersToCampaign()**](CampaignsApi.md#addVouchersToCampaign) | **POST** /v1/campaigns/{campaignId}/vouchers | Add Vouchers to Campaign | +| [**createCampaign()**](CampaignsApi.md#createCampaign) | **POST** /v1/campaigns | Create Campaign | +| [**deleteCampaign()**](CampaignsApi.md#deleteCampaign) | **DELETE** /v1/campaigns/{campaignId} | Delete Campaign | +| [**disableCampaign()**](CampaignsApi.md#disableCampaign) | **POST** /v1/campaigns/{campaignId}/disable | Disable Campaign | +| [**enableCampaign()**](CampaignsApi.md#enableCampaign) | **POST** /v1/campaigns/{campaignId}/enable | Enable Campaign | +| [**getCampaign()**](CampaignsApi.md#getCampaign) | **GET** /v1/campaigns/{campaignId} | Get Campaign | +| [**importVouchersToCampaign()**](CampaignsApi.md#importVouchersToCampaign) | **POST** /v1/campaigns/{campaignId}/import | Import Vouchers to Campaign | +| [**importVouchersToCampaignUsingCsv()**](CampaignsApi.md#importVouchersToCampaignUsingCsv) | **POST** /v1/campaigns/{campaignId}/importCSV | Import Vouchers to Campaign by CSV | +| [**listCampaigns()**](CampaignsApi.md#listCampaigns) | **GET** /v1/campaigns | List Campaigns | +| [**updateCampaign()**](CampaignsApi.md#updateCampaign) | **PUT** /v1/campaigns/{campaignId} | Update Campaign | + + +## `addVoucherWithSpecificCodeToCampaign()` + +```php +addVoucherWithSpecificCodeToCampaign($campaignId, $code, $campaignsVouchersCreateRequestBody): \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBody +``` + +Add Voucher with Specific Code to Campaign + +This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. +$code = 'code_example'; // string | A custom **code** that identifies the voucher. +$campaignsVouchersCreateRequestBody = {"category_id":"cat_0bb81a481615a37b5e","start_date":"2022-09-24T00:00:00Z","expiration_date":"2022-09-25T23:59:59Z","active":false,"redemption":{"quantity":null},"additional_info":"Voucher added using API","metadata":{"Season":"Fall"}}; // \OpenAPI\Client\Model\CampaignsVouchersCreateRequestBody | Specify the voucher parameters that you would like to overwrite. + +try { + $result = $apiInstance->addVoucherWithSpecificCodeToCampaign($campaignId, $code, $campaignsVouchersCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->addVoucherWithSpecificCodeToCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | | +| **code** | **string**| A custom **code** that identifies the voucher. | | +| **campaignsVouchersCreateRequestBody** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateRequestBody**](../Model/CampaignsVouchersCreateRequestBody.md)| Specify the voucher parameters that you would like to overwrite. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBody**](../Model/CampaignsVouchersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `addVouchersToCampaign()` + +```php +addVouchersToCampaign($campaignId, $vouchersCount, $campaignsVouchersCreateInBulkRequestBody): \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBody +``` + +Add Vouchers to Campaign + +This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional code_config parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. +$vouchersCount = 56; // int | Number of vouchers that should be added. +$campaignsVouchersCreateInBulkRequestBody = new \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBody(); // \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBody | Specify the voucher parameters that you would like to overwrite. + +try { + $result = $apiInstance->addVouchersToCampaign($campaignId, $vouchersCount, $campaignsVouchersCreateInBulkRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->addVouchersToCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | | +| **vouchersCount** | **int**| Number of vouchers that should be added. | [optional] | +| **campaignsVouchersCreateInBulkRequestBody** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBody**](../Model/CampaignsVouchersCreateInBulkRequestBody.md)| Specify the voucher parameters that you would like to overwrite. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBody**](../Model/CampaignsVouchersCreateCombinedResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createCampaign()` + +```php +createCampaign($campaignsCreateRequestBody): \OpenAPI\Client\Model\CampaignsCreateResponseBody +``` + +Create Campaign + +Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. 📘 Global uniqueness All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. 🚧 Code generation status This is an asynchronous action; you cant read or modify a newly created campaign until the code generation is completed. See the creation_status field in the campaign object description. + +### 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\CampaignsApi( + // 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 +); +$campaignsCreateRequestBody = {"name":"Discount Campaign 4","campaign_type":"DISCOUNT_COUPONS","join_once":true,"type":"AUTO_UPDATE","category_id":"cat_0bb343dee3cdb5ec0c","start_date":"2020-08-16T00:00:00Z","expiration_date":"2023-12-26T00:00:00Z","vouchers_count":3,"voucher":{"type":"DISCOUNT_VOUCHER","discount":{"percent_off":10,"type":"PERCENT"},"redemption":{"quantity":10},"code_config":{"pattern":"10OFF-#######"}},"validity_timeframe":{"interval":"P2D","duration":"P1D"},"validity_day_of_week":[0,1,2],"activity_duration_after_publishing":"P24D","use_voucher_metadata_schema":false,"metadata":{"region":"AMER"}}; // \OpenAPI\Client\Model\CampaignsCreateRequestBody | Specify the details of the campaign that you would like to create. + +try { + $result = $apiInstance->createCampaign($campaignsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->createCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignsCreateRequestBody** | [**\OpenAPI\Client\Model\CampaignsCreateRequestBody**](../Model/CampaignsCreateRequestBody.md)| Specify the details of the campaign that you would like to create. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsCreateResponseBody**](../Model/CampaignsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteCampaign()` + +```php +deleteCampaign($campaignId, $force): \OpenAPI\Client\Model\CampaignsDeleteResponseBody +``` + +Delete Campaign + +Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. +$force = True; // bool | If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. + +try { + $result = $apiInstance->deleteCampaign($campaignId, $force); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->deleteCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | | +| **force** | **bool**| If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsDeleteResponseBody**](../Model/CampaignsDeleteResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `disableCampaign()` + +```php +disableCampaign($campaignId): object +``` + +Disable Campaign + +There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + +try { + $result = $apiInstance->disableCampaign($campaignId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->disableCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | | + +### Return type + +**object** + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `enableCampaign()` + +```php +enableCampaign($campaignId): object +``` + +Enable Campaign + +There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. + +try { + $result = $apiInstance->enableCampaign($campaignId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->enableCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. | | + +### Return type + +**object** + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getCampaign()` + +```php +getCampaign($campaignId): \OpenAPI\Client\Model\CampaignsGetResponseBody +``` + +Get Campaign + +Retrieves the campaign with the given campaign ID or campaign name. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + +try { + $result = $apiInstance->getCampaign($campaignId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->getCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsGetResponseBody**](../Model/CampaignsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `importVouchersToCampaign()` + +```php +importVouchersToCampaign($campaignId, $campaignsImportVoucherItem): \OpenAPI\Client\Model\CampaignsImportCreateResponseBody +``` + +Import Vouchers to Campaign + +Imports vouchers to an **existing** campaign. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. +$campaignsImportVoucherItem = [{"code":"CODE7","category":"First","redemption":{"quantity":1},"metadata":{"season":"Fall"},"additional_info":"secret-code1","active":true},{"code":"CODE8","category":"Second","redemption":{"quantity":18},"metadata":{"season":"Fall"},"additional_info":"secret-code1","active":true},{"code":"CODE9","category_id":"cat_0bb343dee3cdb5ec0c","redemption":{"quantity":4},"metadata":{"season":"Fall"},"additional_info":"secret-code1","active":true}]; // \OpenAPI\Client\Model\CampaignsImportVoucherItem[] | Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. + +try { + $result = $apiInstance->importVouchersToCampaign($campaignId, $campaignsImportVoucherItem); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->importVouchersToCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | | +| **campaignsImportVoucherItem** | [**\OpenAPI\Client\Model\CampaignsImportVoucherItem[]**](../Model/CampaignsImportVoucherItem.md)| Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsImportCreateResponseBody**](../Model/CampaignsImportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `importVouchersToCampaignUsingCsv()` + +```php +importVouchersToCampaignUsingCsv($campaignId, $file): \OpenAPI\Client\Model\CampaignsImportCsvCreateResponseBody +``` + +Import Vouchers to Campaign by CSV + +Imports vouchers to an **existing** campaign. The CSV file has to include headers in the first line. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. +$file = "/path/to/file.txt"; // \SplFileObject | File path. + +try { + $result = $apiInstance->importVouchersToCampaignUsingCsv($campaignId, $file); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->importVouchersToCampaignUsingCsv: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. | | +| **file** | **\SplFileObject****\SplFileObject**| File path. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsImportCsvCreateResponseBody**](../Model/CampaignsImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCampaigns()` + +```php +listCampaigns($limit, $page, $campaignType, $expand, $order): \OpenAPI\Client\Model\CampaignsListResponseBody +``` + +List Campaigns + +Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns. + +### 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\CampaignsApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$campaignType = new \OpenAPI\Client\Model\ParameterCampaignType(); // ParameterCampaignType | This attribute allows filtering by campaign type. +$expand = new \OpenAPI\Client\Model\ParameterExpandListCampaigns(); // ParameterExpandListCampaigns | Include an expanded categories object in the response. +$order = new \OpenAPI\Client\Model\ParameterOrderListCampaigns(); // ParameterOrderListCampaigns | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listCampaigns($limit, $page, $campaignType, $expand, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->listCampaigns: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **campaignType** | [**ParameterCampaignType**](../Model/.md)| This attribute allows filtering by campaign type. | [optional] | +| **expand** | [**ParameterExpandListCampaigns**](../Model/.md)| Include an expanded categories object in the response. | [optional] | +| **order** | [**ParameterOrderListCampaigns**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsListResponseBody**](../Model/CampaignsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCampaign()` + +```php +updateCampaign($campaignId, $campaignsUpdateRequestBody): \OpenAPI\Client\Model\CampaignsUpdateResponseBody +``` + +Update Campaign + +Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. ## Vouchers will be affected This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet. + +### 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\CampaignsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. +$campaignsUpdateRequestBody = {"description":"New description"}; // \OpenAPI\Client\Model\CampaignsUpdateRequestBody | Specify the campaign parameters to be updated. + +try { + $result = $apiInstance->updateCampaign($campaignId, $campaignsUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CampaignsApi->updateCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | | +| **campaignsUpdateRequestBody** | [**\OpenAPI\Client\Model\CampaignsUpdateRequestBody**](../Model/CampaignsUpdateRequestBody.md)| Specify the campaign parameters to be updated. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CampaignsUpdateResponseBody**](../Model/CampaignsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/CategoriesApi.md b/docs/Api/CategoriesApi.md new file mode 100644 index 0000000..7241a6f --- /dev/null +++ b/docs/Api/CategoriesApi.md @@ -0,0 +1,345 @@ +# OpenAPI\Client\CategoriesApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createCategory()**](CategoriesApi.md#createCategory) | **POST** /v1/categories | Create Category | +| [**deleteCategory()**](CategoriesApi.md#deleteCategory) | **DELETE** /v1/categories/{categoryId} | Delete Category | +| [**getCategory()**](CategoriesApi.md#getCategory) | **GET** /v1/categories/{categoryId} | Get Category | +| [**listCategories()**](CategoriesApi.md#listCategories) | **GET** /v1/categories | List Categories | +| [**updateCategory()**](CategoriesApi.md#updateCategory) | **PUT** /v1/categories/{categoryId} | Update Category | + + +## `createCategory()` + +```php +createCategory($categoriesCreateRequestBody): \OpenAPI\Client\Model\CategoriesCreateResponseBody +``` + +Create Category + +Create category with a specific name and hierarchy. + +### 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\CategoriesApi( + // 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 +); +$categoriesCreateRequestBody = {"name":"Eighth","hierarchy":8}; // \OpenAPI\Client\Model\CategoriesCreateRequestBody | Specify the details of the category that you would like to create. + +try { + $result = $apiInstance->createCategory($categoriesCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->createCategory: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **categoriesCreateRequestBody** | [**\OpenAPI\Client\Model\CategoriesCreateRequestBody**](../Model/CategoriesCreateRequestBody.md)| Specify the details of the category that you would like to create. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CategoriesCreateResponseBody**](../Model/CategoriesCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteCategory()` + +```php +deleteCategory($categoryId) +``` + +Delete Category + +Delete a category by the category ID. + +### 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\CategoriesApi( + // 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 +); +$categoryId = 'categoryId_example'; // string | Unique category ID assigned by Voucherify. + +try { + $apiInstance->deleteCategory($categoryId); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->deleteCategory: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **categoryId** | **string**| Unique category ID assigned by Voucherify. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getCategory()` + +```php +getCategory($categoryId): \OpenAPI\Client\Model\CategoriesGetResponseBody +``` + +Get Category + +Retrieve a category by the category ID. + +### 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\CategoriesApi( + // 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 +); +$categoryId = 'categoryId_example'; // string | Unique category ID assigned by Voucherify. + +try { + $result = $apiInstance->getCategory($categoryId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->getCategory: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **categoryId** | **string**| Unique category ID assigned by Voucherify. | | + +### Return type + +[**\OpenAPI\Client\Model\CategoriesGetResponseBody**](../Model/CategoriesGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCategories()` + +```php +listCategories(): \OpenAPI\Client\Model\CategoriesListResponseBody +``` + +List Categories + +List all categories. + +### 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\CategoriesApi( + // 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 +); + +try { + $result = $apiInstance->listCategories(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->listCategories: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\OpenAPI\Client\Model\CategoriesListResponseBody**](../Model/CategoriesListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCategory()` + +```php +updateCategory($categoryId, $categoriesUpdateRequestBody): \OpenAPI\Client\Model\CategoriesUpdateResponseBody +``` + +Update Category + +Update category using the category ID. + +### 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\CategoriesApi( + // 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 +); +$categoryId = 'categoryId_example'; // string | Unique category ID assigned by Voucherify. +$categoriesUpdateRequestBody = {"name":"Summer","hierarchy":1}; // \OpenAPI\Client\Model\CategoriesUpdateRequestBody | Specify the details of the category that you would like to update. + +try { + $result = $apiInstance->updateCategory($categoryId, $categoriesUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->updateCategory: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **categoryId** | **string**| Unique category ID assigned by Voucherify. | | +| **categoriesUpdateRequestBody** | [**\OpenAPI\Client\Model\CategoriesUpdateRequestBody**](../Model/CategoriesUpdateRequestBody.md)| Specify the details of the category that you would like to update. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CategoriesUpdateResponseBody**](../Model/CategoriesUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/ClientSideApi.md b/docs/Api/ClientSideApi.md new file mode 100644 index 0000000..019604c --- /dev/null +++ b/docs/Api/ClientSideApi.md @@ -0,0 +1,361 @@ +# 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) | +| [**listPromotionTiersClientSide()**](ClientSideApi.md#listPromotionTiersClientSide) | **GET** /client/v1/promotions/tiers | List Promotion Tiers (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) | +| [**validateStackedDiscountsClientSide()**](ClientSideApi.md#validateStackedDiscountsClientSide) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) | + + +## `checkEligibilityClientSide()` + +```php +checkEligibilityClientSide($clientQualificationsCheckEligibilityRequestBody): \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, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + +### Example + +```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 +); +$clientQualificationsCheckEligibilityRequestBody = new \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody(); // \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody | Define order and customer context. + +try { + $result = $apiInstance->checkEligibilityClientSide($clientQualificationsCheckEligibilityRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClientSideApi->checkEligibilityClientSide: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **clientQualificationsCheckEligibilityRequestBody** | [**\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) + +## `listPromotionTiersClientSide()` + +```php +listPromotionTiersClientSide($origin, $isAvailable, $limit, $page, $order): \OpenAPI\Client\Model\ClientPromotionsTiersListResponseBody +``` + +List Promotion Tiers (client-side) + +This method enables you to list promotion tiers. + +### 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). +$isAvailable = True; // bool | This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListPromotionTiersClientSide(); // ParameterOrderListPromotionTiersClientSide | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listPromotionTiersClientSide($origin, $isAvailable, $limit, $page, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClientSideApi->listPromotionTiersClientSide: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **origin** | **string**| Indicates the origin (scheme, hostname, and port). | | +| **isAvailable** | **bool**| This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. | [optional] | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListPromotionTiersClientSide**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ClientPromotionsTiersListResponseBody**](../Model/ClientPromotionsTiersListResponseBody.md) + +### Authorization + +[X-Client-Application-Id](../../README.md#X-Client-Application-Id), [X-Client-Token](../../README.md#X-Client-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[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, $clientRedemptionsRedeemRequestBody): \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: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. + +### Example + +```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). +$clientRedemptionsRedeemRequestBody = {"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, $clientRedemptionsRedeemRequestBody); + 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). | | +| **clientRedemptionsRedeemRequestBody** | [**\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, $clientEventsCreateRequestBody): \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 doesnt 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). +$clientEventsCreateRequestBody = {"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, $clientEventsCreateRequestBody); + 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). | | +| **clientEventsCreateRequestBody** | [**\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) + +## `validateStackedDiscountsClientSide()` + +```php +validateStackedDiscountsClientSide($origin, $clientValidationsValidateRequestBody): \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). +$clientValidationsValidateRequestBody = {"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, $clientValidationsValidateRequestBody); + 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). | | +| **clientValidationsValidateRequestBody** | [**\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 new file mode 100644 index 0000000..5e1909d --- /dev/null +++ b/docs/Api/CustomersApi.md @@ -0,0 +1,941 @@ +# OpenAPI\Client\CustomersApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createCustomer()**](CustomersApi.md#createCustomer) | **POST** /v1/customers | Create Customer | +| [**customerPermanentlyDeletion()**](CustomersApi.md#customerPermanentlyDeletion) | **POST** /v1/customers/{customerId}/permanent-deletion | Delete Customer Permanently | +| [**deleteCustomer()**](CustomersApi.md#deleteCustomer) | **DELETE** /v1/customers/{customerId} | Delete Customer | +| [**getCustomer()**](CustomersApi.md#getCustomer) | **GET** /v1/customers/{customerId} | Get Customer | +| [**importCustomersUsingCsv()**](CustomersApi.md#importCustomersUsingCsv) | **POST** /v1/customers/importCSV | Import and Update Customers using CSV | +| [**listCustomerActivity()**](CustomersApi.md#listCustomerActivity) | **GET** /v1/customers/{customerId}/activity | List Customer Activity | +| [**listCustomerRedeemables()**](CustomersApi.md#listCustomerRedeemables) | **GET** /v1/customers/{customerId}/redeemables | List Customer's Redeemables | +| [**listCustomerSegments()**](CustomersApi.md#listCustomerSegments) | **GET** /v1/customers/{customerId}/segments | List Customer's Segments | +| [**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 [Deprecated] | +| [**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 | + + +## `createCustomer()` + +```php +createCustomer($customersCreateRequestBody): \OpenAPI\Client\Model\CustomersCreateResponseBody +``` + +Create Customer + +Creates a customer object. 📘 Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields. + +### 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\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 +); +$customersCreateRequestBody = {"source_id":"source_123","name":"Bob Smith","description":"A frequent customer","email":"bob.smith@email.com","phone":"+1 933 222 3333","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthdate":"2022-01-01"}; // \OpenAPI\Client\Model\CustomersCreateRequestBody | Create a customer with specified parameters. + +try { + $result = $apiInstance->createCustomer($customersCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->createCustomer: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customersCreateRequestBody** | [**\OpenAPI\Client\Model\CustomersCreateRequestBody**](../Model/CustomersCreateRequestBody.md)| Create a customer with specified parameters. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CustomersCreateResponseBody**](../Model/CustomersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `customerPermanentlyDeletion()` + +```php +customerPermanentlyDeletion($customerId): \OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBody +``` + +Delete Customer Permanently + +The organization user can remove consumer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify. + +### 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\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 +); +$customerId = 'customerId_example'; // string | A Voucherify customers id or source_id. + +try { + $result = $apiInstance->customerPermanentlyDeletion($customerId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->customerPermanentlyDeletion: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customerId** | **string**| A Voucherify customers id or source_id. | | + +### Return type + +[**\OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBody**](../Model/CustomersPermanentDeletionCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteCustomer()` + +```php +deleteCustomer($customerId) +``` + +Delete Customer + +This method deletes a customer. + +### 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\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 +); +$customerId = 'customerId_example'; // string | A Voucherify customers id or source_id. + +try { + $apiInstance->deleteCustomer($customerId); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->deleteCustomer: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customerId** | **string**| A Voucherify customers id or source_id. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getCustomer()` + +```php +getCustomer($customerId): \OpenAPI\Client\Model\CustomersGetResponseBody +``` + +Get Customer + +Retrieve customer details. + +### 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\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 +); +$customerId = 'customerId_example'; // string | A Voucherify customers id or source_id. + +try { + $result = $apiInstance->getCustomer($customerId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->getCustomer: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customerId** | **string**| A Voucherify customers id or source_id. | | + +### Return type + +[**\OpenAPI\Client\Model\CustomersGetResponseBody**](../Model/CustomersGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `importCustomersUsingCsv()` + +```php +importCustomersUsingCsv($file): \OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody +``` + +Import and Update Customers using CSV + +This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. 📘 Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\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 +); +$file = "/path/to/file.txt"; // \SplFileObject | File path. + +try { + $result = $apiInstance->importCustomersUsingCsv($file); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->importCustomersUsingCsv: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **file** | **\SplFileObject****\SplFileObject**| File path. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody**](../Model/CustomersImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCustomerActivity()` + +```php +listCustomerActivity($customerId, $limit, $order, $startingAfterId, $startDate, $endDate, $campaignId, $campaignType, $category, $type): \OpenAPI\Client\Model\CustomersActivityListResponseBody +``` + +List Customer Activity + +Retrieve customer activities. + +### 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\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 +); +$customerId = 'customerId_example'; // string | A Voucherify customers id or source ID of the customer who performed the activities. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$order = new \OpenAPI\Client\Model\ParameterOrderCreatedAt(); // ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. +$startingAfterId = 'startingAfterId_example'; // string | A cursor for pagination. It retrieves the events starting after an event with the given ID. +$startDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. +$endDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. +$campaignId = 'campaignId_example'; // string | Requests only events related to specific campaign identified by its ID. +$campaignType = new \OpenAPI\Client\Model\ParameterCampaignType(); // ParameterCampaignType | Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. +$category = new \OpenAPI\Client\Model\ParameterActivityCategory(); // ParameterActivityCategory | Filters activities for actions or effects. Allowed values: ACTION, EFFECT. +$type = 'type_example'; // string | Event name of the customer event. + +try { + $result = $apiInstance->listCustomerActivity($customerId, $limit, $order, $startingAfterId, $startDate, $endDate, $campaignId, $campaignType, $category, $type); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->listCustomerActivity: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customerId** | **string**| A Voucherify customers id or source ID of the customer who performed the activities. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderCreatedAt**](../Model/.md)| Apply this filter to order the events according the date and time when it was created. | [optional] | +| **startingAfterId** | **string**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | +| **startDate** | **\DateTime**| Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. | [optional] | +| **endDate** | **\DateTime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | +| **campaignId** | **string**| Requests only events related to specific campaign identified by its ID. | [optional] | +| **campaignType** | [**ParameterCampaignType**](../Model/.md)| Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. | [optional] | +| **category** | [**ParameterActivityCategory**](../Model/.md)| Filters activities for actions or effects. Allowed values: ACTION, EFFECT. | [optional] | +| **type** | **string**| Event name of the customer event. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CustomersActivityListResponseBody**](../Model/CustomersActivityListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCustomerRedeemables()` + +```php +listCustomerRedeemables($customerId, $limit, $order, $startingAfterId, $filters): \OpenAPI\Client\Model\CustomersRedeemablesListResponseBody +``` + +List Customer's Redeemables + +Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) + +### 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\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 +); +$customerId = 'customerId_example'; // string | Unique identifier of a customer represented by an internal customer ID or customer source ID. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$order = new \OpenAPI\Client\Model\ParameterOrderListRedeemables(); // ParameterOrderListRedeemables | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$startingAfterId = 'startingAfterId_example'; // string | A cursor for pagination. It retrieves the events starting after an event with the given ID. +$filters = new \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemables(); // ParameterFiltersListCustomerRedeemables | Filters for listing customer redeemables. + +try { + $result = $apiInstance->listCustomerRedeemables($customerId, $limit, $order, $startingAfterId, $filters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->listCustomerRedeemables: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customerId** | **string**| Unique identifier of a customer represented by an internal customer ID or customer source ID. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderListRedeemables**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **startingAfterId** | **string**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | +| **filters** | [**ParameterFiltersListCustomerRedeemables**](../Model/.md)| Filters for listing customer redeemables. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CustomersRedeemablesListResponseBody**](../Model/CustomersRedeemablesListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCustomerSegments()` + +```php +listCustomerSegments($customerId): \OpenAPI\Client\Model\CustomersSegmentsListResponseBody +``` + +List Customer's Segments + +Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system. + +### 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\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 +); +$customerId = 'customerId_example'; // string | Unique identifier of a customer represented by an internal customer ID or customer source ID. + +try { + $result = $apiInstance->listCustomerSegments($customerId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->listCustomerSegments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customerId** | **string**| Unique identifier of a customer represented by an internal customer ID or customer source ID. | | + +### Return type + +[**\OpenAPI\Client\Model\CustomersSegmentsListResponseBody**](../Model/CustomersSegmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCustomers()` + +```php +listCustomers($limit, $page, $email, $city, $name, $segmentId, $createdAtBefore, $createdAtAfter, $updatedAtBefore, $updatedAtAfter, $order, $startingAfter): \OpenAPI\Client\Model\CustomersListResponseBody +``` + +List Customers + +Returns a list of customers. + +### 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\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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$email = 'email_example'; // string | Limit the customers to the ones that have this specific email address. +$city = 'city_example'; // string | Limit the customers to the ones that are located in the specified city. +$name = 'name_example'; // string | Filter customers by the name property. +$segmentId = 'segmentId_example'; // string | Filter customers by the segment id. +$createdAtBefore = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter customers by date customer was created. +$createdAtAfter = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter customers by date customer was created. +$updatedAtBefore = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter customers by date customer was updated last time. +$updatedAtAfter = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter customers by date customer was updated last time. +$order = new \OpenAPI\Client\Model\ParameterOrderListCustomers(); // ParameterOrderListCustomers | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$startingAfter = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + +try { + $result = $apiInstance->listCustomers($limit, $page, $email, $city, $name, $segmentId, $createdAtBefore, $createdAtAfter, $updatedAtBefore, $updatedAtAfter, $order, $startingAfter); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->listCustomers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **email** | **string**| Limit the customers to the ones that have this specific email address. | [optional] | +| **city** | **string**| Limit the customers to the ones that are located in the specified city. | [optional] | +| **name** | **string**| Filter customers by the name property. | [optional] | +| **segmentId** | **string**| Filter customers by the segment id. | [optional] | +| **createdAtBefore** | **\DateTime**| Filter customers by date customer was created. | [optional] | +| **createdAtAfter** | **\DateTime**| Filter customers by date customer was created. | [optional] | +| **updatedAtBefore** | **\DateTime**| Filter customers by date customer was updated last time. | [optional] | +| **updatedAtAfter** | **\DateTime**| Filter customers by date customer was updated last time. | [optional] | +| **order** | [**ParameterOrderListCustomers**](../Model/.md)| This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **startingAfter** | **\DateTime**| A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CustomersListResponseBody**](../Model/CustomersListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCustomer()` + +```php +updateCustomer($customerId, $customersUpdateRequestBody): \OpenAPI\Client\Model\CustomersUpdateResponseBody +``` + +Update Customer + +Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + +### 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\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 +); +$customerId = 'customerId_example'; // string | A Voucherify customers id or source_id. +$customersUpdateRequestBody = {"name":"Alice McDonald","email":"alice.mdconald@email.com","description":"Updating customer data","phone":"+1 (132) 222-2222","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthdate":"2022-01-01","birthday":"2022-01-02"}; // \OpenAPI\Client\Model\CustomersUpdateRequestBody | Specify the parameters to be updated. + +try { + $result = $apiInstance->updateCustomer($customerId, $customersUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->updateCustomer: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customerId** | **string**| A Voucherify customers id or source_id. | | +| **customersUpdateRequestBody** | [**\OpenAPI\Client\Model\CustomersUpdateRequestBody**](../Model/CustomersUpdateRequestBody.md)| Specify the parameters to be updated. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CustomersUpdateResponseBody**](../Model/CustomersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCustomersConsents()` + +```php +updateCustomersConsents($customerId, $body) +``` + +Update Customer's consents [Deprecated] + +Update marketing permissions for the specified customer. ❗️ Deprecated This endpoint is deprecated. The feature of managing consents will be soon removed from Voucherify, including this endpoint. + +### 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\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 +); +$customerId = 'customerId_example'; // string | A Voucherify unique 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 Opt-out from all communication: + +try { + $apiInstance->updateCustomersConsents($customerId, $body); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->updateCustomersConsents: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customerId** | **string**| A Voucherify unique 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 Opt-out from all communication: | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `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 +updateCustomersInBulk($customersUpdateInBulkRequestBody): \OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody +``` + +Update Customers in Bulk + +Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### 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\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 +); +$customersUpdateInBulkRequestBody = [{"source_id":"John.Smith@email.com","name":"John Smith","email":"john.smith@email.com","description":"Updating customer data","phone":"+1 (132) 222-2222","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthday":"2022-04-04"},{"source_id":"Jane.Smith@email.com","name":"Jane Smith","email":"Jane.Smith@email.com","description":"Updating customer data","phone":"+1 (132) 222-2222","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthday":"2022-03-03"},{"source_id":"Sally.Smith@email.com","name":"Sally Smith","email":"Sally.Smith@email.com","description":"Updating customer data","phone":"+1 (132) 222-2222","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthdate":"2022-02-02"}]; // \OpenAPI\Client\Model\CustomersUpdateInBulkRequestBody[] | List the customer fields to be updated in each customer object. + +try { + $result = $apiInstance->updateCustomersInBulk($customersUpdateInBulkRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->updateCustomersInBulk: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customersUpdateInBulkRequestBody** | [**\OpenAPI\Client\Model\CustomersUpdateInBulkRequestBody[]**](../Model/CustomersUpdateInBulkRequestBody.md)| List the customer fields to be updated in each customer object. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody**](../Model/CustomersUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCustomersMetadataInBulk()` + +```php +updateCustomersMetadataInBulk($customersMetadataUpdateInBulkRequestBody): \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody +``` + +Update Customers' Metadata in Bulk + +Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### 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\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 +); +$customersMetadataUpdateInBulkRequestBody = {"source_ids":["source_123","source_456"],"metadata":{"lang":"en","test":false}}; // \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkRequestBody | List the source_ids of the customers you would like to update with the metadata key/value pairs. + +try { + $result = $apiInstance->updateCustomersMetadataInBulk($customersMetadataUpdateInBulkRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CustomersApi->updateCustomersMetadataInBulk: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customersMetadataUpdateInBulkRequestBody** | [**\OpenAPI\Client\Model\CustomersMetadataUpdateInBulkRequestBody**](../Model/CustomersMetadataUpdateInBulkRequestBody.md)| List the source_ids of the customers you would like to update with the metadata key/value pairs. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody**](../Model/CustomersMetadataUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/EventsApi.md b/docs/Api/EventsApi.md new file mode 100644 index 0000000..8c642de --- /dev/null +++ b/docs/Api/EventsApi.md @@ -0,0 +1,75 @@ +# OpenAPI\Client\EventsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**trackCustomEvent()**](EventsApi.md#trackCustomEvent) | **POST** /v1/events | Track Custom Event | + + +## `trackCustomEvent()` + +```php +trackCustomEvent($eventsCreateRequestBody): \OpenAPI\Client\Model\EventsCreateResponseBody +``` + +Track Custom Event + +To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + +### 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\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 +); +$eventsCreateRequestBody = {"event":"event-name","customer":{"source_id":"referee-source_id"},"referral":{"code":"voucher-code","referrer_id":"referrer-source_id"}}; // \OpenAPI\Client\Model\EventsCreateRequestBody | Specify the details of the custom event. + +try { + $result = $apiInstance->trackCustomEvent($eventsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EventsApi->trackCustomEvent: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **eventsCreateRequestBody** | [**\OpenAPI\Client\Model\EventsCreateRequestBody**](../Model/EventsCreateRequestBody.md)| Specify the details of the custom event. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\EventsCreateResponseBody**](../Model/EventsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/ExportsApi.md b/docs/Api/ExportsApi.md new file mode 100644 index 0000000..bb01053 --- /dev/null +++ b/docs/Api/ExportsApi.md @@ -0,0 +1,341 @@ +# OpenAPI\Client\ExportsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createExport()**](ExportsApi.md#createExport) | **POST** /v1/exports | Create Export | +| [**deleteExport()**](ExportsApi.md#deleteExport) | **DELETE** /v1/exports/{exportId} | Delete Export | +| [**downloadExport()**](ExportsApi.md#downloadExport) | **GET** /v1/exports/{export_Id} | Download Export | +| [**getExport()**](ExportsApi.md#getExport) | **GET** /v1/exports/{exportId} | Get Export | +| [**listExports()**](ExportsApi.md#listExports) | **GET** /v1/exports | List Exports | + + +## `createExport()` + +```php +createExport($exportsCreateRequestBody): \OpenAPI\Client\Model\ExportsCreateResponseBody +``` + +Create Export + +Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions + +### 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\ExportsApi( + // 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 +); +$exportsCreateRequestBody = new \OpenAPI\Client\Model\ExportsCreateRequestBody(); // \OpenAPI\Client\Model\ExportsCreateRequestBody | Specify the details of the export that you would like to create. + +try { + $result = $apiInstance->createExport($exportsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExportsApi->createExport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **exportsCreateRequestBody** | [**\OpenAPI\Client\Model\ExportsCreateRequestBody**](../Model/ExportsCreateRequestBody.md)| Specify the details of the export that you would like to create. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ExportsCreateResponseBody**](../Model/ExportsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteExport()` + +```php +deleteExport($exportId) +``` + +Delete Export + +This method deletes a previously created export object. + +### 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\ExportsApi( + // 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 +); +$exportId = 'exportId_example'; // string | Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. + +try { + $apiInstance->deleteExport($exportId); +} catch (Exception $e) { + echo 'Exception when calling ExportsApi->deleteExport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **exportId** | **string**| Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `downloadExport()` + +```php +downloadExport($exportId, $token): string +``` + +Download Export + +Download the contents of the exported CSV file. 📘 Important notes **Base URL:** - https://download.voucherify.io (Europe) - https://us1.download.voucherify.io (US) - https://as1.download.voucherify.io (Asia) **Token:** Can be found within the result parameter of the Get Export method response. + +### Example + +```php +downloadExport($exportId, $token); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExportsApi->downloadExport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **exportId** | **string**| Unique export object ID. | | +| **token** | **string**| Token that was issued to the export, to get this token, get the export first | [optional] | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `text/plain` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getExport()` + +```php +getExport($exportId): \OpenAPI\Client\Model\ExportsGetResponseBody +``` + +Get Export + +Retrieves the URL of the downloadable file, which was generated via the Create Export method. + +### 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\ExportsApi( + // 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 +); +$exportId = 'exportId_example'; // string | Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. + +try { + $result = $apiInstance->getExport($exportId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExportsApi->getExport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **exportId** | **string**| Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. | | + +### Return type + +[**\OpenAPI\Client\Model\ExportsGetResponseBody**](../Model/ExportsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listExports()` + +```php +listExports($limit, $page, $order): \OpenAPI\Client\Model\ExportsListResponseBody +``` + +List Exports + +List all exports. + +### 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\ExportsApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListExports(); // ParameterOrderListExports | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listExports($limit, $page, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ExportsApi->listExports: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListExports**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ExportsListResponseBody**](../Model/ExportsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[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/LoyaltiesApi.md b/docs/Api/LoyaltiesApi.md new file mode 100644 index 0000000..98ff694 --- /dev/null +++ b/docs/Api/LoyaltiesApi.md @@ -0,0 +1,3141 @@ +# OpenAPI\Client\LoyaltiesApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addMember()**](LoyaltiesApi.md#addMember) | **POST** /v1/loyalties/{campaignId}/members | Add Member | +| [**createEarningRule()**](LoyaltiesApi.md#createEarningRule) | **POST** /v1/loyalties/{campaignId}/earning-rules | Create Earning Rule | +| [**createInBulkLoyaltyTiers()**](LoyaltiesApi.md#createInBulkLoyaltyTiers) | **POST** /v1/loyalties/{campaignId}/tiers | Create loyalty tiers | +| [**createLoyaltyProgram()**](LoyaltiesApi.md#createLoyaltyProgram) | **POST** /v1/loyalties | Create Loyalty Campaign | +| [**createPointsExpirationExport()**](LoyaltiesApi.md#createPointsExpirationExport) | **POST** /v1/loyalties/{campaignId}/points-expiration/export | Create Points Expiration Export | +| [**createRewardAssignment1()**](LoyaltiesApi.md#createRewardAssignment1) | **POST** /v1/loyalties/{campaignId}/rewards | Create Reward Assignment | +| [**deleteEarningRule()**](LoyaltiesApi.md#deleteEarningRule) | **DELETE** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Delete Earning Rule | +| [**deleteLoyaltyProgram()**](LoyaltiesApi.md#deleteLoyaltyProgram) | **DELETE** /v1/loyalties/{campaignId} | Delete Loyalty Campaign | +| [**deleteRewardAssignment1()**](LoyaltiesApi.md#deleteRewardAssignment1) | **DELETE** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Delete Reward Assignment | +| [**disableEarningRule()**](LoyaltiesApi.md#disableEarningRule) | **POST** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable | Disable Earning Rule | +| [**enableEarningRule()**](LoyaltiesApi.md#enableEarningRule) | **POST** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable | Enable Earning Rule | +| [**exportLoyaltyCardTransactions()**](LoyaltiesApi.md#exportLoyaltyCardTransactions) | **POST** /v1/loyalties/members/{memberId}/transactions/export | Export Loyalty Card Transactions | +| [**exportLoyaltyCardTransactions1()**](LoyaltiesApi.md#exportLoyaltyCardTransactions1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | Export Loyalty Card Transactions | +| [**getEarningRule()**](LoyaltiesApi.md#getEarningRule) | **GET** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Get Earning Rule | +| [**getLoyaltyProgram()**](LoyaltiesApi.md#getLoyaltyProgram) | **GET** /v1/loyalties/{campaignId} | Get Loyalty Campaign | +| [**getLoyaltyTier()**](LoyaltiesApi.md#getLoyaltyTier) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | Get Loyalty Tier | +| [**getMember()**](LoyaltiesApi.md#getMember) | **GET** /v1/loyalties/members/{memberId} | Get Member | +| [**getMember1()**](LoyaltiesApi.md#getMember1) | **GET** /v1/loyalties/{campaignId}/members/{memberId} | Get Member | +| [**getRewardAssignment1()**](LoyaltiesApi.md#getRewardAssignment1) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | Get Reward Assignment | +| [**getRewardAssignment2()**](LoyaltiesApi.md#getRewardAssignment2) | **GET** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Get Reward Assignment | +| [**getRewardDetails()**](LoyaltiesApi.md#getRewardDetails) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | Get Reward Details | +| [**listEarningRules()**](LoyaltiesApi.md#listEarningRules) | **GET** /v1/loyalties/{campaignId}/earning-rules | List Earning Rules | +| [**listLoyaltyCardTransactions()**](LoyaltiesApi.md#listLoyaltyCardTransactions) | **GET** /v1/loyalties/members/{memberId}/transactions | List Loyalty Card Transactions | +| [**listLoyaltyCardTransactions1()**](LoyaltiesApi.md#listLoyaltyCardTransactions1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/transactions | List Loyalty Card Transactions | +| [**listLoyaltyPrograms()**](LoyaltiesApi.md#listLoyaltyPrograms) | **GET** /v1/loyalties | List Loyalty Campaigns | +| [**listLoyaltyTierEarningRules()**](LoyaltiesApi.md#listLoyaltyTierEarningRules) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | List Loyalty Tier Earning Rules | +| [**listLoyaltyTierRewards()**](LoyaltiesApi.md#listLoyaltyTierRewards) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | List Loyalty Tier Rewards | +| [**listLoyaltyTiers()**](LoyaltiesApi.md#listLoyaltyTiers) | **GET** /v1/loyalties/{campaignId}/tiers | List Loyalty Tiers | +| [**listMemberActivity()**](LoyaltiesApi.md#listMemberActivity) | **GET** /v1/loyalties/members/{memberId}/activity | List Member Activity | +| [**listMemberActivity1()**](LoyaltiesApi.md#listMemberActivity1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/activity | List Member Activity | +| [**listMemberLoyaltyTier()**](LoyaltiesApi.md#listMemberLoyaltyTier) | **GET** /v1/loyalties/members/{memberId}/tiers | List Member's Loyalty Tiers | +| [**listMemberRewards()**](LoyaltiesApi.md#listMemberRewards) | **GET** /v1/loyalties/members/{memberId}/rewards | List Member Rewards | +| [**listMembers()**](LoyaltiesApi.md#listMembers) | **GET** /v1/loyalties/{campaignId}/members | List Members | +| [**listPointsExpiration()**](LoyaltiesApi.md#listPointsExpiration) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | Get Points Expiration | +| [**listRewardAssignments1()**](LoyaltiesApi.md#listRewardAssignments1) | **GET** /v1/loyalties/{campaignId}/reward-assignments | List Reward Assignments | +| [**listRewardAssignments2()**](LoyaltiesApi.md#listRewardAssignments2) | **GET** /v1/loyalties/{campaignId}/rewards | List Reward Assignments | +| [**redeemReward()**](LoyaltiesApi.md#redeemReward) | **POST** /v1/loyalties/members/{memberId}/redemption | Redeem Reward | +| [**redeemReward1()**](LoyaltiesApi.md#redeemReward1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/redemption | Redeem Reward | +| [**transferPoints()**](LoyaltiesApi.md#transferPoints) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transfers | Transfer Loyalty Points | +| [**updateEarningRule()**](LoyaltiesApi.md#updateEarningRule) | **PUT** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Update Earning Rule | +| [**updateLoyaltyCardBalance()**](LoyaltiesApi.md#updateLoyaltyCardBalance) | **POST** /v1/loyalties/members/{memberId}/balance | Add or Remove Loyalty Card Balance | +| [**updateLoyaltyCardBalance1()**](LoyaltiesApi.md#updateLoyaltyCardBalance1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/balance | Add or Remove Loyalty Card Balance | +| [**updateLoyaltyProgram()**](LoyaltiesApi.md#updateLoyaltyProgram) | **PUT** /v1/loyalties/{campaignId} | Update Loyalty Campaign | +| [**updateRewardAssignment1()**](LoyaltiesApi.md#updateRewardAssignment1) | **PUT** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Update Reward Assignment | + + +## `addMember()` + +```php +addMember($campaignId, $loyaltiesMembersCreateRequestBody): \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBody +``` + +Add Member + +This method assigns a loyalty card to a customer. It selects a loyalty card suitable for publication, adds a publish entry, and returns the published voucher. A voucher is suitable for publication when its active and hasnt been published yet. 📘 Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID of the loyalty program. +$loyaltiesMembersCreateRequestBody = {"customer":"source_customer_1","metadata":{"year":2022},"channel":"postman","voucher":"KpzbHUY5"}; // \OpenAPI\Client\Model\LoyaltiesMembersCreateRequestBody | Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. + +try { + $result = $apiInstance->addMember($campaignId, $loyaltiesMembersCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->addMember: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID of the loyalty program. | | +| **loyaltiesMembersCreateRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesMembersCreateRequestBody**](../Model/LoyaltiesMembersCreateRequestBody.md)| Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBody**](../Model/LoyaltiesMembersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createEarningRule()` + +```php +createEarningRule($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem): \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBody[] +``` + +Create Earning Rule + +Create earning rules for a loyalty campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$loyaltiesEarningRulesCreateRequestBodyItem = [{"event":"order.paid","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"FIXED","points":"5"},"source":{"banner":"Order paid 5 points."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid - fixed amount of points"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_AMOUNT","order":{"amount":{"every":1,"points":1}}},"source":{"banner":"Order paid - 1 point for 1 dollar spent excluding discounts."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to order amount"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_TOTAL_AMOUNT","order":{"total_amount":{"every":1,"points":1}}},"source":{"banner":"Order paid - 1 point for 1 dollar spent including discounts."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to order total amount"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_METADATA","order":{"metadata":{"every":2,"points":1,"property":"number_of_store_visits"}}},"source":{"banner":"Order paid - 2 points for each store visit."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to numerical order metadata property "}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_ITEMS_AMOUNT","order_items":{"amount":{"every":2,"points":1,"object":"product","id":"prod_0bae32322150fd0546"}}},"source":{"banner":"Order paid - 2 points for 1 dollar spent on items excluding discounts."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to order items amount"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_ITEMS_SUBTOTAL_AMOUNT","order_items":{"subtotal_amount":{"every":2,"points":1,"object":"products_collection","id":"pc_75U0dHlr7u75BJodrW1AE3t6"}}},"source":{"banner":"Order paid - 2 points for every dollar spent on the product collection."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to order items subtotal amount"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_ITEMS_QUANTITY","order_items":{"quantity":{"every":1,"points":1,"object":"sku","id":"sku_0b7d7dfb090be5c619"}}},"source":{"banner":"Order paid - 1 point for every brand phone in your cart."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid - points proportional to quantity of items in a cart of a product varient."}},{"event":"order.paid","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOMER_METADATA","customer":{"metadata":{"every":1,"points":1,"property":"customer_life_time_value"}}},"source":{"banner":"Order paid 1 point for 1 month of being a customer with us."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid - points proportional to customer metadata property"}},{"event":"customer.segment.entered","segment":{"id":"seg_OlE7DmfzMI5pHyD5VAv512r1"},"validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOMER_METADATA","customer":{"metadata":{"every":1,"points":1,"property":"customer_life_time_value"}}},"source":{"banner":"Customer entered birthday segment - 1 point for each month of being a customer with us."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Entered segment - points proportional to customer metadata property"}},{"event":"customer.segment.entered","segment":{"id":"seg_OlE7DmfzMI5pHyD5VAv512r1"},"validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"FIXED","points":"5"},"source":{"banner":"Customer entered birthday segment - 5 points"},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Entered segment - fixed points"}},{"event":"page_view","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"points":3,"type":"FIXED"},"custom_event":{"schema_id":"ms_gn4Qe4xsFPf7orCArCiNVY13"},"source":{"banner":"See page - 3 points"},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Custom Event - fixed points for viewing a page"}},{"event":"page_view","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOM_EVENT_METADATA","custom_event":{"metadata":{"every":1,"points":2,"property":"volume_number"}}},"custom_event":{"schema_id":"ms_gn4Qe4xsFPf7orCArCiNVY13"},"source":{"banner":"See page X - get 2 points multiplied by the page number"},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Custom Event - proportional points for viewing a page based on custom event metadata"}},{"event":"page_view","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOMER_METADATA","customer":{"metadata":{"every":1,"points":2,"property":"customer_life_time_value"}}},"custom_event":{"schema_id":"ms_gn4Qe4xsFPf7orCArCiNVY13"},"source":{"banner":"Get 2 points for every month you're a customer for viewing a page"},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Custom Event - proportional points for viewing a page based on customer metadata"}},{"event":"customer.loyalty.tier.prolonged","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOMER_METADATA","customer":{"metadata":{"every":1,"points":2,"property":"customer_life_time_value"}}},"loyalty_tier":{"id":"ltr_pudTGWasuIqxdiDM0go31OV1"},"source":{"banner":"Get 2 points for every month you're a customer when your loyalty tier is prolonged."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Custom Event - proportional points for extending a loyalty tier based on customer metadata."}}]; // \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItem[] | Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object + +try { + $result = $apiInstance->createEarningRule($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->createEarningRule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **loyaltiesEarningRulesCreateRequestBodyItem** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItem[]**](../Model/LoyaltiesEarningRulesCreateRequestBodyItem.md)| Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBody[]**](../Model/LoyaltiesEarningRulesCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createInBulkLoyaltyTiers()` + +```php +createInBulkLoyaltyTiers($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem): \OpenAPI\Client\Model\LoyaltyTier[] +``` + +Create loyalty tiers + +Creates loyalty tiers for desired campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique loyalty campaign ID or name. +$loyaltiesTiersCreateInBulkRequestBodyItem = array(new \OpenAPI\Client\Model\LoyaltiesTiersCreateInBulkRequestBodyItem()); // \OpenAPI\Client\Model\LoyaltiesTiersCreateInBulkRequestBodyItem[] | Provide tier definitions you want to add to existing loyalty campaign. + +try { + $result = $apiInstance->createInBulkLoyaltyTiers($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->createInBulkLoyaltyTiers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique loyalty campaign ID or name. | | +| **loyaltiesTiersCreateInBulkRequestBodyItem** | [**\OpenAPI\Client\Model\LoyaltiesTiersCreateInBulkRequestBodyItem[]**](../Model/LoyaltiesTiersCreateInBulkRequestBodyItem.md)| Provide tier definitions you want to add to existing loyalty campaign. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltyTier[]**](../Model/LoyaltyTier.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createLoyaltyProgram()` + +```php +createLoyaltyProgram($loyaltiesCreateCampaignRequestBody): \OpenAPI\Client\Model\LoyaltiesCreateCampaignResponseBody +``` + +Create Loyalty Campaign + +Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. 📘 Global uniqueness All codes are unique across the whole project. Voucherify wont allow to generate the same codes in any of your campaigns. 🚧 Asyncronous action! This is an asynchronous action, you cant read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description. + +### 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\LoyaltiesApi( + // 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 +); +$loyaltiesCreateCampaignRequestBody = {"name":"Loyalty Program 4","description":"This is a campaign description.","auto_join":true,"join_once":true,"use_voucher_metadata_schema":true,"start_date":"2016-10-26T00:00:00Z","expiration_date":"2024-10-26T00:00:00Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"activity_duration_after_publishing":"P24D","category_id":"cat_0b6152ce12414820dc","vouchers_count":2,"voucher":{"type":"LOYALTY_CARD","loyalty_card":{"points":0,"expiration_rules":{"period_type":"MONTH","period_value":3,"rounding_type":"END_OF_QUARTER"}},"redemption":{"quantity":2},"code_config":{"pattern":"L-CARD-#######"}},"metadata":{"test":true},"type":"STATIC","loyalty_tiers_expiration":{"qualification_type":"BALANCE","start_date":{"type":"IMMEDIATE"},"expiration_date":{"type":"CUSTOM","extend":"P3M","rounding":{"type":"MONTH","strategy":"END"}}}}; // \OpenAPI\Client\Model\LoyaltiesCreateCampaignRequestBody | Specify the loyalty campaign details. + +try { + $result = $apiInstance->createLoyaltyProgram($loyaltiesCreateCampaignRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->createLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **loyaltiesCreateCampaignRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesCreateCampaignRequestBody**](../Model/LoyaltiesCreateCampaignRequestBody.md)| Specify the loyalty campaign details. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesCreateCampaignResponseBody**](../Model/LoyaltiesCreateCampaignResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createPointsExpirationExport()` + +```php +createPointsExpirationExport($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody): \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBody +``` + +Create Points Expiration Export + +Schedule the generation of a points expiration CSV file for a particular campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID or name. +$loyaltiesPointsExpirationExportCreateRequestBody = {"parameters":{"fields":["id","campaign_id","voucher_id","status","expires_at","points"],"order":"-expires_at","filters":{"junction":"and","voucher_id":{"conditions":{"$in":["v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF","v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655"]}}}}}; // \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBody | Specify the data filters, types of data to return and order in which the results should be returned. + +try { + $result = $apiInstance->createPointsExpirationExport($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->createPointsExpirationExport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID or name. | | +| **loyaltiesPointsExpirationExportCreateRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBody**](../Model/LoyaltiesPointsExpirationExportCreateRequestBody.md)| Specify the data filters, types of data to return and order in which the results should be returned. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBody**](../Model/LoyaltiesPointsExpirationExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createRewardAssignment1()` + +```php +createRewardAssignment1($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody): \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBody +``` + +Create Reward Assignment + +Add rewards to a loyalty campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$loyaltiesRewardsCreateAssignmentItemRequestBody = [{"reward":"rew_wg2pvCr5LDhCq4uVQZ9LhuZm","parameters":{"loyalty":{"points":2}}},{"reward":"rew_z35ffKoH0tCcck8EL56p6SIs","parameters":{"loyalty":{"points":2}}}]; // \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBody[] | Define the cost of the rewards in loyalty points. + +try { + $result = $apiInstance->createRewardAssignment1($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->createRewardAssignment1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **loyaltiesRewardsCreateAssignmentItemRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBody[]**](../Model/LoyaltiesRewardsCreateAssignmentItemRequestBody.md)| Define the cost of the rewards in loyalty points. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBody**](../Model/LoyaltiesRewardsCreateAssignmentResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteEarningRule()` + +```php +deleteEarningRule($campaignId, $earningRuleId) +``` + +Delete Earning Rule + +This method deletes an earning rule for a specific loyalty campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$earningRuleId = 'earningRuleId_example'; // string | A unique earning rule ID. + +try { + $apiInstance->deleteEarningRule($campaignId, $earningRuleId); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->deleteEarningRule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **earningRuleId** | **string**| A unique earning rule ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteLoyaltyProgram()` + +```php +deleteLoyaltyProgram($campaignId, $force): \OpenAPI\Client\Model\LoyaltiesDeleteResponseBody +``` + +Delete Loyalty Campaign + +Deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. If the force parameter is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$force = True; // bool | If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. + +try { + $result = $apiInstance->deleteLoyaltyProgram($campaignId, $force); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->deleteLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **force** | **bool**| If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesDeleteResponseBody**](../Model/LoyaltiesDeleteResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteRewardAssignment1()` + +```php +deleteRewardAssignment1($campaignId, $assignmentId) +``` + +Delete Reward Assignment + +This method deletes a reward assignment for a particular loyalty campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. + +try { + $apiInstance->deleteRewardAssignment1($campaignId, $assignmentId); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->deleteRewardAssignment1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **assignmentId** | **string**| A unique reward assignment ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `disableEarningRule()` + +```php +disableEarningRule($campaignId, $earningRuleId): \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBody +``` + +Disable Earning Rule + +Disable an earning rule. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID or name. +$earningRuleId = 'earningRuleId_example'; // string | Unique earning rule ID. + +try { + $result = $apiInstance->disableEarningRule($campaignId, $earningRuleId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->disableEarningRule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID or name. | | +| **earningRuleId** | **string**| Unique earning rule ID. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBody**](../Model/LoyaltiesEarningRulesDisableResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `enableEarningRule()` + +```php +enableEarningRule($campaignId, $earningRuleId): \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBody +``` + +Enable Earning Rule + +Enable an earning rule. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID or name. +$earningRuleId = 'earningRuleId_example'; // string | Unique earning rule ID. + +try { + $result = $apiInstance->enableEarningRule($campaignId, $earningRuleId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->enableEarningRule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID or name. | | +| **earningRuleId** | **string**| Unique earning rule ID. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBody**](../Model/LoyaltiesEarningRulesEnableResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `exportLoyaltyCardTransactions()` + +```php +exportLoyaltyCardTransactions($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody): \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody +``` + +Export Loyalty Card Transactions + +Export transactions that are associated with point movements on a loyalty card. + +### 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\LoyaltiesApi( + // 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 +); +$memberId = 'memberId_example'; // string | A unique code identifying the loyalty card that you are looking to export transaction data for. +$loyaltiesMembersTransactionsExportCreateRequestBody = {"parameters":{"order":"-created_at","fields":["id","type","source_id","reason","balance","amount","created_at","voucher_id","campaign_id","details","related_transaction_id"]}}; // \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody | Specify the parameters and filters for the transaction export. + +try { + $result = $apiInstance->exportLoyaltyCardTransactions($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->exportLoyaltyCardTransactions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **memberId** | **string**| A unique code identifying the loyalty card that you are looking to export transaction data for. | | +| **loyaltiesMembersTransactionsExportCreateRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody**](../Model/LoyaltiesMembersTransactionsExportCreateRequestBody.md)| Specify the parameters and filters for the transaction export. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody**](../Model/LoyaltiesMembersTransactionsExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `exportLoyaltyCardTransactions1()` + +```php +exportLoyaltyCardTransactions1($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody): \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody +``` + +Export Loyalty Card Transactions + +Export transactions that are associated with point movements on a loyalty card. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. +$memberId = 'memberId_example'; // string | A unique code identifying the loyalty card that you are looking to export transaction data for. +$loyaltiesMembersTransactionsExportCreateRequestBody = {"parameters":{"order":"-created_at","fields":["id","type","source_id","reason","balance","amount","created_at","voucher_id","campaign_id","details","related_transaction_id"]}}; // \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody | Specify the parameters and filters for the transaction export. + +try { + $result = $apiInstance->exportLoyaltyCardTransactions1($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->exportLoyaltyCardTransactions1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. | | +| **memberId** | **string**| A unique code identifying the loyalty card that you are looking to export transaction data for. | | +| **loyaltiesMembersTransactionsExportCreateRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody**](../Model/LoyaltiesMembersTransactionsExportCreateRequestBody.md)| Specify the parameters and filters for the transaction export. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody**](../Model/LoyaltiesMembersTransactionsExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getEarningRule()` + +```php +getEarningRule($campaignId, $earningRuleId): \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBody +``` + +Get Earning Rule + +Retrieves an earning rule assigned to a campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$earningRuleId = 'earningRuleId_example'; // string | A unique earning rule ID. + +try { + $result = $apiInstance->getEarningRule($campaignId, $earningRuleId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->getEarningRule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **earningRuleId** | **string**| A unique earning rule ID. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBody**](../Model/LoyaltiesEarningRulesGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getLoyaltyProgram()` + +```php +getLoyaltyProgram($campaignId): \OpenAPI\Client\Model\LoyaltiesGetCampaignResponseBody +``` + +Get Loyalty Campaign + +Retrieve a specific loyalty campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + +try { + $result = $apiInstance->getLoyaltyProgram($campaignId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->getLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesGetCampaignResponseBody**](../Model/LoyaltiesGetCampaignResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getLoyaltyTier()` + +```php +getLoyaltyTier($campaignId, $loyaltyTierId): \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBody +``` + +Get Loyalty Tier + +Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique loyalty campaign ID or name. +$loyaltyTierId = 'loyaltyTierId_example'; // string | Unique loyalty tier ID. + +try { + $result = $apiInstance->getLoyaltyTier($campaignId, $loyaltyTierId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->getLoyaltyTier: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique loyalty campaign ID or name. | | +| **loyaltyTierId** | **string**| Unique loyalty tier ID. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBody**](../Model/LoyaltiesTiersGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getMember()` + +```php +getMember($memberId): \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody +``` + +Get Member + +Retrieve loyalty card with the given member ID (i.e. voucher code). 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to retrieve loyalty card details without having to provide the campaignId as a path parameter. + +### 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\LoyaltiesApi( + // 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 +); +$memberId = 'memberId_example'; // string | Unique loyalty card code assigned to a particular customer. + +try { + $result = $apiInstance->getMember($memberId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->getMember: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **memberId** | **string**| Unique loyalty card code assigned to a particular customer. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody**](../Model/LoyaltiesMembersGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getMember1()` + +```php +getMember1($campaignId, $memberId): \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody +``` + +Get Member + +Retrieves the loyalty card with the given member ID (i.e. voucher code). + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID. +$memberId = 'memberId_example'; // string | Unique code that identifies the loyalty card. + +try { + $result = $apiInstance->getMember1($campaignId, $memberId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->getMember1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID. | | +| **memberId** | **string**| Unique code that identifies the loyalty card. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody**](../Model/LoyaltiesMembersGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getRewardAssignment1()` + +```php +getRewardAssignment1($campaignId, $assignmentId): \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBody +``` + +Get Reward Assignment + +Retrieve specific reward assignment. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$assignmentId = 'assignmentId_example'; // string | Unique reward assignment ID. + +try { + $result = $apiInstance->getRewardAssignment1($campaignId, $assignmentId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->getRewardAssignment1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **assignmentId** | **string**| Unique reward assignment ID. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBody**](../Model/LoyaltiesRewardAssignmentsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getRewardAssignment2()` + +```php +getRewardAssignment2($campaignId, $assignmentId): \OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBody +``` + +Get Reward Assignment + +Retrieve specific reward assignment. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. + +try { + $result = $apiInstance->getRewardAssignment2($campaignId, $assignmentId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->getRewardAssignment2: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **assignmentId** | **string**| A unique reward assignment ID. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBody**](../Model/LoyaltiesRewardsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getRewardDetails()` + +```php +getRewardDetails($campaignId, $assignmentId): \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBody +``` + +Get Reward Details + +Get reward details in the context of a loyalty campaign and reward assignment ID. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$assignmentId = 'assignmentId_example'; // string | Unique reward assignment ID. + +try { + $result = $apiInstance->getRewardDetails($campaignId, $assignmentId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->getRewardDetails: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **assignmentId** | **string**| Unique reward assignment ID. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBody**](../Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listEarningRules()` + +```php +listEarningRules($campaignId, $limit, $page, $order): \OpenAPI\Client\Model\LoyaltiesEarningRulesListResponseBody +``` + +List Earning Rules + +Returns a list of all earning rules within a given campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListEarningRules(); // ParameterOrderListEarningRules | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listEarningRules($campaignId, $limit, $page, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listEarningRules: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListEarningRules**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesEarningRulesListResponseBody**](../Model/LoyaltiesEarningRulesListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listLoyaltyCardTransactions()` + +```php +listLoyaltyCardTransactions($memberId, $limit): \OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody +``` + +List Loyalty Card Transactions + +Retrieve transaction data related to point movements for a specific loyalty card. + +### 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\LoyaltiesApi( + // 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 +); +$memberId = 'memberId_example'; // string | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + +try { + $result = $apiInstance->listLoyaltyCardTransactions($memberId, $limit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listLoyaltyCardTransactions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **memberId** | **string**| A unique code identifying the loyalty card that you are looking to retrieve transaction data for. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody**](../Model/LoyaltiesMembersTransactionsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listLoyaltyCardTransactions1()` + +```php +listLoyaltyCardTransactions1($campaignId, $memberId, $limit, $page): \OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody +``` + +List Loyalty Card Transactions + +Retrieve transaction data related to point movements for a specific loyalty card. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. +$memberId = 'memberId_example'; // string | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. + +try { + $result = $apiInstance->listLoyaltyCardTransactions1($campaignId, $memberId, $limit, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listLoyaltyCardTransactions1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. | | +| **memberId** | **string**| A unique code identifying the loyalty card that you are looking to retrieve transaction data for. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody**](../Model/LoyaltiesMembersTransactionsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listLoyaltyPrograms()` + +```php +listLoyaltyPrograms($limit, $page, $order): \OpenAPI\Client\Model\LoyaltiesListCampaignsResponseBody +``` + +List Loyalty Campaigns + +Returns a list of your loyalty campaigns. + +### 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\LoyaltiesApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListCampaigns(); // ParameterOrderListCampaigns | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listLoyaltyPrograms($limit, $page, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listLoyaltyPrograms: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListCampaigns**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesListCampaignsResponseBody**](../Model/LoyaltiesListCampaignsResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listLoyaltyTierEarningRules()` + +```php +listLoyaltyTierEarningRules($campaignId, $loyaltyTierId, $limit, $page): \OpenAPI\Client\Model\LoyaltiesTiersEarningRulesListResponseBody +``` + +List Loyalty Tier Earning Rules + +Retrieve available earning rules for a given tier and the calculation method for earning points. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID or name. +$loyaltyTierId = 'loyaltyTierId_example'; // string | Unique loyalty tier ID. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. + +try { + $result = $apiInstance->listLoyaltyTierEarningRules($campaignId, $loyaltyTierId, $limit, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listLoyaltyTierEarningRules: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID or name. | | +| **loyaltyTierId** | **string**| Unique loyalty tier ID. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesTiersEarningRulesListResponseBody**](../Model/LoyaltiesTiersEarningRulesListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listLoyaltyTierRewards()` + +```php +listLoyaltyTierRewards($campaignId, $loyaltyTierId): \OpenAPI\Client\Model\LoyaltiesTiersRewardsListResponseBody +``` + +List Loyalty Tier Rewards + +Get available rewards for a given tier. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID or name. +$loyaltyTierId = 'loyaltyTierId_example'; // string | Unique loyalty tier ID. + +try { + $result = $apiInstance->listLoyaltyTierRewards($campaignId, $loyaltyTierId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listLoyaltyTierRewards: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID or name. | | +| **loyaltyTierId** | **string**| Unique loyalty tier ID. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesTiersRewardsListResponseBody**](../Model/LoyaltiesTiersRewardsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listLoyaltyTiers()` + +```php +listLoyaltyTiers($campaignId, $limit, $order): \OpenAPI\Client\Model\LoyaltiesTiersListResponseBody +``` + +List Loyalty Tiers + +Retrieve a list of loyalty tiers which were added to the loyalty program. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique loyalty campaign ID or name. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$order = new \OpenAPI\Client\Model\ParameterOrderListLoyaltyTiers(); // ParameterOrderListLoyaltyTiers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listLoyaltyTiers($campaignId, $limit, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listLoyaltyTiers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique loyalty campaign ID or name. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderListLoyaltyTiers**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesTiersListResponseBody**](../Model/LoyaltiesTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listMemberActivity()` + +```php +listMemberActivity($memberId, $limit, $order, $startingAfterId): \OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody +``` + +List Member Activity + +📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to get member activities without having to provide the campaignId as a path parameter. Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + +### 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\LoyaltiesApi( + // 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 +); +$memberId = 'memberId_example'; // string | Unique loyalty card assigned to a particular customer. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$order = new \OpenAPI\Client\Model\ParameterOrderCreatedAt(); // ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. +$startingAfterId = 'startingAfterId_example'; // string | A cursor for pagination. It retrieves the events starting after an event with the given ID. + +try { + $result = $apiInstance->listMemberActivity($memberId, $limit, $order, $startingAfterId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listMemberActivity: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **memberId** | **string**| Unique loyalty card assigned to a particular customer. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderCreatedAt**](../Model/.md)| Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **startingAfterId** | **string**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody**](../Model/LoyaltiesMemberActivityListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listMemberActivity1()` + +```php +listMemberActivity1($campaignId, $memberId, $limit, $order, $startingAfterId): \OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody +``` + +List Member Activity + +Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID. +$memberId = 'memberId_example'; // string | A code that identifies the loyalty card. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$order = new \OpenAPI\Client\Model\ParameterOrderCreatedAt(); // ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. +$startingAfterId = 'startingAfterId_example'; // string | A cursor for pagination. It retrieves the events starting after an event with the given ID. + +try { + $result = $apiInstance->listMemberActivity1($campaignId, $memberId, $limit, $order, $startingAfterId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listMemberActivity1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID. | | +| **memberId** | **string**| A code that identifies the loyalty card. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | [**ParameterOrderCreatedAt**](../Model/.md)| Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **startingAfterId** | **string**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody**](../Model/LoyaltiesMemberActivityListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listMemberLoyaltyTier()` + +```php +listMemberLoyaltyTier($memberId): \OpenAPI\Client\Model\LoyaltiesMembersTiersListResponseBody +``` + +List Member's Loyalty Tiers + +Retrieve member tiers using the loyalty card ID. + +### 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\LoyaltiesApi( + // 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 +); +$memberId = 'memberId_example'; // string | Unique loyalty card assigned to a particular customer. + +try { + $result = $apiInstance->listMemberLoyaltyTier($memberId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listMemberLoyaltyTier: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **memberId** | **string**| Unique loyalty card assigned to a particular customer. | | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersTiersListResponseBody**](../Model/LoyaltiesMembersTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listMemberRewards()` + +```php +listMemberRewards($memberId, $affordableOnly): \OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBody +``` + +List Member Rewards + +Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. + +### 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\LoyaltiesApi( + // 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 +); +$memberId = 'memberId_example'; // string | Unique loyalty card assigned to a particular customer. +$affordableOnly = True; // bool | Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. + +try { + $result = $apiInstance->listMemberRewards($memberId, $affordableOnly); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listMemberRewards: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **memberId** | **string**| Unique loyalty card assigned to a particular customer. | | +| **affordableOnly** | **bool**| Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBody**](../Model/LoyaltiesMembersRewardsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listMembers()` + +```php +listMembers($campaignId, $limit, $page, $customer, $createdAt, $updatedAt, $order, $code, $ids): \OpenAPI\Client\Model\LoyaltiesListMembersResponseBody +``` + +List Members + +Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID of the loyalty program. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$customer = 'customer_example'; // string | A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. +$createdAt = new \OpenAPI\Client\Model\ParameterCreatedBeforeAfter(); // ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z +$updatedAt = new \OpenAPI\Client\Model\ParameterUpdatedBeforeAfter(); // ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z +$order = new \OpenAPI\Client\Model\ParameterOrderVouchers(); // ParameterOrderVouchers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$code = 'code_example'; // string +$ids = array('ids_example'); // string[] + +try { + $result = $apiInstance->listMembers($campaignId, $limit, $page, $customer, $createdAt, $updatedAt, $order, $code, $ids); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listMembers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID of the loyalty program. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **customer** | **string**| A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. | [optional] | +| **createdAt** | [**ParameterCreatedBeforeAfter**](../Model/.md)| A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **updatedAt** | [**ParameterUpdatedBeforeAfter**](../Model/.md)| A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **order** | [**ParameterOrderVouchers**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **code** | **string**| | [optional] | +| **ids** | [**string[]**](../Model/string.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesListMembersResponseBody**](../Model/LoyaltiesListMembersResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listPointsExpiration()` + +```php +listPointsExpiration($campaignId, $memberId, $limit, $page): \OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBody +``` + +Get Points Expiration + +Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$memberId = 'memberId_example'; // string | Loyalty card code. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. + +try { + $result = $apiInstance->listPointsExpiration($campaignId, $memberId, $limit, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listPointsExpiration: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **memberId** | **string**| Loyalty card code. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBody**](../Model/LoyaltiesMembersPointsExpirationListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listRewardAssignments1()` + +```php +listRewardAssignments1($campaignId, $limit, $page, $assignmentId): \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsListResponseBody +``` + +List Reward Assignments + +Returns reward assignments from a given loyalty campaign. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to be more contextual to the type of data returned in the response. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. + +try { + $result = $apiInstance->listRewardAssignments1($campaignId, $limit, $page, $assignmentId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listRewardAssignments1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **assignmentId** | **string**| A unique reward assignment ID. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsListResponseBody**](../Model/LoyaltiesRewardAssignmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listRewardAssignments2()` + +```php +listRewardAssignments2($campaignId, $limit, $page, $assignmentId): \OpenAPI\Client\Model\LoyaltiesRewardsListAssignmentsResponseBody +``` + +List Reward Assignments + +Returns active rewards from a given loyalty campaign. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. + +try { + $result = $apiInstance->listRewardAssignments2($campaignId, $limit, $page, $assignmentId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->listRewardAssignments2: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **assignmentId** | **string**| A unique reward assignment ID. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesRewardsListAssignmentsResponseBody**](../Model/LoyaltiesRewardsListAssignmentsResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `redeemReward()` + +```php +redeemReward($memberId, $loyaltiesMembersRedemptionRedeemRequestBody): \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody +``` + +Redeem Reward + +📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to redeem a reward without having to provide the campaignId as a path parameter. + +### 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\LoyaltiesApi( + // 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 +); +$memberId = 'memberId_example'; // string | Unique loyalty card assigned to a particular customer. +$loyaltiesMembersRedemptionRedeemRequestBody = {"reward":{"id":"rew_INt3fGH3n7xIr3ZQcq4kkUZ1","points":100},"order":{"items":[{"product_id":"prod_0c5d6689b39320059b","quantity":"1"},{"product_id":"prod_0b2c36568000039138","quantity":"2"}]}}; // \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + +try { + $result = $apiInstance->redeemReward($memberId, $loyaltiesMembersRedemptionRedeemRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->redeemReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **memberId** | **string**| Unique loyalty card assigned to a particular customer. | | +| **loyaltiesMembersRedemptionRedeemRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody**](../Model/LoyaltiesMembersRedemptionRedeemRequestBody.md)| Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody**](../Model/LoyaltiesMembersRedemptionRedeemResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `redeemReward1()` + +```php +redeemReward1($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody): \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody +``` + +Redeem Reward + +Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID. +$memberId = 'memberId_example'; // string | A code that identifies the loyalty card. +$loyaltiesMembersRedemptionRedeemRequestBody = {"reward":{"id":"rew_INt3fGH3n7xIr3ZQcq4kkUZ1","points":100},"order":{"items":[{"product_id":"prod_0c5d6689b39320059b","quantity":"1"},{"product_id":"prod_0b2c36568000039138","quantity":"2"}]}}; // \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + +try { + $result = $apiInstance->redeemReward1($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->redeemReward1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID. | | +| **memberId** | **string**| A code that identifies the loyalty card. | | +| **loyaltiesMembersRedemptionRedeemRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody**](../Model/LoyaltiesMembersRedemptionRedeemRequestBody.md)| Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody**](../Model/LoyaltiesMembersRedemptionRedeemResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `transferPoints()` + +```php +transferPoints($campaignId, $memberId, $loyaltiesTransferPoints): \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBody +``` + +Transfer Loyalty Points + +Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). +$memberId = 'memberId_example'; // string | A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). +$loyaltiesTransferPoints = [{"code":"0PmQ7JQI","points":1},{"code":"kCeufB8i","points":1}]; // \OpenAPI\Client\Model\LoyaltiesTransferPoints[] | Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + +try { + $result = $apiInstance->transferPoints($campaignId, $memberId, $loyaltiesTransferPoints); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->transferPoints: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). | | +| **memberId** | **string**| A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). | | +| **loyaltiesTransferPoints** | [**\OpenAPI\Client\Model\LoyaltiesTransferPoints[]**](../Model/LoyaltiesTransferPoints.md)| Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBody**](../Model/LoyaltiesMembersTransfersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateEarningRule()` + +```php +updateEarningRule($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody): \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBody +``` + +Update Earning Rule + +Update an earning rule definition. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$earningRuleId = 'earningRuleId_example'; // string | A unique earning rule ID. +$loyaltiesEarningRulesUpdateRequestBody = {"validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"FIXED","points":"5"},"source":{"banner":"Order paid 5 points."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid - fixed amount of points"}}; // \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBody | Specify the parameters that you would like to update for the given earning rule. + +try { + $result = $apiInstance->updateEarningRule($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->updateEarningRule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **earningRuleId** | **string**| A unique earning rule ID. | | +| **loyaltiesEarningRulesUpdateRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBody**](../Model/LoyaltiesEarningRulesUpdateRequestBody.md)| Specify the parameters that you would like to update for the given earning rule. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBody**](../Model/LoyaltiesEarningRulesUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateLoyaltyCardBalance()` + +```php +updateLoyaltyCardBalance($memberId, $loyaltiesMembersBalanceUpdateRequestBody): \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody +``` + +Add or Remove Loyalty Card Balance + +This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >🚧 Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. + +### 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\LoyaltiesApi( + // 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 +); +$memberId = 'memberId_example'; // string | Unique loyalty card assigned to a particular customer. +$loyaltiesMembersBalanceUpdateRequestBody = {"points":-100}; // \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody | Specify the point adjustment along with the expiration mechanism. + +try { + $result = $apiInstance->updateLoyaltyCardBalance($memberId, $loyaltiesMembersBalanceUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->updateLoyaltyCardBalance: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **memberId** | **string**| Unique loyalty card assigned to a particular customer. | | +| **loyaltiesMembersBalanceUpdateRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody**](../Model/LoyaltiesMembersBalanceUpdateRequestBody.md)| Specify the point adjustment along with the expiration mechanism. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody**](../Model/LoyaltiesMembersBalanceUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateLoyaltyCardBalance1()` + +```php +updateLoyaltyCardBalance1($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody): \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody +``` + +Add or Remove Loyalty Card Balance + +This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >🚧 Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID. +$memberId = 'memberId_example'; // string | A code that identifies the loyalty card. +$loyaltiesMembersBalanceUpdateRequestBody = {"points":100,"expiration_type":"CUSTOM_DATE","expiration_date":"2023-05-30"}; // \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody | Specify the point adjustment along with the expiration mechanism. + +try { + $result = $apiInstance->updateLoyaltyCardBalance1($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->updateLoyaltyCardBalance1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID. | | +| **memberId** | **string**| A code that identifies the loyalty card. | | +| **loyaltiesMembersBalanceUpdateRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody**](../Model/LoyaltiesMembersBalanceUpdateRequestBody.md)| Specify the point adjustment along with the expiration mechanism. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody**](../Model/LoyaltiesMembersBalanceUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateLoyaltyProgram()` + +```php +updateLoyaltyProgram($campaignId, $loyaltiesUpdateCampaignRequestBody): \OpenAPI\Client\Model\LoyaltiesUpdateCampaignResponseBody +``` + +Update Loyalty Campaign + +Updates a loyalty program. Fields other than those specified in the allowed request body payload wont be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. This method will update the loyalty cards which have not been published or redeemed yet. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$loyaltiesUpdateCampaignRequestBody = {"description":"This is a campaign description. Updated","auto_join":false,"join_once":false,"start_date":"2013-10-26T00:00:00Z","expiration_date":"2025-10-26T00:00:00Z","validity_timeframe":{"duration":"PT2H","interval":"P2D"},"validity_day_of_week":[0,1,2,3,4,5,6],"activity_duration_after_publishing":"P25D","category_id":"cat_0b6152ce12414820dd","loyalty_card":{"points":1,"expiration_rules":{"period_type":"MONTH","period_value":4,"rounding_type":"END_OF_YEAR"}},"metadata":{"test":false},"type":"AUTO_UPDATE","loyalty_tiers_expiration":{"qualification_type":"BALANCE","start_date":{"type":"IMMEDIATE"},"expiration_date":{"type":"CUSTOM","extend":"P4M","rounding":{"type":"CUSTOM","unit":"MONTH","value":1}}}}; // \OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBody | Specify the new values for the parameters that you would like to update for the given loyalty campaign. + +try { + $result = $apiInstance->updateLoyaltyProgram($campaignId, $loyaltiesUpdateCampaignRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->updateLoyaltyProgram: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **loyaltiesUpdateCampaignRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBody**](../Model/LoyaltiesUpdateCampaignRequestBody.md)| Specify the new values for the parameters that you would like to update for the given loyalty campaign. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesUpdateCampaignResponseBody**](../Model/LoyaltiesUpdateCampaignResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateRewardAssignment1()` + +```php +updateRewardAssignment1($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody): \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBody +``` + +Update Reward Assignment + +Updates rewards parameters, i.e. the points cost for the specific reward. + +### 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\LoyaltiesApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. +$loyaltiesRewardsUpdateAssignmentRequestBody = {"parameters":{"loyalty":{"points":3}}}; // \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBody | Update the points cost for the reward assignment. + +try { + $result = $apiInstance->updateRewardAssignment1($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LoyaltiesApi->updateRewardAssignment1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | | +| **assignmentId** | **string**| A unique reward assignment ID. | | +| **loyaltiesRewardsUpdateAssignmentRequestBody** | [**\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBody**](../Model/LoyaltiesRewardsUpdateAssignmentRequestBody.md)| Update the points cost for the reward assignment. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBody**](../Model/LoyaltiesRewardsUpdateAssignmentResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/OrdersApi.md b/docs/Api/OrdersApi.md new file mode 100644 index 0000000..25aaf9c --- /dev/null +++ b/docs/Api/OrdersApi.md @@ -0,0 +1,421 @@ +# OpenAPI\Client\OrdersApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createOrder()**](OrdersApi.md#createOrder) | **POST** /v1/orders | Create Order | +| [**createOrderExport()**](OrdersApi.md#createOrderExport) | **POST** /v1/orders/export | Create Orders Export | +| [**getOrder()**](OrdersApi.md#getOrder) | **GET** /v1/orders/{orderId} | Get Order | +| [**importOrders()**](OrdersApi.md#importOrders) | **POST** /v1/orders/import | Import Orders | +| [**listOrders()**](OrdersApi.md#listOrders) | **GET** /v1/orders | List Orders | +| [**updateOrder()**](OrdersApi.md#updateOrder) | **PUT** /v1/orders/{orderId} | Update Order | + + +## `createOrder()` + +```php +createOrder($ordersCreateRequestBody): \OpenAPI\Client\Model\OrdersCreateResponseBody +``` + +Create Order + +Creates an order object and triggers an order creation event. 📘 Upsert Mode If you pass an id or a source_id that already exists in the order database, Voucherify will return a related order object with updated fields. + +### 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\OrdersApi( + // 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 +); +$ordersCreateRequestBody = {"amount":20000,"customer":{"source_id":"sample_customer"},"status":"PAID","items":[{"quantity":1,"price":20000,"source_id":"sample product1","related_object":"product","product":{"metadata":{"key":"value"}}}]}; // \OpenAPI\Client\Model\OrdersCreateRequestBody | Specify the order parameters. + +try { + $result = $apiInstance->createOrder($ordersCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrdersApi->createOrder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **ordersCreateRequestBody** | [**\OpenAPI\Client\Model\OrdersCreateRequestBody**](../Model/OrdersCreateRequestBody.md)| Specify the order parameters. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\OrdersCreateResponseBody**](../Model/OrdersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createOrderExport()` + +```php +createOrderExport($ordersExportCreateRequestBody): \OpenAPI\Client\Model\OrdersExportCreateResponseBody +``` + +Create Orders Export + +Creates a downloadable CSV file containing a list of orders. The parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the parameters.fields object in the request body. The available filters are all order object attributes. Additionally, any metadata defined in the metadata schema can be exported. Passing an empty JSON will generate a file containing three default fields: id, source_id, and status. The fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: + +### 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\OrdersApi( + // 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 +); +$ordersExportCreateRequestBody = {"parameters":{"fields":["id","source_id","status","created_at","updated_at","amount","discount_amount","items_discount_amount","total_discount_amount","total_amount","customer_id","referrer_id","metadata.payment_mean"]}}; // \OpenAPI\Client\Model\OrdersExportCreateRequestBody | Specify which order parameters you would like to export. + +try { + $result = $apiInstance->createOrderExport($ordersExportCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrdersApi->createOrderExport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **ordersExportCreateRequestBody** | [**\OpenAPI\Client\Model\OrdersExportCreateRequestBody**](../Model/OrdersExportCreateRequestBody.md)| Specify which order parameters you would like to export. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\OrdersExportCreateResponseBody**](../Model/OrdersExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getOrder()` + +```php +getOrder($orderId): \OpenAPI\Client\Model\OrdersGetResponseBody +``` + +Get Order + +Retrieve an order. + +### 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\OrdersApi( + // 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 +); +$orderId = 'orderId_example'; // string | Unique Voucherify order ID or order source ID. + +try { + $result = $apiInstance->getOrder($orderId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrdersApi->getOrder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **orderId** | **string**| Unique Voucherify order ID or order source ID. | | + +### Return type + +[**\OpenAPI\Client\Model\OrdersGetResponseBody**](../Model/OrdersGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `importOrders()` + +```php +importOrders($ordersImportCreateRequestBodyItem): \OpenAPI\Client\Model\OrdersImportCreateResponseBody +``` + +Import Orders + +🚧 Historical orders This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the create order and update order endpoints should be used. This is critical because this endpoint does not store events or launch distributions. # Limitations ## Import volume There can be only a single on-going order import per tenant per project at a given time. The user can schedule more imports but those extra imports will be scheduled to run in sequence one by one. ## Maximum count of orders in single import There is a 2000 limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time. # Notifications There are no notifications on the Dashboard because this import is launched via the API. # Triggered actions If you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segments summary. Consequently, this update will trigger - **customers entering into segments** - **distributions** based on any rules tied to customer entering segment(s) - **earning rules** based on the customer entering segment(s) # What is not triggered 1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. 2. Distributions based on Order Update, Order Paid, Order Created and Order Cancelled. In other words if you have a distribution based on Order Paid and you import an order with a PAID status, the distribution is not going to be triggered. 3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you wont see any events in the Activity tab in the Dashboard such as Order created or Order paid. If you are additionally upserting products / skus, then you wont see the Product created events listed, etc. 4. Earning rules based on Order Paid wont be triggered. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\OrdersApi( + // 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 +); +$ordersImportCreateRequestBodyItem = [{"source_id":"orderImport14","status":"PAID","metadata":{"location_id":["L1","L2"],"payment_mean":["paypal","credit-card"]},"customer":{"source_id":"bob2.smith@email.com","name":"Bob Smith","description":"A nice customer","email":"bob.smith@email.com","phone":"+1 933 222 3333","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthdate":"2022-01-01"},"referrer":{"source_id":"jane.smith@email.com","name":"Jane Smith","description":"A really nice customer","email":"jane.smith@email.com","phone":"+1 933 222 3334","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":false},"birthday":"2022-03-03"},"items":[{"source_id":"prod_1","related_object":"product","quantity":2,"product":{"name":"Apple iPhone 12","price":70000,"metadata":{"color":["silver"],"vendor":"mall"},"override":true}},{"source_id":"ComicBook_1","related_object":"sku","quantity":1,"product":{"source_id":"Books","name":"Comic Books1","price":1600,"metadata":{"color":["silver"],"vendor":"Bookstore1"},"override":true},"sku":{"sku":"Comics1","source_id":"ComicBook_1","price":1600,"metadata":{"color":["golden"],"vendor":"islands"},"override":true}}]},{"source_id":"orderImport15","status":"PAID","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"customer":{"source_id":"bob2.smith@email.com"},"referrer":{"source_id":"jane.smith@email.com"},"items":[{"source_id":"ComicBook_1","quantity":4,"related_object":"sku","sku":{"source_id":"ComicBook_1"}},{"source_id":"vase_1","quantity":1,"related_object":"product","product":{"source_id":"vase_1"}}]},{"source_id":"orderImport16","status":"FULFILLED","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"customer":{"id":"cust_LMY4ZylSdUYB1J4tzqNcl5VV"},"referrer":{"id":"cust_Vzck5i8U3OhcEUFY6MKhN9Rv"},"items":[{"product_id":"prod_0b72b0bd64d198e3ae","quantity":2},{"sku_id":"sku_0b1621b319d248b79f","quantity":2}]},{"source_id":"orderImport17","status":"CANCELED","amount":7000,"metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]}},{"source_id":"orderImport18","status":"CREATED","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"items":[{"source_id":"ComicBook_1","amount":900,"related_object":"sku"},{"source_id":"vase_1","amount":2000,"related_object":"product"}]},{"source_id":"orderImport19","status":"CREATED","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"items":[{"amount":900},{"amount":2000}]},{"source_id":"orderImport20","status":"CREATED","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"items":[{"price":900,"quantity":2},{"price":2000,"quantity":3}]}]; // \OpenAPI\Client\Model\OrdersImportCreateRequestBodyItem[] | The request body is sent in the form of an array of order objects. + +try { + $result = $apiInstance->importOrders($ordersImportCreateRequestBodyItem); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrdersApi->importOrders: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **ordersImportCreateRequestBodyItem** | [**\OpenAPI\Client\Model\OrdersImportCreateRequestBodyItem[]**](../Model/OrdersImportCreateRequestBodyItem.md)| The request body is sent in the form of an array of order objects. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\OrdersImportCreateResponseBody**](../Model/OrdersImportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listOrders()` + +```php +listOrders($limit, $page, $order): \OpenAPI\Client\Model\OrdersListResponseBody +``` + +List Orders + +Returns a list of orders. + +### 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\OrdersApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListOrders(); // ParameterOrderListOrders | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listOrders($limit, $page, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrdersApi->listOrders: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListOrders**](../Model/.md)| This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\OrdersListResponseBody**](../Model/OrdersListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateOrder()` + +```php +updateOrder($orderId, $ordersUpdateRequestBody): \OpenAPI\Client\Model\OrdersUpdateResponseBody +``` + +Update Order + +Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged. + +### 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\OrdersApi( + // 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 +); +$orderId = 'orderId_example'; // string | Unique Voucherify order ID or order source ID. +$ordersUpdateRequestBody = {"status":"CANCELED"}; // \OpenAPI\Client\Model\OrdersUpdateRequestBody | Specify the parameters of the order that are to be updated. + +try { + $result = $apiInstance->updateOrder($orderId, $ordersUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrdersApi->updateOrder: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **orderId** | **string**| Unique Voucherify order ID or order source ID. | | +| **ordersUpdateRequestBody** | [**\OpenAPI\Client\Model\OrdersUpdateRequestBody**](../Model/OrdersUpdateRequestBody.md)| Specify the parameters of the order that are to be updated. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\OrdersUpdateResponseBody**](../Model/OrdersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/ProductCollectionsApi.md b/docs/Api/ProductCollectionsApi.md new file mode 100644 index 0000000..ac0ac8e --- /dev/null +++ b/docs/Api/ProductCollectionsApi.md @@ -0,0 +1,358 @@ +# OpenAPI\Client\ProductCollectionsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createProductCollection()**](ProductCollectionsApi.md#createProductCollection) | **POST** /v1/product-collections | Create Product Collection | +| [**deleteProductCollection()**](ProductCollectionsApi.md#deleteProductCollection) | **DELETE** /v1/product-collections/{productCollectionId} | Delete Product Collection | +| [**getProductCollection()**](ProductCollectionsApi.md#getProductCollection) | **GET** /v1/product-collections/{productCollectionId} | Get Product Collection | +| [**listProductCollections()**](ProductCollectionsApi.md#listProductCollections) | **GET** /v1/product-collections | List Product Collections | +| [**listProductsInCollection()**](ProductCollectionsApi.md#listProductsInCollection) | **GET** /v1/product-collections/{productCollectionId}/products | List Products in Collection | + + +## `createProductCollection()` + +```php +createProductCollection($productCollectionsCreateRequestBody): \OpenAPI\Client\Model\ProductCollectionsCreateResponseBody +``` + +Create Product Collection + +This method creates a new product collection. + +### 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\ProductCollectionsApi( + // 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 +); +$productCollectionsCreateRequestBody = new \OpenAPI\Client\Model\ProductCollectionsCreateRequestBody(); // \OpenAPI\Client\Model\ProductCollectionsCreateRequestBody + +try { + $result = $apiInstance->createProductCollection($productCollectionsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductCollectionsApi->createProductCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productCollectionsCreateRequestBody** | [**\OpenAPI\Client\Model\ProductCollectionsCreateRequestBody**](../Model/ProductCollectionsCreateRequestBody.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductCollectionsCreateResponseBody**](../Model/ProductCollectionsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteProductCollection()` + +```php +deleteProductCollection($productCollectionId) +``` + +Delete Product Collection + +This method deletes a product collection. + +### 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\ProductCollectionsApi( + // 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 +); +$productCollectionId = 'productCollectionId_example'; // string | A unique product collection ID. + +try { + $apiInstance->deleteProductCollection($productCollectionId); +} catch (Exception $e) { + echo 'Exception when calling ProductCollectionsApi->deleteProductCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productCollectionId** | **string**| A unique product collection ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getProductCollection()` + +```php +getProductCollection($productCollectionId): \OpenAPI\Client\Model\ProductCollectionsGetResponseBody +``` + +Get Product Collection + +Retrieves the product collection. + +### 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\ProductCollectionsApi( + // 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 +); +$productCollectionId = 'productCollectionId_example'; // string | A unique product collection ID. + +try { + $result = $apiInstance->getProductCollection($productCollectionId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductCollectionsApi->getProductCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productCollectionId** | **string**| A unique product collection ID. | | + +### Return type + +[**\OpenAPI\Client\Model\ProductCollectionsGetResponseBody**](../Model/ProductCollectionsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listProductCollections()` + +```php +listProductCollections($limit, $page, $order): \OpenAPI\Client\Model\ProductCollectionsListResponseBody +``` + +List Product Collections + +This method returns a list of product collections. + +### 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\ProductCollectionsApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrder(); // ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listProductCollections($limit, $page, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductCollectionsApi->listProductCollections: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrder**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductCollectionsListResponseBody**](../Model/ProductCollectionsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listProductsInCollection()` + +```php +listProductsInCollection($productCollectionId, $limit, $page, $order, $startingAfter): \OpenAPI\Client\Model\ProductCollectionsProductsListResponseBody +``` + +List Products in Collection + +Retrieves list of products from a product collection; works for both dynamic and static product collections. + +### 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\ProductCollectionsApi( + // 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 +); +$productCollectionId = 'productCollectionId_example'; // string | Unique product collection ID. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrder(); // ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$startingAfter = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. + +try { + $result = $apiInstance->listProductsInCollection($productCollectionId, $limit, $page, $order, $startingAfter); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductCollectionsApi->listProductsInCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productCollectionId** | **string**| Unique product collection ID. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrder**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **startingAfter** | **\DateTime**| Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductCollectionsProductsListResponseBody**](../Model/ProductCollectionsProductsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[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/ProductsApi.md b/docs/Api/ProductsApi.md new file mode 100644 index 0000000..4a7ed96 --- /dev/null +++ b/docs/Api/ProductsApi.md @@ -0,0 +1,989 @@ +# OpenAPI\Client\ProductsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createProduct()**](ProductsApi.md#createProduct) | **POST** /v1/products | Create Product | +| [**createSku()**](ProductsApi.md#createSku) | **POST** /v1/products/{productId}/skus | Create SKU | +| [**deleteProduct()**](ProductsApi.md#deleteProduct) | **DELETE** /v1/products/{productId} | Delete Product | +| [**deleteSku()**](ProductsApi.md#deleteSku) | **DELETE** /v1/products/{productId}/skus/{skuId} | Delete SKU | +| [**getProduct()**](ProductsApi.md#getProduct) | **GET** /v1/products/{productId} | Get Product | +| [**getSku()**](ProductsApi.md#getSku) | **GET** /v1/skus/{skuId} | Get SKU | +| [**importProductsUsingCsv()**](ProductsApi.md#importProductsUsingCsv) | **POST** /v1/products/importCSV | Import Products using CSV | +| [**importSkusUsingCsv()**](ProductsApi.md#importSkusUsingCsv) | **POST** /v1/skus/importCSV | Import SKUs using CSV | +| [**listProducts()**](ProductsApi.md#listProducts) | **GET** /v1/products | List Products | +| [**listSkusInProduct()**](ProductsApi.md#listSkusInProduct) | **GET** /v1/products/{productId}/skus | List SKUs in Product | +| [**updateProduct()**](ProductsApi.md#updateProduct) | **PUT** /v1/products/{productId} | Update Product | +| [**updateProductsInBulk()**](ProductsApi.md#updateProductsInBulk) | **POST** /v1/products/bulk/async | Update Products in Bulk | +| [**updateProductsMetadataInBulk()**](ProductsApi.md#updateProductsMetadataInBulk) | **POST** /v1/products/metadata/async | Update Products' Metadata in Bulk | +| [**updateSku()**](ProductsApi.md#updateSku) | **PUT** /v1/products/{productId}/skus/{skuId} | Update SKU | + + +## `createProduct()` + +```php +createProduct($productsCreateRequestBody): \OpenAPI\Client\Model\ProductsCreateResponseBody +``` + +Create Product + +Creates a product object. 📘 Upsert Mode If you pass an id or a source_id that already exists in the product database, Voucherify will return a related product object with updated fields. + +### 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\ProductsApi( + // 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 +); +$productsCreateRequestBody = {"source_id":"first_product","name":"Samsung Phone","price":200000,"attributes":["color","memory","processor"],"metadata":{"test":true,"vendor":"Online Store"},"image_url":"https://www.website.com/image.png"}; // \OpenAPI\Client\Model\ProductsCreateRequestBody | Specify the product parameters. + +try { + $result = $apiInstance->createProduct($productsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->createProduct: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productsCreateRequestBody** | [**\OpenAPI\Client\Model\ProductsCreateRequestBody**](../Model/ProductsCreateRequestBody.md)| Specify the product parameters. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsCreateResponseBody**](../Model/ProductsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createSku()` + +```php +createSku($productId, $productsSkusCreateRequestBody): \OpenAPI\Client\Model\ProductsSkusCreateResponseBody +``` + +Create SKU + +This method adds product variants to a created product. 📘 Upsert Mode If you pass an id or a source_id that already exists in the sku database, Voucherify will return a related sku object with updated fields. + +### 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\ProductsApi( + // 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 +); +$productId = 'productId_example'; // string | A Voucherify product ID or product source ID. +$productsSkusCreateRequestBody = {"source_id":"first_product_sku_1","sku":"Samsung phone 256GB","price":1300,"currency":"USD","attributes":{"color":"vintage-black","memory":"256","processor":"Intel"},"image_url":"https://www.website.com/image.png","metadata":{"imported":true}}; // \OpenAPI\Client\Model\ProductsSkusCreateRequestBody | Specify the SKU parameters to be created. + +try { + $result = $apiInstance->createSku($productId, $productsSkusCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->createSku: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productId** | **string**| A Voucherify product ID or product source ID. | | +| **productsSkusCreateRequestBody** | [**\OpenAPI\Client\Model\ProductsSkusCreateRequestBody**](../Model/ProductsSkusCreateRequestBody.md)| Specify the SKU parameters to be created. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsSkusCreateResponseBody**](../Model/ProductsSkusCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteProduct()` + +```php +deleteProduct($productId, $force) +``` + +Delete Product + +Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. + +### Example + +```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\ProductsApi( + // 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 +); +$productId = 'productId_example'; // string | A Voucherify product ID or source ID. +$force = True; // bool | If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. + +try { + $apiInstance->deleteProduct($productId, $force); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->deleteProduct: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productId** | **string**| A Voucherify product ID or source ID. | | +| **force** | **bool**| If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteSku()` + +```php +deleteSku($productId, $skuId, $force) +``` + +Delete SKU + +Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. + +### Example + +```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\ProductsApi( + // 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 +); +$productId = 'productId_example'; // string | A unique Voucherify product ID or product source ID. +$skuId = 'skuId_example'; // string | A Voucherify SKU ID or SKU source ID. +$force = True; // bool | If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. + +try { + $apiInstance->deleteSku($productId, $skuId, $force); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->deleteSku: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productId** | **string**| A unique Voucherify product ID or product source ID. | | +| **skuId** | **string**| A Voucherify SKU ID or SKU source ID. | | +| **force** | **bool**| If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getProduct()` + +```php +getProduct($productId): \OpenAPI\Client\Model\ProductsGetResponseBody +``` + +Get Product + +Retrieve product details. + +### 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\ProductsApi( + // 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 +); +$productId = 'productId_example'; // string | A Voucherify product ID or source ID. + +try { + $result = $apiInstance->getProduct($productId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->getProduct: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productId** | **string**| A Voucherify product ID or source ID. | | + +### Return type + +[**\OpenAPI\Client\Model\ProductsGetResponseBody**](../Model/ProductsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSku()` + +```php +getSku($skuId): \OpenAPI\Client\Model\SkusGetResponseBody +``` + +Get SKU + +Retrieve details of a SKU. + +### 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\ProductsApi( + // 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 +); +$skuId = 'skuId_example'; // string | A Voucherify SKU identifier or SKU source ID. + +try { + $result = $apiInstance->getSku($skuId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->getSku: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **skuId** | **string**| A Voucherify SKU identifier or SKU source ID. | | + +### Return type + +[**\OpenAPI\Client\Model\SkusGetResponseBody**](../Model/SkusGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `importProductsUsingCsv()` + +```php +importProductsUsingCsv($file): \OpenAPI\Client\Model\ProductsImportCsvCreateResponseBody +``` + +Import Products using CSV + +Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\ProductsApi( + // 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 +); +$file = "/path/to/file.txt"; // \SplFileObject | File path. + +try { + $result = $apiInstance->importProductsUsingCsv($file); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->importProductsUsingCsv: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **file** | **\SplFileObject****\SplFileObject**| File path. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsImportCsvCreateResponseBody**](../Model/ProductsImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `importSkusUsingCsv()` + +```php +importSkusUsingCsv($file): \OpenAPI\Client\Model\SkusImportCsvCreateResponseBody +``` + +Import SKUs using CSV + +Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\ProductsApi( + // 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 +); +$file = "/path/to/file.txt"; // \SplFileObject | File path. + +try { + $result = $apiInstance->importSkusUsingCsv($file); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->importSkusUsingCsv: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **file** | **\SplFileObject****\SplFileObject**| File path. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\SkusImportCsvCreateResponseBody**](../Model/SkusImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listProducts()` + +```php +listProducts($limit, $page, $order, $startDate, $endDate): \OpenAPI\Client\Model\ProductsListResponseBody +``` + +List Products + +Retrieve a list of products. + +### 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\ProductsApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrder(); // ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$startDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. +$endDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + +try { + $result = $apiInstance->listProducts($limit, $page, $order, $startDate, $endDate); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->listProducts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrder**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **startDate** | **\DateTime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | +| **endDate** | **\DateTime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsListResponseBody**](../Model/ProductsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listSkusInProduct()` + +```php +listSkusInProduct($productId, $limit, $page, $order, $startDate, $endDate): \OpenAPI\Client\Model\ProductsSkusListResponseBody +``` + +List SKUs in Product + +Retrieve all SKUs for a given product. + +### 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\ProductsApi( + // 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 +); +$productId = 'productId_example'; // string | A Voucherify product ID or product source ID. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrder(); // ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$startDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. +$endDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + +try { + $result = $apiInstance->listSkusInProduct($productId, $limit, $page, $order, $startDate, $endDate); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->listSkusInProduct: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productId** | **string**| A Voucherify product ID or product source ID. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrder**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **startDate** | **\DateTime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | +| **endDate** | **\DateTime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsSkusListResponseBody**](../Model/ProductsSkusListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateProduct()` + +```php +updateProduct($productId, $productsUpdateRequestBody): \OpenAPI\Client\Model\ProductsUpdateResponseBody +``` + +Update Product + +Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + +### 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\ProductsApi( + // 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 +); +$productId = 'productId_example'; // string | A Voucherify product ID or source ID. +$productsUpdateRequestBody = {"price":210000}; // \OpenAPI\Client\Model\ProductsUpdateRequestBody | Specify the parameters of the product that are to be updated. + +try { + $result = $apiInstance->updateProduct($productId, $productsUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->updateProduct: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productId** | **string**| A Voucherify product ID or source ID. | | +| **productsUpdateRequestBody** | [**\OpenAPI\Client\Model\ProductsUpdateRequestBody**](../Model/ProductsUpdateRequestBody.md)| Specify the parameters of the product that are to be updated. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsUpdateResponseBody**](../Model/ProductsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateProductsInBulk()` + +```php +updateProductsInBulk($productsUpdateInBulkRequestBody): \OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody +``` + +Update Products in Bulk + +Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### 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\ProductsApi( + // 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 +); +$productsUpdateInBulkRequestBody = [{"source_id":"first_product","name":"Samsung Phone 1","price":220000,"attributes":["color","memory","processor"],"metadata":{"test":true,"vendor":"Online Store - 3"},"image_url":"https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png"},{"source_id":"second_product","name":"Samsung Phone 2","price":230000,"attributes":["color","memory","processor"],"metadata":{"test":true,"vendor":"Online Store - 4"},"image_url":"https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png"}]; // \OpenAPI\Client\Model\ProductsUpdateInBulkRequestBody[] | List the product fields to be updated in each customer object. + +try { + $result = $apiInstance->updateProductsInBulk($productsUpdateInBulkRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->updateProductsInBulk: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productsUpdateInBulkRequestBody** | [**\OpenAPI\Client\Model\ProductsUpdateInBulkRequestBody[]**](../Model/ProductsUpdateInBulkRequestBody.md)| List the product fields to be updated in each customer object. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody**](../Model/ProductsUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateProductsMetadataInBulk()` + +```php +updateProductsMetadataInBulk($productsMetadataUpdateInBulkRequestBody): \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody +``` + +Update Products' Metadata in Bulk + +Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### 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\ProductsApi( + // 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 +); +$productsMetadataUpdateInBulkRequestBody = {"source_ids":["123-567-3433","test_volleyball"],"metadata":{"label":true,"origin":"PL"}}; // \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkRequestBody | List the source_ids of the products you would like to update with the metadata key/value pairs. + +try { + $result = $apiInstance->updateProductsMetadataInBulk($productsMetadataUpdateInBulkRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->updateProductsMetadataInBulk: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productsMetadataUpdateInBulkRequestBody** | [**\OpenAPI\Client\Model\ProductsMetadataUpdateInBulkRequestBody**](../Model/ProductsMetadataUpdateInBulkRequestBody.md)| List the source_ids of the products you would like to update with the metadata key/value pairs. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody**](../Model/ProductsMetadataUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateSku()` + +```php +updateSku($productId, $skuId, $productsSkusUpdateRequestBody): \OpenAPI\Client\Model\ProductsSkusUpdateResponseBody +``` + +Update SKU + +Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body schema wont be modified. Even if provided, they will be silently skipped. + +### 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\ProductsApi( + // 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 +); +$productId = 'productId_example'; // string | A unique Voucherify product ID or product source ID. +$skuId = 'skuId_example'; // string | A Voucherify SKU ID or SKU source ID. +$productsSkusUpdateRequestBody = {"price":210000,"currency":"PLN"}; // \OpenAPI\Client\Model\ProductsSkusUpdateRequestBody | Specify the parameters to be updated. + +try { + $result = $apiInstance->updateSku($productId, $skuId, $productsSkusUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductsApi->updateSku: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **productId** | **string**| A unique Voucherify product ID or product source ID. | | +| **skuId** | **string**| A Voucherify SKU ID or SKU source ID. | | +| **productsSkusUpdateRequestBody** | [**\OpenAPI\Client\Model\ProductsSkusUpdateRequestBody**](../Model/ProductsSkusUpdateRequestBody.md)| Specify the parameters to be updated. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ProductsSkusUpdateResponseBody**](../Model/ProductsSkusUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/PromotionsApi.md b/docs/Api/PromotionsApi.md new file mode 100644 index 0000000..e8a18a9 --- /dev/null +++ b/docs/Api/PromotionsApi.md @@ -0,0 +1,985 @@ +# OpenAPI\Client\PromotionsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addPromotionTierToCampaign()**](PromotionsApi.md#addPromotionTierToCampaign) | **POST** /v1/promotions/{campaignId}/tiers | Add Promotion Tier to Campaign | +| [**createPromotionStack()**](PromotionsApi.md#createPromotionStack) | **POST** /v1/promotions/{campaignId}/stacks | Create Promotion Stack | +| [**deletePromotionStack()**](PromotionsApi.md#deletePromotionStack) | **DELETE** /v1/promotions/{campaignId}/stacks/{stackId} | Delete Promotion Stack | +| [**deletePromotionTier()**](PromotionsApi.md#deletePromotionTier) | **DELETE** /v1/promotions/tiers/{promotionTierId} | Delete Promotion Tier | +| [**disablePromotionTier()**](PromotionsApi.md#disablePromotionTier) | **POST** /v1/promotions/tiers/{promotionTierId}/disable | Disable Promotion Tier | +| [**enablePromotionTier()**](PromotionsApi.md#enablePromotionTier) | **POST** /v1/promotions/tiers/{promotionTierId}/enable | Enable Promotion Tier | +| [**getPromotionStack()**](PromotionsApi.md#getPromotionStack) | **GET** /v1/promotions/{campaignId}/stacks/{stackId} | Get Promotion Stack | +| [**getPromotionTier()**](PromotionsApi.md#getPromotionTier) | **GET** /v1/promotions/tiers/{promotionTierId} | Get Promotion Tier | +| [**listAllPromotionStacks()**](PromotionsApi.md#listAllPromotionStacks) | **GET** /v1/promotions/stacks | List Promotion Stacks | +| [**listPromotionStacksInCampaign()**](PromotionsApi.md#listPromotionStacksInCampaign) | **GET** /v1/promotions/{campaignId}/stacks | List Promotion Stacks in Campaign | +| [**listPromotionTiers()**](PromotionsApi.md#listPromotionTiers) | **GET** /v1/promotions/tiers | List Promotion Tiers | +| [**listPromotionTiersFromCampaign()**](PromotionsApi.md#listPromotionTiersFromCampaign) | **GET** /v1/promotions/{campaignId}/tiers | List Promotion Tiers from Campaign | +| [**updatePromotionStack()**](PromotionsApi.md#updatePromotionStack) | **PUT** /v1/promotions/{campaignId}/stacks/{stackId} | Update Promotion Stack | +| [**updatePromotionTier()**](PromotionsApi.md#updatePromotionTier) | **PUT** /v1/promotions/tiers/{promotionTierId} | Update Promotion Tier | + + +## `addPromotionTierToCampaign()` + +```php +addPromotionTierToCampaign($campaignId, $promotionsTiersCreateRequestBody): \OpenAPI\Client\Model\PromotionsTiersCreateResponseBody +``` + +Add Promotion Tier to Campaign + +This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. + +### 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\PromotionsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID assigned by Voucherify. +$promotionsTiersCreateRequestBody = {"name":"Order more than $100","banner":"Order more than $100","action":{"discount":{"type":"AMOUNT","amount_off":3000,"effect":"APPLY_TO_ORDER"}},"metadata":{},"active":true,"start_date":"2022-09-21T00:00:00.000Z","expiration_date":"2022-09-30T00:00:00.000Z","validity_timeframe":{"interval":"P2D","duration":"P1D"},"validity_day_of_week":[1,2,3,4],"validation_rules":["val_q8qUBMOh5qIQ"]}; // \OpenAPI\Client\Model\PromotionsTiersCreateRequestBody | Specify the promotion tier parameters. + +try { + $result = $apiInstance->addPromotionTierToCampaign($campaignId, $promotionsTiersCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->addPromotionTierToCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID assigned by Voucherify. | | +| **promotionsTiersCreateRequestBody** | [**\OpenAPI\Client\Model\PromotionsTiersCreateRequestBody**](../Model/PromotionsTiersCreateRequestBody.md)| Specify the promotion tier parameters. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsTiersCreateResponseBody**](../Model/PromotionsTiersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createPromotionStack()` + +```php +createPromotionStack($campaignId, $promotionsStacksCreateRequestBody): \OpenAPI\Client\Model\PromotionsStacksCreateResponseBody +``` + +Create Promotion Stack + +This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order. + +### 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\PromotionsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID. +$promotionsStacksCreateRequestBody = {"name":"Fifth Stack","tiers":{"ids":["promo_aaAF8mVAzA0PF1igia2OC63d","promo_t9zdL6XMFk7B8fQ23zxELtdE","promo_dJNhAEeV5sR5oPQq1UrUdnMC"],"hierarchy_mode":"MANUAL"}}; // \OpenAPI\Client\Model\PromotionsStacksCreateRequestBody | Specify the order of promotion tiers for the promotion stack. + +try { + $result = $apiInstance->createPromotionStack($campaignId, $promotionsStacksCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->createPromotionStack: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID. | | +| **promotionsStacksCreateRequestBody** | [**\OpenAPI\Client\Model\PromotionsStacksCreateRequestBody**](../Model/PromotionsStacksCreateRequestBody.md)| Specify the order of promotion tiers for the promotion stack. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsStacksCreateResponseBody**](../Model/PromotionsStacksCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deletePromotionStack()` + +```php +deletePromotionStack($campaignId, $stackId) +``` + +Delete Promotion Stack + +This method deletes a promotion stack. + +### 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\PromotionsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. +$stackId = 'stackId_example'; // string | Promotion stack ID. + +try { + $apiInstance->deletePromotionStack($campaignId, $stackId); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->deletePromotionStack: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. | | +| **stackId** | **string**| Promotion stack ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deletePromotionTier()` + +```php +deletePromotionTier($promotionTierId) +``` + +Delete Promotion Tier + +This method deletes a promotion tier. + +### 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\PromotionsApi( + // 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 +); +$promotionTierId = 'promotionTierId_example'; // string | Unique promotion tier ID. + +try { + $apiInstance->deletePromotionTier($promotionTierId); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->deletePromotionTier: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **promotionTierId** | **string**| Unique promotion tier ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `disablePromotionTier()` + +```php +disablePromotionTier($promotionTierId): \OpenAPI\Client\Model\PromotionsTiersDisableResponseBody +``` + +Disable Promotion Tier + +This method disables a promotion tier, i.e. makes the active parameter false. + +### 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\PromotionsApi( + // 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 +); +$promotionTierId = 'promotionTierId_example'; // string | Unique promotion tier ID. + +try { + $result = $apiInstance->disablePromotionTier($promotionTierId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->disablePromotionTier: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **promotionTierId** | **string**| Unique promotion tier ID. | | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsTiersDisableResponseBody**](../Model/PromotionsTiersDisableResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `enablePromotionTier()` + +```php +enablePromotionTier($promotionTierId): \OpenAPI\Client\Model\PromotionsTiersEnableResponseBody +``` + +Enable Promotion Tier + +This method enables a promotion tier, i.e. makes the active parameter true. + +### 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\PromotionsApi( + // 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 +); +$promotionTierId = 'promotionTierId_example'; // string | Unique promotion tier ID. + +try { + $result = $apiInstance->enablePromotionTier($promotionTierId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->enablePromotionTier: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **promotionTierId** | **string**| Unique promotion tier ID. | | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsTiersEnableResponseBody**](../Model/PromotionsTiersEnableResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getPromotionStack()` + +```php +getPromotionStack($campaignId, $stackId): \OpenAPI\Client\Model\PromotionsStacksGetResponseBody +``` + +Get Promotion Stack + +This method returns the details of a promotion stack, including the promotion tiers grouped within the stack. + +### 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\PromotionsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. +$stackId = 'stackId_example'; // string | Promotion stack ID. + +try { + $result = $apiInstance->getPromotionStack($campaignId, $stackId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->getPromotionStack: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. | | +| **stackId** | **string**| Promotion stack ID. | | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsStacksGetResponseBody**](../Model/PromotionsStacksGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getPromotionTier()` + +```php +getPromotionTier($promotionTierId): \OpenAPI\Client\Model\PromotionsTiersGetResponseBody +``` + +Get Promotion Tier + +This method enables you to retrieve a specific promotion tier. + +### 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\PromotionsApi( + // 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 +); +$promotionTierId = 'promotionTierId_example'; // string | Unique promotion tier ID. + +try { + $result = $apiInstance->getPromotionTier($promotionTierId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->getPromotionTier: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **promotionTierId** | **string**| Unique promotion tier ID. | | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsTiersGetResponseBody**](../Model/PromotionsTiersGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listAllPromotionStacks()` + +```php +listAllPromotionStacks($limit, $page, $order, $createdAt, $updatedAt): \OpenAPI\Client\Model\PromotionsStacksListResponseBody +``` + +List Promotion Stacks + +This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks + +### 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\PromotionsApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListAllPromotionStacks(); // ParameterOrderListAllPromotionStacks | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$createdAt = new \OpenAPI\Client\Model\ParameterCreatedBeforeAfter(); // ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z +$updatedAt = new \OpenAPI\Client\Model\ParameterUpdatedBeforeAfter(); // ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + +try { + $result = $apiInstance->listAllPromotionStacks($limit, $page, $order, $createdAt, $updatedAt); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->listAllPromotionStacks: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListAllPromotionStacks**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **createdAt** | [**ParameterCreatedBeforeAfter**](../Model/.md)| A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **updatedAt** | [**ParameterUpdatedBeforeAfter**](../Model/.md)| A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsStacksListResponseBody**](../Model/PromotionsStacksListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listPromotionStacksInCampaign()` + +```php +listPromotionStacksInCampaign($campaignId): \OpenAPI\Client\Model\PromotionsStacksListResponseBody +``` + +List Promotion Stacks in Campaign + +This method enables you to list promotion stacks from a specified campaign. + +### 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\PromotionsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID. + +try { + $result = $apiInstance->listPromotionStacksInCampaign($campaignId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->listPromotionStacksInCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID. | | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsStacksListResponseBody**](../Model/PromotionsStacksListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listPromotionTiers()` + +```php +listPromotionTiers($isAvailable, $limit, $page, $order): \OpenAPI\Client\Model\PromotionsTiersListResponseBody +``` + +List Promotion Tiers + +This method enables you to list promotion tiers. + +### 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\PromotionsApi( + // 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 +); +$isAvailable = True; // bool | This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListPromotionTiers(); // ParameterOrderListPromotionTiers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listPromotionTiers($isAvailable, $limit, $page, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->listPromotionTiers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **isAvailable** | **bool**| This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. | [optional] | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListPromotionTiers**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsTiersListResponseBody**](../Model/PromotionsTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listPromotionTiersFromCampaign()` + +```php +listPromotionTiersFromCampaign($campaignId): \OpenAPI\Client\Model\PromotionsTiersListResponseBody +``` + +List Promotion Tiers from Campaign + +This method enables you to list promotion tiers from a specified campaign. + +### 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\PromotionsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | Unique campaign ID assigned by Voucherify. + +try { + $result = $apiInstance->listPromotionTiersFromCampaign($campaignId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->listPromotionTiersFromCampaign: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| Unique campaign ID assigned by Voucherify. | | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsTiersListResponseBody**](../Model/PromotionsTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updatePromotionStack()` + +```php +updatePromotionStack($campaignId, $stackId, $promotionsStacksUpdateRequestBody): \OpenAPI\Client\Model\PromotionsStacksUpdateResponseBody +``` + +Update Promotion Stack + +This methods allows for editing an existing stack. + +### 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\PromotionsApi( + // 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 +); +$campaignId = 'campaignId_example'; // string | ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. +$stackId = 'stackId_example'; // string | Promotion stack ID. +$promotionsStacksUpdateRequestBody = {"name":"Fifth Stack Modified","tiers":{"ids":["promo_aaAF8mVAzA0PF1igia2OC63d","promo_t9zdL6XMFk7B8fQ23zxELtdE"],"hierarchy_mode":"MANUAL"}}; // \OpenAPI\Client\Model\PromotionsStacksUpdateRequestBody | Specify the promotion stack parameters that you would like to update. + +try { + $result = $apiInstance->updatePromotionStack($campaignId, $stackId, $promotionsStacksUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->updatePromotionStack: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **campaignId** | **string**| ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. | | +| **stackId** | **string**| Promotion stack ID. | | +| **promotionsStacksUpdateRequestBody** | [**\OpenAPI\Client\Model\PromotionsStacksUpdateRequestBody**](../Model/PromotionsStacksUpdateRequestBody.md)| Specify the promotion stack parameters that you would like to update. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsStacksUpdateResponseBody**](../Model/PromotionsStacksUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updatePromotionTier()` + +```php +updatePromotionTier($promotionTierId, $promotionsTiersUpdateRequestBody): \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBody +``` + +Update Promotion Tier + +This method updates a promotion tier. + +### 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\PromotionsApi( + // 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 +); +$promotionTierId = 'promotionTierId_example'; // string | Unique promotion tier ID. +$promotionsTiersUpdateRequestBody = {"name":"Order more than $100 USD","banner":"Order more than $100 USD","action":{"discount":{"type":"PERCENT","percent_off":25,"effect":"APPLY_TO_ORDER"}},"metadata":{"level":"A-21"},"hierarchy":1,"start_date":"2022-09-22T00:00:00.000Z","expiration_date":"2022-09-29T00:00:00.000Z","validity_timeframe":{"interval":"P3D","duration":"P2D"},"validity_day_of_week":[1,2,3]}; // \OpenAPI\Client\Model\PromotionsTiersUpdateRequestBody | Specify the promotion tier parameters that you would like to update. + +try { + $result = $apiInstance->updatePromotionTier($promotionTierId, $promotionsTiersUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PromotionsApi->updatePromotionTier: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **promotionTierId** | **string**| Unique promotion tier ID. | | +| **promotionsTiersUpdateRequestBody** | [**\OpenAPI\Client\Model\PromotionsTiersUpdateRequestBody**](../Model/PromotionsTiersUpdateRequestBody.md)| Specify the promotion tier parameters that you would like to update. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBody**](../Model/PromotionsTiersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/PublicationsApi.md b/docs/Api/PublicationsApi.md new file mode 100644 index 0000000..cfa770e --- /dev/null +++ b/docs/Api/PublicationsApi.md @@ -0,0 +1,243 @@ +# OpenAPI\Client\PublicationsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createPublication()**](PublicationsApi.md#createPublication) | **POST** /v1/publications | Create Publication | +| [**createPublication1()**](PublicationsApi.md#createPublication1) | **GET** /v1/publications/create | Create Publication | +| [**listPublications()**](PublicationsApi.md#listPublications) | **GET** /v1/publications | List Publications | + + +## `createPublication()` + +```php +createPublication($joinOnce, $publicationsCreateRequestBody): \OpenAPI\Client\Model\PublicationsCreateResponseBody +``` + +Create Publication + +This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. 🚧 Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. 🚧 Publish multiple vouchers In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. 📘 Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. + +### 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\PublicationsApi( + // 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 +); +$joinOnce = True; // bool | Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. +$publicationsCreateRequestBody = {"campaign":{"name":"campaign-name"},"customer":{"source_id":"source-id","Name":"Customer Name","email":"customer email"},"voucher":"voucher-code","metadata":{"key":"value"}}; // \OpenAPI\Client\Model\PublicationsCreateRequestBody | Specify the publication parameters. + +try { + $result = $apiInstance->createPublication($joinOnce, $publicationsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PublicationsApi->createPublication: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **joinOnce** | **bool**| Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. | [optional] | +| **publicationsCreateRequestBody** | [**\OpenAPI\Client\Model\PublicationsCreateRequestBody**](../Model/PublicationsCreateRequestBody.md)| Specify the publication parameters. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PublicationsCreateResponseBody**](../Model/PublicationsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createPublication1()` + +```php +createPublication1($customer, $joinOnce, $voucher, $campaign, $sourceId, $metadata): \OpenAPI\Client\Model\PublicationsCreateResponseBody +``` + +Create Publication + +This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. ❗️ Limited access Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. 🚧 Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. 🚧 Publish multiple vouchers This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a dedicated endpoint. 📘 Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. # Example Request ❗️ Required Query param voucher OR campaign MUST be filled out. If you provide both, campaign param will be skipped. + +### 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\PublicationsApi( + // 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 = new \OpenAPI\Client\Model\Customer(); // Customer | Contains information about the customer to whom the publication was directed. +$joinOnce = True; // bool | Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. +$voucher = 'voucher_example'; // string | Code of voucher being published. +$campaign = new \OpenAPI\Client\Model\CreatePublicationCampaign(); // CreatePublicationCampaign | Create publication with campaign. +$sourceId = 'sourceId_example'; // string | The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. +$metadata = array('key' => new \stdClass); // object | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. + +try { + $result = $apiInstance->createPublication1($customer, $joinOnce, $voucher, $campaign, $sourceId, $metadata); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PublicationsApi->createPublication1: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customer** | [**Customer**](../Model/.md)| Contains information about the customer to whom the publication was directed. | | +| **joinOnce** | **bool**| Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. | [optional] | +| **voucher** | **string**| Code of voucher being published. | [optional] | +| **campaign** | [**CreatePublicationCampaign**](../Model/.md)| Create publication with campaign. | [optional] | +| **sourceId** | **string**| The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. | [optional] | +| **metadata** | [**object**](../Model/.md)| The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PublicationsCreateResponseBody**](../Model/PublicationsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listPublications()` + +```php +listPublications($limit, $page, $order, $campaign, $customer, $voucher, $result, $voucherType, $isReferralCode, $filters, $sourceId): \OpenAPI\Client\Model\PublicationsListResponseBody +``` + +List Publications + +Retrieve a list of publications. To return a **particular** publication, you can use the source_id query parameter and provide the source_id of the publication you are looking for specifically. # Pagination 🚧 Important! If you want to scroll through a huge set of records, it is recommended to use the Exports API. This API will return an error page_over_limit if you reach a page above 1000. # Filter Query The filters query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows: ## Operators: ## Examples + +### 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\PublicationsApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListPublications(); // ParameterOrderListPublications | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$campaign = 'campaign_example'; // string | Filters by a given campaign name. +$customer = 'customer_example'; // string | Filters by a unique customer ID. +$voucher = 'voucher_example'; // string | Filters by a given voucher code. +$result = new \OpenAPI\Client\Model\ParameterResultListPublications(); // ParameterResultListPublications | Filters by a publication result. +$voucherType = new \OpenAPI\Client\Model\ParameterVoucherTypeListPublications(); // ParameterVoucherTypeListPublications | Filters by a voucher type. +$isReferralCode = True; // bool | This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. +$filters = 'filters_example'; // string | Allows for combining the filters mentioned in the endpoint description. +$sourceId = 'sourceId_example'; // string | Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. + +try { + $result = $apiInstance->listPublications($limit, $page, $order, $campaign, $customer, $voucher, $result, $voucherType, $isReferralCode, $filters, $sourceId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PublicationsApi->listPublications: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListPublications**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **campaign** | **string**| Filters by a given campaign name. | [optional] | +| **customer** | **string**| Filters by a unique customer ID. | [optional] | +| **voucher** | **string**| Filters by a given voucher code. | [optional] | +| **result** | [**ParameterResultListPublications**](../Model/.md)| Filters by a publication result. | [optional] | +| **voucherType** | [**ParameterVoucherTypeListPublications**](../Model/.md)| Filters by a voucher type. | [optional] | +| **isReferralCode** | **bool**| This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. | [optional] | +| **filters** | **string**| Allows for combining the filters mentioned in the endpoint description. | [optional] | +| **sourceId** | **string**| Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\PublicationsListResponseBody**](../Model/PublicationsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[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 new file mode 100644 index 0000000..f67aef8 --- /dev/null +++ b/docs/Api/QualificationsApi.md @@ -0,0 +1,75 @@ +# OpenAPI\Client\QualificationsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**checkEligibility()**](QualificationsApi.md#checkEligibility) | **POST** /v1/qualifications | Check Eligibility | + + +## `checkEligibility()` + +```php +checkEligibility($qualificationsCheckEligibilityRequestBody): \OpenAPI\Client\Model\QualificationsCheckEligibilityResponseBody +``` + +Check Eligibility + +🚧 The Qualifications endpoint ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read the dedicated guide to learn about some use cases this endpoint can cover. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + +### 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\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 +); +$qualificationsCheckEligibilityRequestBody = new \OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody(); // \OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody | Define order and customer context. + +try { + $result = $apiInstance->checkEligibility($qualificationsCheckEligibilityRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling QualificationsApi->checkEligibility: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **qualificationsCheckEligibilityRequestBody** | [**\OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody**](../Model/QualificationsCheckEligibilityRequestBody.md)| Define order and customer context. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\QualificationsCheckEligibilityResponseBody**](../Model/QualificationsCheckEligibilityResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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 new file mode 100644 index 0000000..6544a1e --- /dev/null +++ b/docs/Api/RedemptionsApi.md @@ -0,0 +1,441 @@ +# OpenAPI\Client\RedemptionsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**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()` + +```php +getRedemption($redemptionId): \OpenAPI\Client\Model\RedemptionsGetResponseBody +``` + +Get Redemption + +Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback. + +### 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 +); +$redemptionId = 'redemptionId_example'; // string | ID of previously created redemption. + +try { + $result = $apiInstance->getRedemption($redemptionId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->getRedemption: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **redemptionId** | **string**| ID of previously created redemption. | | + +### Return type + +[**\OpenAPI\Client\Model\RedemptionsGetResponseBody**](../Model/RedemptionsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getVoucherRedemptions()` + +```php +getVoucherRedemptions($code): \OpenAPI\Client\Model\VouchersRedemptionGetResponseBody +``` + +Get Voucher's Redemptions + +Retrieve the number of times a voucher was redeemed and each of the redemption details. + +### 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 +); +$code = 'code_example'; // string | A **code** that identifies the voucher. + +try { + $result = $apiInstance->getVoucherRedemptions($code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->getVoucherRedemptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A **code** that identifies the voucher. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersRedemptionGetResponseBody**](../Model/VouchersRedemptionGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listRedemptions()` + +```php +listRedemptions($limit, $page, $result, $campaign, $customer, $order, $createdAt, $filters): \OpenAPI\Client\Model\RedemptionsListResponseBody +``` + +List Redemptions + +Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. # Filtering results The result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date: https://api.voucherify.io/v1/redemptions?limit 3&[created_at][before] 2017-09-08T13:52:18.227Z. A filter based on the object created_at field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: [created_at][after], [created_at][before]. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z. # Failed Redemptions A redemption may fail for various reasons. You can figure out an exact reason from the failure_code: - resource_not_found - voucher with given code does not exist - voucher_not_active - voucher is not active yet (before start date) - voucher_expired - voucher has already expired (after expiration date) - voucher_disabled - voucher has been disabled (active: false) - quantity_exceeded - vouchers redemptions limit has been exceeded - gift_amount_exceeded - gift amount has been exceeded - customer_rules_violated - customer did not match the segment - order_rules_violated - order did not match validation rules - invalid_order - order was specified incorrectly - invalid_amount - order amount was specified incorrectly - missing_amount - order amount was not specified - missing_order_items - order items were not specified - missing_customer - customer was not specified + +### 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$result = 'result_example'; // string | A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. +$campaign = 'campaign_example'; // string | A filter by the campaign **name** that the redemption resources originate from. +$customer = 'customer_example'; // string | Return redemptions performed by the customer with given id or source_id. +$order = new \OpenAPI\Client\Model\ParameterOrderListRedemptions(); // ParameterOrderListRedemptions | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$createdAt = new \OpenAPI\Client\Model\ParameterCreatedBeforeAfter(); // ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z +$filters = new \OpenAPI\Client\Model\ParameterFiltersListRedemptions(); // ParameterFiltersListRedemptions | Filters for listing responses. + +try { + $result = $apiInstance->listRedemptions($limit, $page, $result, $campaign, $customer, $order, $createdAt, $filters); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->listRedemptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **result** | **string**| A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. | [optional] | +| **campaign** | **string**| A filter by the campaign **name** that the redemption resources originate from. | [optional] | +| **customer** | **string**| Return redemptions performed by the customer with given id or source_id. | [optional] | +| **order** | [**ParameterOrderListRedemptions**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **createdAt** | [**ParameterCreatedBeforeAfter**](../Model/.md)| A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **filters** | [**ParameterFiltersListRedemptions**](../Model/.md)| Filters for listing responses. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RedemptionsListResponseBody**](../Model/RedemptionsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `redeemStackedDiscounts()` + +```php +redeemStackedDiscounts($redemptionsRedeemRequestBody): \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: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. 📘 Also available on client-side This method is also accessible through public keys which you can use in client-side​ apps: mobile and web browser apps. Go to the dedicated endpoint to learn more. - Use X-Client-Application-Id as the application ID header. - Use X-Client-Token as the appliction secret key header. - Use client-side base URL. - Use an origin header for your custom domain. + +### Example + +```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 +); +$redemptionsRedeemRequestBody = {"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($redemptionsRedeemRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->redeemStackedDiscounts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **redemptionsRedeemRequestBody** | [**\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 +rollbackRedemption($redemptionId, $reason, $trackingId, $redemptionsRollbackCreateRequestBody): \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBody +``` + +Rollback Redemption + +Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. 🚧 You can roll back a redemption up to 3 months back. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. + +### 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 +); +$redemptionId = 'redemptionId_example'; // string | The original redemption ID to be rolled back (undone). +$reason = 'reason_example'; // string | Reason for the rollback. +$trackingId = 'trackingId_example'; // string | Customers source_id. +$redemptionsRollbackCreateRequestBody = {"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\RedemptionsRollbackCreateRequestBody | Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. + +try { + $result = $apiInstance->rollbackRedemption($redemptionId, $reason, $trackingId, $redemptionsRollbackCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->rollbackRedemption: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **redemptionId** | **string**| The original redemption ID to be rolled back (undone). | | +| **reason** | **string**| Reason for the rollback. | [optional] | +| **trackingId** | **string**| Customers source_id. | [optional] | +| **redemptionsRollbackCreateRequestBody** | [**\OpenAPI\Client\Model\RedemptionsRollbackCreateRequestBody**](../Model/RedemptionsRollbackCreateRequestBody.md)| Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBody**](../Model/RedemptionsRollbackCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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($parentRedemptionId, $reason, $trackingId, $redemptionsRollbacksCreateRequestBody): \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. 🚧 You can roll back a redemption up to 3 months back. + +### 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 +); +$parentRedemptionId = 'parentRedemptionId_example'; // string | Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. +$reason = 'reason_example'; // string | Reason for the rollback. +$trackingId = 'trackingId_example'; // string | Customers source_id. +$redemptionsRollbacksCreateRequestBody = {"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($parentRedemptionId, $reason, $trackingId, $redemptionsRollbacksCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->rollbackStackedRedemptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **parentRedemptionId** | **string**| Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. | | +| **reason** | **string**| Reason for the rollback. | [optional] | +| **trackingId** | **string**| Customers source_id. | [optional] | +| **redemptionsRollbacksCreateRequestBody** | [**\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/RewardsApi.md b/docs/Api/RewardsApi.md new file mode 100644 index 0000000..d67bc52 --- /dev/null +++ b/docs/Api/RewardsApi.md @@ -0,0 +1,705 @@ +# OpenAPI\Client\RewardsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createReward()**](RewardsApi.md#createReward) | **POST** /v1/rewards | Create Reward | +| [**createRewardAssignment()**](RewardsApi.md#createRewardAssignment) | **POST** /v1/rewards/{rewardId}/assignments | Create Reward Assignment | +| [**deleteReward()**](RewardsApi.md#deleteReward) | **DELETE** /v1/rewards/{rewardId} | Delete Reward | +| [**deleteRewardAssignment()**](RewardsApi.md#deleteRewardAssignment) | **DELETE** /v1/rewards/{rewardId}/assignments/{assignmentId} | Delete Reward Assignment | +| [**getReward()**](RewardsApi.md#getReward) | **GET** /v1/rewards/{rewardId} | Get Reward | +| [**getRewardAssignment()**](RewardsApi.md#getRewardAssignment) | **GET** /v1/rewards/{rewardId}/assignments/{assignmentId} | Get Reward Assignment | +| [**listRewardAssignments()**](RewardsApi.md#listRewardAssignments) | **GET** /v1/rewards/{rewardId}/assignments | List Reward Assignments | +| [**listRewards()**](RewardsApi.md#listRewards) | **GET** /v1/rewards | List Rewards | +| [**updateReward()**](RewardsApi.md#updateReward) | **PUT** /v1/rewards/{rewardId} | Update Reward | +| [**updateRewardAssignment()**](RewardsApi.md#updateRewardAssignment) | **PUT** /v1/rewards/{rewardId}/assignments/{assignmentId} | Update Reward Assignment | + + +## `createReward()` + +```php +createReward($rewardsCreateRequestBody): \OpenAPI\Client\Model\RewardsCreateResponseBody +``` + +Create Reward + +Create a new reward. + +### 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\RewardsApi( + // 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 +); +$rewardsCreateRequestBody = {"name":"Digital - Gift Card Reward","type":"CAMPAIGN","metadata":{"Type":"Gift"},"parameters":{"campaign":{"id":"camp_hC2GdqYtOmTT45zfhib62cK1","balance":3000}}}; // \OpenAPI\Client\Model\RewardsCreateRequestBody | Define parameters of the new reward. + +try { + $result = $apiInstance->createReward($rewardsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->createReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardsCreateRequestBody** | [**\OpenAPI\Client\Model\RewardsCreateRequestBody**](../Model/RewardsCreateRequestBody.md)| Define parameters of the new reward. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RewardsCreateResponseBody**](../Model/RewardsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createRewardAssignment()` + +```php +createRewardAssignment($rewardId, $rewardsAssignmentsCreateRequestBody): \OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBody +``` + +Create Reward Assignment + +Assigns a reward to a specified loyalty campaign. + +### 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\RewardsApi( + // 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 +); +$rewardId = 'rewardId_example'; // string | A unique reward ID. +$rewardsAssignmentsCreateRequestBody = {"campaign":"camp_OTuGGP90PivbvROsRvfM65El","parameters":{"loyalty":{"points":39}}}; // \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBody | Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. + +try { + $result = $apiInstance->createRewardAssignment($rewardId, $rewardsAssignmentsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->createRewardAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardId** | **string**| A unique reward ID. | | +| **rewardsAssignmentsCreateRequestBody** | [**\OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBody**](../Model/RewardsAssignmentsCreateRequestBody.md)| Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBody**](../Model/RewardsAssignmentsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteReward()` + +```php +deleteReward($rewardId) +``` + +Delete Reward + +Delete a reward. + +### 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\RewardsApi( + // 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 +); +$rewardId = 'rewardId_example'; // string | A unique reward ID. + +try { + $apiInstance->deleteReward($rewardId); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->deleteReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardId** | **string**| A unique reward ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteRewardAssignment()` + +```php +deleteRewardAssignment($rewardId, $assignmentId) +``` + +Delete Reward Assignment + +This method deletes a reward assignment for a particular reward. + +### 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\RewardsApi( + // 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 +); +$rewardId = 'rewardId_example'; // string | A unique reward ID. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. + +try { + $apiInstance->deleteRewardAssignment($rewardId, $assignmentId); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->deleteRewardAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardId** | **string**| A unique reward ID. | | +| **assignmentId** | **string**| A unique reward assignment ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getReward()` + +```php +getReward($rewardId): \OpenAPI\Client\Model\Reward +``` + +Get Reward + +Retrieve a reward by the reward ID. + +### 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\RewardsApi( + // 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 +); +$rewardId = 'rewardId_example'; // string | A unique reward ID. + +try { + $result = $apiInstance->getReward($rewardId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->getReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardId** | **string**| A unique reward ID. | | + +### Return type + +[**\OpenAPI\Client\Model\Reward**](../Model/Reward.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getRewardAssignment()` + +```php +getRewardAssignment($rewardId, $assignmentId): \OpenAPI\Client\Model\RewardsAssignmentsGetResponseBody +``` + +Get Reward Assignment + +Retrieve a reward assignment. + +### 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\RewardsApi( + // 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 +); +$rewardId = 'rewardId_example'; // string | A unique reward ID. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. + +try { + $result = $apiInstance->getRewardAssignment($rewardId, $assignmentId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->getRewardAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardId** | **string**| A unique reward ID. | | +| **assignmentId** | **string**| A unique reward assignment ID. | | + +### Return type + +[**\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBody**](../Model/RewardsAssignmentsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listRewardAssignments()` + +```php +listRewardAssignments($rewardId, $limit, $page): \OpenAPI\Client\Model\RewardsAssignmentsListResponseBody +``` + +List Reward Assignments + +Retrieve reward assignments by the reward ID. + +### 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\RewardsApi( + // 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 +); +$rewardId = 'rewardId_example'; // string | A unique reward ID. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. + +try { + $result = $apiInstance->listRewardAssignments($rewardId, $limit, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->listRewardAssignments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardId** | **string**| A unique reward ID. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RewardsAssignmentsListResponseBody**](../Model/RewardsAssignmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listRewards()` + +```php +listRewards($limit, $page, $assignmentId): \OpenAPI\Client\Model\RewardsListResponseBody +``` + +List Rewards + +Retrieve rewards. + +### 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\RewardsApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. + +try { + $result = $apiInstance->listRewards($limit, $page, $assignmentId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->listRewards: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **assignmentId** | **string**| A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RewardsListResponseBody**](../Model/RewardsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateReward()` + +```php +updateReward($rewardId, $rewardsUpdateRequestBody): \OpenAPI\Client\Model\RewardsUpdateResponseBody +``` + +Update Reward + +Update the details of a reward. + +### 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\RewardsApi( + // 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 +); +$rewardId = 'rewardId_example'; // string | A unique reward ID. +$rewardsUpdateRequestBody = {"name":"Digital - Gift Card Reward","metadata":{"Type":"Gift"},"parameters":{"campaign":{"id":"camp_hC2GdqYtOmTT45zfhib62cK1","balance":3000}}}; // \OpenAPI\Client\Model\RewardsUpdateRequestBody | Define the parameters to be updated for the reward. + +try { + $result = $apiInstance->updateReward($rewardId, $rewardsUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->updateReward: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardId** | **string**| A unique reward ID. | | +| **rewardsUpdateRequestBody** | [**\OpenAPI\Client\Model\RewardsUpdateRequestBody**](../Model/RewardsUpdateRequestBody.md)| Define the parameters to be updated for the reward. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RewardsUpdateResponseBody**](../Model/RewardsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateRewardAssignment()` + +```php +updateRewardAssignment($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody): \OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBody +``` + +Update Reward Assignment + +Update the number of points needed to successfully redeem the reward. + +### 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\RewardsApi( + // 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 +); +$rewardId = 'rewardId_example'; // string | A unique reward ID. +$assignmentId = 'assignmentId_example'; // string | A unique reward assignment ID. +$rewardsAssignmentsUpdateRequestBody = {"parameters":{"loyalty":{"points":35}}}; // \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBody | Define the number of points required to exchange for the reward. + +try { + $result = $apiInstance->updateRewardAssignment($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RewardsApi->updateRewardAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **rewardId** | **string**| A unique reward ID. | | +| **assignmentId** | **string**| A unique reward assignment ID. | | +| **rewardsAssignmentsUpdateRequestBody** | [**\OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBody**](../Model/RewardsAssignmentsUpdateRequestBody.md)| Define the number of points required to exchange for the reward. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBody**](../Model/RewardsAssignmentsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/SegmentsApi.md b/docs/Api/SegmentsApi.md new file mode 100644 index 0000000..d61e0f5 --- /dev/null +++ b/docs/Api/SegmentsApi.md @@ -0,0 +1,210 @@ +# OpenAPI\Client\SegmentsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createSegment()**](SegmentsApi.md#createSegment) | **POST** /v1/segments | Create Segment | +| [**deleteSegment()**](SegmentsApi.md#deleteSegment) | **DELETE** /v1/segments/{segmentId} | Delete Segment | +| [**getSegment()**](SegmentsApi.md#getSegment) | **GET** /v1/segments/{segmentId} | Get Segment | + + +## `createSegment()` + +```php +createSegment($segmentsCreateRequestBody): \OpenAPI\Client\Model\SegmentsCreateResponseBody +``` + +Create Segment + +Create a customer segment. 🚧 Limit on Static Segments There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment. + +### 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\SegmentsApi( + // 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 +); +$segmentsCreateRequestBody = {"name":"Customers in a new Segment","type":"static","customers":["cust_iajsExT2QB4sGWzABY85WRqV","cust_sehkNIi8Uq2qQuRqSr7xn4Zi"]}; // \OpenAPI\Client\Model\SegmentsCreateRequestBody | Specify the boundary conditions for the customer segment. + +try { + $result = $apiInstance->createSegment($segmentsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SegmentsApi->createSegment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **segmentsCreateRequestBody** | [**\OpenAPI\Client\Model\SegmentsCreateRequestBody**](../Model/SegmentsCreateRequestBody.md)| Specify the boundary conditions for the customer segment. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\SegmentsCreateResponseBody**](../Model/SegmentsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteSegment()` + +```php +deleteSegment($segmentId) +``` + +Delete Segment + +This method deletes a customer segment. + +### 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\SegmentsApi( + // 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 +); +$segmentId = 'segmentId_example'; // string | A unique customer segment ID. + +try { + $apiInstance->deleteSegment($segmentId); +} catch (Exception $e) { + echo 'Exception when calling SegmentsApi->deleteSegment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **segmentId** | **string**| A unique customer segment ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getSegment()` + +```php +getSegment($segmentId): \OpenAPI\Client\Model\SegmentsGetResponseBody +``` + +Get Segment + +Retrieves the segment with given segment ID. + +### 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\SegmentsApi( + // 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 +); +$segmentId = 'segmentId_example'; // string | A unique customer segment ID. + +try { + $result = $apiInstance->getSegment($segmentId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SegmentsApi->getSegment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **segmentId** | **string**| A unique customer segment ID. | | + +### Return type + +[**\OpenAPI\Client\Model\SegmentsGetResponseBody**](../Model/SegmentsGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[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/ValidationRulesApi.md b/docs/Api/ValidationRulesApi.md new file mode 100644 index 0000000..1327521 --- /dev/null +++ b/docs/Api/ValidationRulesApi.md @@ -0,0 +1,647 @@ +# OpenAPI\Client\ValidationRulesApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createValidationRuleAssignment()**](ValidationRulesApi.md#createValidationRuleAssignment) | **POST** /v1/validation-rules/{validationRuleId}/assignments | Create Validation Rules Assignments | +| [**createValidationRules()**](ValidationRulesApi.md#createValidationRules) | **POST** /v1/validation-rules | Create Validation Rules | +| [**deleteValidationRuleAssignment()**](ValidationRulesApi.md#deleteValidationRuleAssignment) | **DELETE** /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} | Delete Validation Rule Assignment | +| [**deleteValidationRules()**](ValidationRulesApi.md#deleteValidationRules) | **DELETE** /v1/validation-rules/{validationRuleId} | Delete Validation Rule | +| [**getValidationRule()**](ValidationRulesApi.md#getValidationRule) | **GET** /v1/validation-rules/{validationRuleId} | Get Validation Rule | +| [**listValidationRuleAssignments()**](ValidationRulesApi.md#listValidationRuleAssignments) | **GET** /v1/validation-rules/{validationRuleId}/assignments | List Validation Rule Assignments | +| [**listValidationRules()**](ValidationRulesApi.md#listValidationRules) | **GET** /v1/validation-rules | List Validation Rules | +| [**listValidationRulesAssignments()**](ValidationRulesApi.md#listValidationRulesAssignments) | **GET** /v1/validation-rules-assignments | List Validation Rules' Assignment(s) | +| [**updateValidationRule()**](ValidationRulesApi.md#updateValidationRule) | **PUT** /v1/validation-rules/{validationRuleId} | Update Validation Rule | + + +## `createValidationRuleAssignment()` + +```php +createValidationRuleAssignment($validationRuleId, $force, $validationRulesAssignmentsCreateRequestBody): \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateResponseBody +``` + +Create Validation Rules Assignments + +Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution. + +### 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\ValidationRulesApi( + // 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 +); +$validationRuleId = 'validationRuleId_example'; // string | Unique validation rule ID. +$force = True; // bool | If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. +$validationRulesAssignmentsCreateRequestBody = {"voucher":"v_ssR6vhswwh5odSloN2Vc3O60w7aea018"}; // \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateRequestBody | Specify the resource that you would like to assign the validation rule to. + +try { + $result = $apiInstance->createValidationRuleAssignment($validationRuleId, $force, $validationRulesAssignmentsCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->createValidationRuleAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validationRuleId** | **string**| Unique validation rule ID. | | +| **force** | **bool**| If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. | [optional] | +| **validationRulesAssignmentsCreateRequestBody** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsCreateRequestBody**](../Model/ValidationRulesAssignmentsCreateRequestBody.md)| Specify the resource that you would like to assign the validation rule to. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ValidationRulesAssignmentsCreateResponseBody**](../Model/ValidationRulesAssignmentsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createValidationRules()` + +```php +createValidationRules($validationRulesCreateRequestBody): \OpenAPI\Client\Model\ValidationRulesCreateResponseBody +``` + +Create Validation Rules + +Create validation rules. + +### 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\ValidationRulesApi( + // 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 +); +$validationRulesCreateRequestBody = {"name":"Set of Validation Rules","error":{"message":"Your order does not meet at least one of the required criteria."},"applicable_to":{"included_all":false,"excluded":[{"object":"product","id":"prod_0bae45ffc7003ffc52","source_id":"second_product","strict":false,"effect":"APPLY_TO_EVERY"}],"included":[{"object":"product","id":"prod_0b72b00ffed198e344","source_id":null,"effect":"APPLY_TO_MOST_EXPENSIVE","quantity_limit":1},{"object":"products_collection","id":"pc_4ndRXAsTOzwSdHcQcxf489uU","source_id":null,"effect":"APPLY_TO_EVERY","quantity_limit":5}]},"rules":{"1":{"name":"order.metadata","property":"location","rules":{},"conditions":{"$is":["Santorini"]},"error":{"message":"Your order must be placed at one of our Santorini shops."}},"2":{"name":"custom_event.metadata","property":"test","rules":{},"conditions":{"$greater_than_or_equal":[1]}},"3":{"name":"order.items.every","rules":{"1":{"name":"order.items.metadata","property":"test","rules":{},"conditions":{"$greater_than_or_equal":[1]}}},"conditions":{"$is":[{"id":"","effect":"APPLY_TO_EVERY","object":"product","source_id":""}]}},"logic":"1 or 2"}}; // \OpenAPI\Client\Model\ValidationRulesCreateRequestBody | Specify the validation rules parameters. + +try { + $result = $apiInstance->createValidationRules($validationRulesCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->createValidationRules: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validationRulesCreateRequestBody** | [**\OpenAPI\Client\Model\ValidationRulesCreateRequestBody**](../Model/ValidationRulesCreateRequestBody.md)| Specify the validation rules parameters. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ValidationRulesCreateResponseBody**](../Model/ValidationRulesCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteValidationRuleAssignment()` + +```php +deleteValidationRuleAssignment($validationRuleId, $assignmentId) +``` + +Delete Validation Rule Assignment + +This method deletes a validation rule assignment. + +### 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\ValidationRulesApi( + // 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 +); +$validationRuleId = 'validationRuleId_example'; // string | A unique validation rule ID. +$assignmentId = 'assignmentId_example'; // string | A unique validation rule assignment ID. + +try { + $apiInstance->deleteValidationRuleAssignment($validationRuleId, $assignmentId); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->deleteValidationRuleAssignment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validationRuleId** | **string**| A unique validation rule ID. | | +| **assignmentId** | **string**| A unique validation rule assignment ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteValidationRules()` + +```php +deleteValidationRules($validationRuleId) +``` + +Delete Validation Rule + +This method deletes a validation rule. + +### 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\ValidationRulesApi( + // 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 +); +$validationRuleId = 'validationRuleId_example'; // string | A unique validation rule ID. + +try { + $apiInstance->deleteValidationRules($validationRuleId); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->deleteValidationRules: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validationRuleId** | **string**| A unique validation rule ID. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getValidationRule()` + +```php +getValidationRule($validationRuleId): \OpenAPI\Client\Model\ValidationRulesGetResponseBody +``` + +Get Validation Rule + +Retrieve the details of a validation rule. + +### 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\ValidationRulesApi( + // 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 +); +$validationRuleId = 'validationRuleId_example'; // string | A unique validation rule ID. + +try { + $result = $apiInstance->getValidationRule($validationRuleId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->getValidationRule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validationRuleId** | **string**| A unique validation rule ID. | | + +### Return type + +[**\OpenAPI\Client\Model\ValidationRulesGetResponseBody**](../Model/ValidationRulesGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listValidationRuleAssignments()` + +```php +listValidationRuleAssignments($validationRuleId, $limit, $page, $order): \OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody +``` + +List Validation Rule Assignments + +Retrieve validation rule assignments for a specific validation rule. + +### 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\ValidationRulesApi( + // 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 +); +$validationRuleId = 'validationRuleId_example'; // string | Unique validation rule ID. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListValidationRuleAssignments(); // ParameterOrderListValidationRuleAssignments | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listValidationRuleAssignments($validationRuleId, $limit, $page, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->listValidationRuleAssignments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validationRuleId** | **string**| Unique validation rule ID. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListValidationRuleAssignments**](../Model/.md)| This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody**](../Model/ValidationRulesAssignmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listValidationRules()` + +```php +listValidationRules($limit, $page, $order, $startDate, $endDate): \OpenAPI\Client\Model\ValidationRulesListResponseBody +``` + +List Validation Rules + +Retrieve validation rules. + +### 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\ValidationRulesApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$order = new \OpenAPI\Client\Model\ParameterOrderListValidationRules(); // ParameterOrderListValidationRules | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$startDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. +$endDate = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + +try { + $result = $apiInstance->listValidationRules($limit, $page, $order, $startDate, $endDate); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->listValidationRules: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **order** | [**ParameterOrderListValidationRules**](../Model/.md)| This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **startDate** | **\DateTime**| Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. | [optional] | +| **endDate** | **\DateTime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ValidationRulesListResponseBody**](../Model/ValidationRulesListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listValidationRulesAssignments()` + +```php +listValidationRulesAssignments($relatedObjectId, $rule, $page, $limit, $order): \OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody +``` + +List Validation Rules' Assignment(s) + +List all validation rules assignments or filter the results using the related object ID or the validation rule ID query parameters. # How to retrieve specific validation rule assignments(s) ## Related object ID To find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. ## Validation rule ID You can use the validation rule ID to find assignment(s) for a specific validation rule. + +### 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\ValidationRulesApi( + // 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 +); +$relatedObjectId = 'relatedObjectId_example'; // string | The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. +$rule = 'rule_example'; // string | Validation rule ID. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$order = 'order_example'; // string | Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. + +try { + $result = $apiInstance->listValidationRulesAssignments($relatedObjectId, $rule, $page, $limit, $order); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->listValidationRulesAssignments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **relatedObjectId** | **string**| The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. | [optional] | +| **rule** | **string**| Validation rule ID. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **order** | **string**| Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody**](../Model/ValidationRulesAssignmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateValidationRule()` + +```php +updateValidationRule($validationRuleId, $validationRulesUpdateRequestBody): \OpenAPI\Client\Model\ValidationRulesUpdateResponseBody +``` + +Update Validation Rule + +Update validation rule parameters. + +### 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\ValidationRulesApi( + // 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 +); +$validationRuleId = 'validationRuleId_example'; // string | A unique validation rule ID. +$validationRulesUpdateRequestBody = {"name":"Set of Validation Rules Updated","error":{"message":"Your orders do not meet at least one of the required criteria."},"applicable_to":{"included_all":false,"excluded":[{"object":"product","id":"prod_0bae45ffc7003ffccc","source_id":"second_product","strict":false,"effect":"APPLY_TO_EVERY"}],"included":[{"object":"product","id":"prod_0b72b00ffed198e333","source_id":null,"effect":"APPLY_TO_CHEAPEST","quantity_limit":1},{"object":"products_collection","id":"pc_4ndRXAsTOzwSdHcQcxf489uU","source_id":null,"effect":"APPLY_TO_EVERY","quantity_limit":5}]},"rules":{"1":{"name":"order.metadata","property":"place","rules":{},"conditions":{"$is":["Santorini"]},"error":{"message":"Your order must be placed at one of our Santorini shops on the beach."}},"2":{"name":"custom_event.metadata","property":"lining","rules":{},"conditions":{"$greater_than_or_equal":[1]}},"3":{"name":"order.items.every","rules":{"1":{"name":"order.items.metadata","property":"test","rules":{},"conditions":{"$greater_than_or_equal":[1]}}},"conditions":{"$is":[{"id":"","effect":"APPLY_TO_EVERY","object":"product","source_id":""}]}},"logic":"1 and 2"}}; // \OpenAPI\Client\Model\ValidationRulesUpdateRequestBody | Specify the parameters to be updated. + +try { + $result = $apiInstance->updateValidationRule($validationRuleId, $validationRulesUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationRulesApi->updateValidationRule: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validationRuleId** | **string**| A unique validation rule ID. | | +| **validationRulesUpdateRequestBody** | [**\OpenAPI\Client\Model\ValidationRulesUpdateRequestBody**](../Model/ValidationRulesUpdateRequestBody.md)| Specify the parameters to be updated. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ValidationRulesUpdateResponseBody**](../Model/ValidationRulesUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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..81f15d6 --- /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($validationsValidateRequestBody): \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 +); +$validationsValidateRequestBody = {"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($validationsValidateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationsApi->validateStackedDiscounts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validationsValidateRequestBody** | [**\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/Api/VouchersApi.md b/docs/Api/VouchersApi.md new file mode 100644 index 0000000..0ff6500 --- /dev/null +++ b/docs/Api/VouchersApi.md @@ -0,0 +1,1129 @@ +# OpenAPI\Client\VouchersApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createVoucher()**](VouchersApi.md#createVoucher) | **POST** /v1/vouchers/{code} | Create Voucher | +| [**deleteVoucher()**](VouchersApi.md#deleteVoucher) | **DELETE** /v1/vouchers/{code} | Delete Voucher | +| [**disableVoucher()**](VouchersApi.md#disableVoucher) | **POST** /v1/vouchers/{code}/disable | Disable Voucher | +| [**enableVoucher()**](VouchersApi.md#enableVoucher) | **POST** /v1/vouchers/{code}/enable | Enable Voucher | +| [**exportVoucherTransactions()**](VouchersApi.md#exportVoucherTransactions) | **POST** /v1/vouchers/{code}/transactions/export | Export Voucher Transactions | +| [**generateRandomCode()**](VouchersApi.md#generateRandomCode) | **POST** /v1/vouchers | Generate Random Code | +| [**getVoucher()**](VouchersApi.md#getVoucher) | **GET** /v1/vouchers/{code} | Get Voucher | +| [**importVouchers()**](VouchersApi.md#importVouchers) | **POST** /v1/vouchers/import | Import Vouchers | +| [**importVouchersUsingCsv()**](VouchersApi.md#importVouchersUsingCsv) | **POST** /v1/vouchers/importCSV | Import Vouchers using CSV | +| [**listVoucherTransactions()**](VouchersApi.md#listVoucherTransactions) | **GET** /v1/vouchers/{code}/transactions | List Voucher Transactions | +| [**listVouchers()**](VouchersApi.md#listVouchers) | **GET** /v1/vouchers | List Vouchers | +| [**releaseValidationSession()**](VouchersApi.md#releaseValidationSession) | **DELETE** /v1/vouchers/{code}/sessions/{sessionKey} | Release Validation Session | +| [**updateVoucher()**](VouchersApi.md#updateVoucher) | **PUT** /v1/vouchers/{code} | Update Voucher | +| [**updateVoucherBalance()**](VouchersApi.md#updateVoucherBalance) | **POST** /v1/vouchers/{code}/balance | Add or Remove Voucher Balance | +| [**updateVouchersInBulk()**](VouchersApi.md#updateVouchersInBulk) | **POST** /v1/vouchers/bulk/async | Update Vouchers in Bulk | +| [**updateVouchersMetadataInBulk()**](VouchersApi.md#updateVouchersMetadataInBulk) | **POST** /v1/vouchers/metadata/async | Update Vouchers' Metadata in Bulk | + + +## `createVoucher()` + +```php +createVoucher($code, $vouchersCreateWithSpecificCodeRequestBody): \OpenAPI\Client\Model\VouchersCreateResponseBody +``` + +Create Voucher + +Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. + +### 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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A unique **code** that identifies the voucher. +$vouchersCreateWithSpecificCodeRequestBody = {"category":"New Customers","type":"DISCOUNT_VOUCHER","discount":{"percent_off":10,"type":"PERCENT","effect":"APPLY_TO_ORDER"},"start_date":"2022-01-01T00:00:00Z","expiration_date":"2022-12-31T23:59:59Z","validity_timeframe":{"duration":"PT1H","interval":"P2D"},"validity_day_of_week":[1,2,3,4,5],"active":false,"additional_info":"This voucher will remain inactive until enabled.","redemption":{"quantity":10},"metadata":{"test":true,"locale":"de-en"},"validation_rules":["val_4j7DCRm2IS59"]}; // \OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBody | Specify the details of the voucher that you would like to create. + +try { + $result = $apiInstance->createVoucher($code, $vouchersCreateWithSpecificCodeRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->createVoucher: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A unique **code** that identifies the voucher. | | +| **vouchersCreateWithSpecificCodeRequestBody** | [**\OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBody**](../Model/VouchersCreateWithSpecificCodeRequestBody.md)| Specify the details of the voucher that you would like to create. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\VouchersCreateResponseBody**](../Model/VouchersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteVoucher()` + +```php +deleteVoucher($code, $force) +``` + +Delete Voucher + +Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the voucher will be moved to the bin. + +### Example + +```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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A unique **code** that identifies the voucher. +$force = True; // bool | If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. + +try { + $apiInstance->deleteVoucher($code, $force); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->deleteVoucher: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A unique **code** that identifies the voucher. | | +| **force** | **bool**| If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `disableVoucher()` + +```php +disableVoucher($code): \OpenAPI\Client\Model\VouchersDisableResponseBody +``` + +Disable Voucher + +There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ This method sets the voucher state to **inactive**. The voucher cannot be redeemed. + +### 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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. + +try { + $result = $apiInstance->disableVoucher($code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->disableVoucher: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersDisableResponseBody**](../Model/VouchersDisableResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `enableVoucher()` + +```php +enableVoucher($code): \OpenAPI\Client\Model\VouchersEnableResponseBody +``` + +Enable Voucher + +There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ The method sets the voucher state to **active**. The voucher can be redeemed - only if the redemption occurs after the start date and the voucher is not expired. + +### 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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. + +try { + $result = $apiInstance->enableVoucher($code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->enableVoucher: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersEnableResponseBody**](../Model/VouchersEnableResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `exportVoucherTransactions()` + +```php +exportVoucherTransactions($code, $vouchersTransactionsExportCreateRequestBody): \OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBody +``` + +Export Voucher Transactions + +Export transactions that are associated with credit movements on a gift card or loyalty card. + +### 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\VouchersApi( + // 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 +); +$code = GIFT-CARD-1; // string | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. +$vouchersTransactionsExportCreateRequestBody = {"parameters":{"order":"-created_at","fields":["id","type","source_id","reason","balance","amount","created_at","voucher_id","campaign_id","details","source"]}}; // \OpenAPI\Client\Model\VouchersTransactionsExportCreateRequestBody | Specify the parameters for the transaction export. + +try { + $result = $apiInstance->exportVoucherTransactions($code, $vouchersTransactionsExportCreateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->exportVoucherTransactions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | | +| **vouchersTransactionsExportCreateRequestBody** | [**\OpenAPI\Client\Model\VouchersTransactionsExportCreateRequestBody**](../Model/VouchersTransactionsExportCreateRequestBody.md)| Specify the parameters for the transaction export. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBody**](../Model/VouchersTransactionsExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `generateRandomCode()` + +```php +generateRandomCode($body): \OpenAPI\Client\Model\VouchersCreateResponseBody +``` + +Generate Random Code + +Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. You can optionally use the code parameter to define a specific code or the code_config parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API. This method will return an error when trying to create a voucher that already exists. + +### 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\VouchersApi( + // 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 +); +$body = {"category":"New Customers","code":"NEW-WELCOME-COUPON","type":"DISCOUNT_VOUCHER","campaign_id":"camp_Y6dLsYIZloGqP8izufXY6SSJ","discount":{"percent_off":10,"type":"PERCENT","effect":"APPLY_TO_ORDER"},"start_date":"2016-01-01T00:00:00Z","expiration_date":"2022-12-31T23:59:59Z","validity_timeframe":{"duration":"PT1H","interval":"P2D"},"validity_day_of_week":[1,2,3,4,5],"active":false,"additional_info":"This voucher will remain inactive until enabled.","redemption":{"quantity":10},"metadata":{"test":true,"locale":"de-en"},"validation_rules":["val_4j7DCRm2IS59"]}; // object | Specify the details of the voucher that you would like to create. + +try { + $result = $apiInstance->generateRandomCode($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->generateRandomCode: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **body** | **object**| Specify the details of the voucher that you would like to create. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\VouchersCreateResponseBody**](../Model/VouchersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getVoucher()` + +```php +getVoucher($code): \OpenAPI\Client\Model\VouchersGetResponseBody +``` + +Get Voucher + +Retrieves the voucher with the given code or unique Voucherify ID. You can either pass the voucher ID which was assigned by Voucherify, e.g., v_7HxHkf4VAkMuc8u4lZs78lyRwhRze5UE, or the code of the voucher as the path parameter value, e.g., 7fjWdr. + +### 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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A unique **code** that identifies the voucher. + +try { + $result = $apiInstance->getVoucher($code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->getVoucher: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A unique **code** that identifies the voucher. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersGetResponseBody**](../Model/VouchersGetResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `importVouchers()` + +```php +importVouchers($vouchersImportCreateItemRequestBody): \OpenAPI\Client\Model\VouchersImportCreateResponseBody +``` + +Import Vouchers + +Import standalone vouchers and gift cards into the repository. 📘 Important notes - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. Any parameters not provided in the payload will be left blank or null. For both **standalone discount vouchers and gift cards**, you can import the following fields: - code - category - active - type - start_date - expiration_date - redemption.quantity - additional_info - metadata For **gift cards**, you can also import the following field: - gift.amount For **discount vouchers**, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type **requires** the type to be defined in the import. Fields other than the ones listed above wont be imported. Even if provided, they will be silently skipped. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\VouchersApi( + // 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 +); +$vouchersImportCreateItemRequestBody = [{"code":"PROMO-CODE30OFF-NO-EFFECT","category":"new customer acquisition","type":"DISCOUNT_VOUCHER","active":true,"discount":{"amount_off":3000,"type":"AMOUNT"},"start_date":"2020-12-01T23:00:00Z","expiration_date":"2023-12-19T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code1"},{"code":"PROMO-CODE30-PERCENT-NO-EFFECT","type":"DISCOUNT_VOUCHER","active":false,"discount":{"percent_off":30,"type":"PERCENT"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"GIFT-CARD-100","type":"GIFT_VOUCHER","active":true,"category":"new customer acquisition","gift":{"amount":10000},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":5},"metadata":{"unit":"EUR"},"additional_info":"secret-GIFT-code2"},{"code":"PROMO-CODE1-PERCENT-EFFECT-ORDER","type":"DISCOUNT_VOUCHER","active":false,"discount":{"percent_off":30,"type":"PERCENT","effect":"APPLY_TO_ORDER"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE2-PERCENT-EFFECT-ITEM","type":"DISCOUNT_VOUCHER","active":false,"discount":{"percent_off":30,"type":"PERCENT","effect":"APPLY_TO_ITEMS"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-PERCENT-NO-EFFECT-REDEEMED-QUANTITY-ATTRIBUTE-DOESNT-GET-PASSED","type":"DISCOUNT_VOUCHER","active":false,"discount":{"percent_off":30,"type":"PERCENT"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1,"redeemed_quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-AMOUNT-EFFECT-ITEMS-PROPORTIONALLY","type":"DISCOUNT_VOUCHER","active":false,"discount":{"amount_off":30,"type":"AMOUNT","effect":"APPLY_TO_ITEMS_PROPORTIONALLY"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-FIXED-EFFECT-ORDER","type":"DISCOUNT_VOUCHER","active":false,"discount":{"fixed_amount":30,"type":"FIXED","effect":"APPLY_TO_ORDER"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-UNIT-SINGLE-ITEM-EFFECT-MISSING","type":"DISCOUNT_VOUCHER","active":false,"discount":{"unit_off":1,"unit_type":"prod_0a9f9aeddb019a42db","type":"UNIT","effect":"ADD_MISSING_ITEMS"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE2-UNIT-MULTIPLE-ITEMS","type":"DISCOUNT_VOUCHER","active":true,"discount":{"type":"UNIT","effect":"ADD_MANY_ITEMS","units":[{"unit_off":1,"unit_type":"prod_0a9f9aeddb019a42db","effect":"ADD_MISSING_ITEMS"},{"unit_off":1,"unit_type":"prod_0a9f9aeddb019a42db","effect":"ADD_NEW_ITEMS"}]},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-SHIPPING","type":"DISCOUNT_VOUCHER","active":false,"discount":{"type":"UNIT","unit_off":1,"unit_type":"prod_5h1pp1ng","effect":"ADD_MISSING_ITEMS"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"}]; // \OpenAPI\Client\Model\VouchersImportCreateItemRequestBody[] | The request body is an array of objects. Each object contains details about a specific voucher. + +try { + $result = $apiInstance->importVouchers($vouchersImportCreateItemRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->importVouchers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **vouchersImportCreateItemRequestBody** | [**\OpenAPI\Client\Model\VouchersImportCreateItemRequestBody[]**](../Model/VouchersImportCreateItemRequestBody.md)| The request body is an array of objects. Each object contains details about a specific voucher. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersImportCreateResponseBody**](../Model/VouchersImportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `importVouchersUsingCsv()` + +```php +importVouchersUsingCsv($file): \OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody +``` + +Import Vouchers using CSV + +Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons). ___ 📘 Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. 📘 Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### 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\VouchersApi( + // 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 +); +$file = "/path/to/file.txt"; // \SplFileObject | File path. + +try { + $result = $apiInstance->importVouchersUsingCsv($file); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->importVouchersUsingCsv: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **file** | **\SplFileObject****\SplFileObject**| File path. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody**](../Model/VouchersImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listVoucherTransactions()` + +```php +listVoucherTransactions($code, $limit, $page): \OpenAPI\Client\Model\VouchersTransactionsListResponseBody +``` + +List Voucher Transactions + +List transactions that are associated with credit movements on a gift card or loyalty card. + +### 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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. + +try { + $result = $apiInstance->listVoucherTransactions($code, $limit, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->listVoucherTransactions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\VouchersTransactionsListResponseBody**](../Model/VouchersTransactionsListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listVouchers()` + +```php +listVouchers($limit, $page, $category, $campaignId, $customer, $campaign, $createdAt, $updatedAt, $order, $code, $ids): \OpenAPI\Client\Model\VouchersListResponseBody +``` + +List Vouchers + +Returns a list of vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 100 vouchers are returned in the response. When you get a list of vouchers, you can optionally specify query parameters to customize the number of vouchers returned per call using limit, which page of vouchers to return using page, sort the vouchers using the order query parameter and more. This method will return an error when trying to return a limit of more than 100 vouchers. + +### 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\VouchersApi( + // 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 +); +$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. +$page = 56; // int | Which page of results to return. The lowest value is 1. +$category = 'category_example'; // string | Limit search results to vouchers within the specified category. +$campaignId = 'campaignId_example'; // string | Limit search results to vouchers within the specified campaign +$customer = 'customer_example'; // string | A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. +$campaign = 'campaign_example'; // string | A unique campaign name, identifies the parent campaign. +$createdAt = new \OpenAPI\Client\Model\ParameterCreatedBeforeAfter(); // ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z +$updatedAt = new \OpenAPI\Client\Model\ParameterUpdatedBeforeAfter(); // ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z +$order = new \OpenAPI\Client\Model\ParameterOrderVouchers(); // ParameterOrderVouchers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. +$code = 'code_example'; // string +$ids = array('ids_example'); // string[] + +try { + $result = $apiInstance->listVouchers($limit, $page, $category, $campaignId, $customer, $campaign, $createdAt, $updatedAt, $order, $code, $ids); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->listVouchers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | +| **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] | +| **category** | **string**| Limit search results to vouchers within the specified category. | [optional] | +| **campaignId** | **string**| Limit search results to vouchers within the specified campaign | [optional] | +| **customer** | **string**| A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. | [optional] | +| **campaign** | **string**| A unique campaign name, identifies the parent campaign. | [optional] | +| **createdAt** | [**ParameterCreatedBeforeAfter**](../Model/.md)| A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **updatedAt** | [**ParameterUpdatedBeforeAfter**](../Model/.md)| A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] | +| **order** | [**ParameterOrderVouchers**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | +| **code** | **string**| | [optional] | +| **ids** | [**string[]**](../Model/string.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\VouchersListResponseBody**](../Model/VouchersListResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `releaseValidationSession()` + +```php +releaseValidationSession($code, $sessionKey) +``` + +Release Validation Session + +Manually release a validation session that has been set up for the voucher. This method undos the actions that are explained in our guide on how a validation session was established, you can read more here. 📘 Release Session using Dashboard You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations). + +### Example + +```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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. +$sessionKey = ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts; // string | A unique session identifier. + +try { + $apiInstance->releaseValidationSession($code, $sessionKey); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->releaseValidationSession: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. | | +| **sessionKey** | **string**| A unique session identifier. | | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateVoucher()` + +```php +updateVoucher($code, $vouchersUpdateRequestBody): \OpenAPI\Client\Model\VouchersUpdateResponseBody +``` + +Update Voucher + +Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. + +### 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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A unique **code** that identifies the voucher. +$vouchersUpdateRequestBody = {"category":"Second","type":"DISCOUNT_VOUCHER","discount":{"type":"PERCENT","percent_off":45,"percent_off_formula":"IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)","amount_limit":1800,"effect":"APPLY_TO_ORDER"},"start_date":"2020-02-01T00:00:00Z","expiration_date":"2023-12-31T23:59:59Z","validity_timeframe":{"duration":"PT2H","interval":"P3D"},"validity_day_of_week":[0,1,2],"active":false,"additional_info":"This voucher can be used with other coupons. Please feel free to do so.","metadata":{"Season":"Winter"}}; // \OpenAPI\Client\Model\VouchersUpdateRequestBody | Specify the parameters to be updated. + +try { + $result = $apiInstance->updateVoucher($code, $vouchersUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->updateVoucher: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A unique **code** that identifies the voucher. | | +| **vouchersUpdateRequestBody** | [**\OpenAPI\Client\Model\VouchersUpdateRequestBody**](../Model/VouchersUpdateRequestBody.md)| Specify the parameters to be updated. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersUpdateResponseBody**](../Model/VouchersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateVoucherBalance()` + +```php +updateVoucherBalance($code, $vouchersBalanceUpdateRequestBody): \OpenAPI\Client\Model\VouchersBalanceUpdateResponseBody +``` + +Add or Remove Voucher Balance + +Add balance to an existing gift card or loyalty card. + +### 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\VouchersApi( + // 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 +); +$code = 'code_example'; // string | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. +$vouchersBalanceUpdateRequestBody = {"amount":10000}; // \OpenAPI\Client\Model\VouchersBalanceUpdateRequestBody | Provide the amount to be added to/subtracted from the voucher. + +try { + $result = $apiInstance->updateVoucherBalance($code, $vouchersBalanceUpdateRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->updateVoucherBalance: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **code** | **string**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | | +| **vouchersBalanceUpdateRequestBody** | [**\OpenAPI\Client\Model\VouchersBalanceUpdateRequestBody**](../Model/VouchersBalanceUpdateRequestBody.md)| Provide the amount to be added to/subtracted from the voucher. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersBalanceUpdateResponseBody**](../Model/VouchersBalanceUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateVouchersInBulk()` + +```php +updateVouchersInBulk($vouchersUpdateInBulkItemRequestBody): \OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody +``` + +Update Vouchers in Bulk + +Updates specific metadata parameters for each code, respectively, in one asynchronous operation. The request can include up to **10 MB** of data. Upserts are not supported. 🚧 Currently, only **metadata** updates are supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### 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\VouchersApi( + // 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 +); +$vouchersUpdateInBulkItemRequestBody = [{"code":"example_code","metadata":{"lang":"en","test":false,"MetadataTest":"Update metadata","update_value":1,"next_update_date":"2022-11-11T09:00:00.000Z"}},{"code":"example_code2","metadata":{"lang":"pl","test":false,"MetadataTest":"Update metadata","update_value":2}}]; // \OpenAPI\Client\Model\VouchersUpdateInBulkItemRequestBody[] | List the codes to be updated with the metadata key/value pairs for that code. + +try { + $result = $apiInstance->updateVouchersInBulk($vouchersUpdateInBulkItemRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->updateVouchersInBulk: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **vouchersUpdateInBulkItemRequestBody** | [**\OpenAPI\Client\Model\VouchersUpdateInBulkItemRequestBody[]**](../Model/VouchersUpdateInBulkItemRequestBody.md)| List the codes to be updated with the metadata key/value pairs for that code. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody**](../Model/VouchersUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateVouchersMetadataInBulk()` + +```php +updateVouchersMetadataInBulk($vouchersMetadataUpdateInBulkRequestBody): \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody +``` + +Update Vouchers' Metadata in Bulk + +Updates metadata parameters for a list of codes. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. Upserts are not supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### 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\VouchersApi( + // 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 +); +$vouchersMetadataUpdateInBulkRequestBody = {"codes":["PROMO-CODE810","PROMO-CODE726"],"metadata":{"lang":"en","authorized_internally":true}}; // \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkRequestBody | List the codes of the vouchers you would like to update with the metadata key/value pairs. + +try { + $result = $apiInstance->updateVouchersMetadataInBulk($vouchersMetadataUpdateInBulkRequestBody); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling VouchersApi->updateVouchersMetadataInBulk: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **vouchersMetadataUpdateInBulkRequestBody** | [**\OpenAPI\Client\Model\VouchersMetadataUpdateInBulkRequestBody**](../Model/VouchersMetadataUpdateInBulkRequestBody.md)| List the codes of the vouchers you would like to update with the metadata key/value pairs. | | + +### Return type + +[**\OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody**](../Model/VouchersMetadataUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[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/AccessSettingsCampaignAssignmentsList.md b/docs/Model/AccessSettingsCampaignAssignmentsList.md new file mode 100644 index 0000000..326b414 --- /dev/null +++ b/docs/Model/AccessSettingsCampaignAssignmentsList.md @@ -0,0 +1,12 @@ +# # AccessSettingsCampaignAssignmentsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. Default is `list`. This object stores information about campaign assignments to areas and stores | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of campaign assignments. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\AreaStoreCampaignAssignment[]**](AreaStoreCampaignAssignment.md) | Contains an array of campaign assignments. | [optional] +**total** | **int** | Total number of areas and stores to which the campaign is assigned. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ApplicableTo.md b/docs/Model/ApplicableTo.md new file mode 100644 index 0000000..7c96ca5 --- /dev/null +++ b/docs/Model/ApplicableTo.md @@ -0,0 +1,25 @@ +# # ApplicableTo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | This object stores information about the product collection. | [optional] +**id** | **string** | Unique product collection ID assigned by Voucherify. | [optional] +**sourceId** | **string** | The source ID from your inventory system. | [optional] +**productId** | **string** | Parent product's unique ID assigned by Voucherify. | [optional] +**productSourceId** | **string** | Parent product's source ID from your inventory system. | [optional] +**strict** | **bool** | | [optional] +**price** | **float** | New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price. | [optional] +**priceFormula** | **float** | Formula used to calculate the discounted price of an item. | [optional] +**effect** | **string** | | [optional] +**quantityLimit** | **int** | The maximum number of units allowed to be discounted per order line item. | [optional] +**aggregatedQuantityLimit** | **int** | The maximum number of units allowed to be discounted combined across all matched order line items. | [optional] +**amountLimit** | **int** | Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**aggregatedAmountLimit** | **int** | Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value) | [optional] +**orderItemIndices** | **int[]** | | [optional] +**repeat** | **int** | | [optional] +**skipInitially** | **int** | | [optional] +**target** | **string** | | [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/ApplicableToResultList.md b/docs/Model/ApplicableToResultList.md new file mode 100644 index 0000000..61dbbf5 --- /dev/null +++ b/docs/Model/ApplicableToResultList.md @@ -0,0 +1,12 @@ +# # ApplicableToResultList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Contains array of items to which the discount can apply. | [optional] +**total** | **int** | Total number of objects defining included products, SKUs, or product collections. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'list'] +**dataRef** | **string** | The type of the object represented by JSON. | [optional] [default to 'data'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AreaStoreCampaignAssignment.md b/docs/Model/AreaStoreCampaignAssignment.md new file mode 100644 index 0000000..e092faf --- /dev/null +++ b/docs/Model/AreaStoreCampaignAssignment.md @@ -0,0 +1,13 @@ +# # AreaStoreCampaignAssignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the campaign assignment. | [optional] +**areaId** | **string** | Unique identifier of the area to which the campaign is assigned. | [optional] +**areaStoreId** | **string** | Unique identifier of the store to which the campaign is assigned. | [optional] +**createdAt** | **\DateTime** | Date and time when the assignment was made. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign assignment to areas or stores. | [optional] [default to 'area_store_campaign_assignment'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AsyncActionBase.md b/docs/Model/AsyncActionBase.md new file mode 100644 index 0000000..fbe457b --- /dev/null +++ b/docs/Model/AsyncActionBase.md @@ -0,0 +1,18 @@ +# # AsyncActionBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Async action unique ID. | [optional] +**type** | **string** | Type of async action. | [optional] +**status** | **string** | Status of the async action. Informs you whether the async action has already been completed. | [optional] +**operationStatus** | **string** | Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. | [optional] +**requestId** | **string** | Unique request ID. | [optional] +**processingTime** | **int** | The length of time it took to process the request in milliseconds. | [optional] +**progress** | **int** | % progress to completion of the asynchronous action. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the `async_action`. | [optional] [default to 'async_action'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AsyncActionGetResponseBody.md b/docs/Model/AsyncActionGetResponseBody.md new file mode 100644 index 0000000..502bfbf --- /dev/null +++ b/docs/Model/AsyncActionGetResponseBody.md @@ -0,0 +1,19 @@ +# # AsyncActionGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Async action unique ID. | [optional] +**type** | **string** | Type of async action. | [optional] +**status** | **string** | Status of the async action. Informs you whether the async action has already been completed. | [optional] +**operationStatus** | **string** | Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. | [optional] +**requestId** | **string** | Unique request ID. | [optional] +**processingTime** | **int** | The length of time it took to process the request in milliseconds. | [optional] +**progress** | **int** | % progress to completion of the asynchronous action. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the `async_action`. | [optional] [default to 'async_action'] +**result** | **object** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AsyncActionsListResponseBody.md b/docs/Model/AsyncActionsListResponseBody.md new file mode 100644 index 0000000..045e518 --- /dev/null +++ b/docs/Model/AsyncActionsListResponseBody.md @@ -0,0 +1,11 @@ +# # AsyncActionsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about asynchronous actions. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of asynchronous actions. | [optional] [default to 'async_actions'] +**asyncActions** | [**\OpenAPI\Client\Model\AsyncActionBase[]**](AsyncActionBase.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/BusValRuleAssignment.md b/docs/Model/BusValRuleAssignment.md new file mode 100644 index 0000000..5b62c60 --- /dev/null +++ b/docs/Model/BusValRuleAssignment.md @@ -0,0 +1,17 @@ +# # BusValRuleAssignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier for a assignment | [optional] +**ruleId** | **string** | The unique identifier for a rule | [optional] +**relatedObjectId** | **string** | The unique identifier for a related object | [optional] +**relatedObjectType** | **string** | The type of related object | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the object was last updated in ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'validation_rules_assignment'] +**validationStatus** | **string** | The validation status of the assignment | [optional] +**validationOmittedRules** | **string[]** | The list of omitted rules | [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/CampaignBase.md b/docs/Model/CampaignBase.md new file mode 100644 index 0000000..5234a93 --- /dev/null +++ b/docs/Model/CampaignBase.md @@ -0,0 +1,37 @@ +# # CampaignBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**\OpenAPI\Client\Model\CampaignVoucher**](CampaignVoucher.md) | | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **string** | Unique category name. | [optional] +**creationStatus** | **string** | Indicates the status of the campaign creation. | [optional] +**vouchersGenerationStatus** | **string** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**referralProgram** | [**\OpenAPI\Client\Model\ReferralProgram**](ReferralProgram.md) | | [optional] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.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/CampaignLoyaltyCard.md b/docs/Model/CampaignLoyaltyCard.md new file mode 100644 index 0000000..e3fd68c --- /dev/null +++ b/docs/Model/CampaignLoyaltyCard.md @@ -0,0 +1,10 @@ +# # CampaignLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card. | [optional] +**expirationRules** | [**\OpenAPI\Client\Model\CampaignLoyaltyCardExpirationRules**](CampaignLoyaltyCardExpirationRules.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/CampaignLoyaltyCardExpirationRules.md b/docs/Model/CampaignLoyaltyCardExpirationRules.md new file mode 100644 index 0000000..056d842 --- /dev/null +++ b/docs/Model/CampaignLoyaltyCardExpirationRules.md @@ -0,0 +1,12 @@ +# # CampaignLoyaltyCardExpirationRules + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**periodType** | **string** | Type of period | [optional] [default to 'MONTH'] +**periodValue** | **int** | Value of the period | [optional] +**roundingType** | **string** | Type of rounding | [optional] +**roundingValue** | **int** | Value of rounding | [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/CampaignLoyaltyVoucher.md b/docs/Model/CampaignLoyaltyVoucher.md new file mode 100644 index 0000000..90654d3 --- /dev/null +++ b/docs/Model/CampaignLoyaltyVoucher.md @@ -0,0 +1,12 @@ +# # CampaignLoyaltyVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of voucher. | [optional] [default to 'LOYALTY_CARD'] +**loyaltyCard** | [**\OpenAPI\Client\Model\CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | +**redemption** | [**\OpenAPI\Client\Model\CampaignLoyaltyVoucherRedemption**](CampaignLoyaltyVoucherRedemption.md) | | [optional] +**codeConfig** | [**\OpenAPI\Client\Model\CodeConfig**](CodeConfig.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/CampaignLoyaltyVoucherRedemption.md b/docs/Model/CampaignLoyaltyVoucherRedemption.md new file mode 100644 index 0000000..4011e9f --- /dev/null +++ b/docs/Model/CampaignLoyaltyVoucherRedemption.md @@ -0,0 +1,9 @@ +# # CampaignLoyaltyVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignVoucher.md b/docs/Model/CampaignVoucher.md new file mode 100644 index 0000000..15253ab --- /dev/null +++ b/docs/Model/CampaignVoucher.md @@ -0,0 +1,20 @@ +# # CampaignVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\CampaignVoucherRedemption**](CampaignVoucherRedemption.md) | | [optional] +**codeConfig** | [**\OpenAPI\Client\Model\CodeConfig**](CodeConfig.md) | | +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.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/CampaignVoucherRedemption.md b/docs/Model/CampaignVoucherRedemption.md new file mode 100644 index 0000000..a3a54bc --- /dev/null +++ b/docs/Model/CampaignVoucherRedemption.md @@ -0,0 +1,9 @@ +# # CampaignVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsCreateRequestBody.md b/docs/Model/CampaignsCreateRequestBody.md new file mode 100644 index 0000000..b643afd --- /dev/null +++ b/docs/Model/CampaignsCreateRequestBody.md @@ -0,0 +1,30 @@ +# # CampaignsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign (size of campaign). | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**validationRules** | **string[]** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] +**category** | **string** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | | [optional] +**campaignType** | **string** | | [optional] +**voucher** | [**\OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucher**](CampaignsCreateRequestBodyVoucher.md) | | [optional] +**referralProgram** | [**\OpenAPI\Client\Model\ReferralProgram**](ReferralProgram.md) | | [optional] +**promotion** | [**\OpenAPI\Client\Model\CampaignsCreateRequestBodyPromotion**](CampaignsCreateRequestBodyPromotion.md) | | [optional] +**luckyDraw** | [**\OpenAPI\Client\Model\LuckyDraw**](LuckyDraw.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/CampaignsCreateRequestBodyPromotion.md b/docs/Model/CampaignsCreateRequestBodyPromotion.md new file mode 100644 index 0000000..50ddcc3 --- /dev/null +++ b/docs/Model/CampaignsCreateRequestBodyPromotion.md @@ -0,0 +1,9 @@ +# # CampaignsCreateRequestBodyPromotion + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tiers** | [**\OpenAPI\Client\Model\PromotionTierCreateParams[]**](PromotionTierCreateParams.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/CampaignsCreateRequestBodyVoucher.md b/docs/Model/CampaignsCreateRequestBodyVoucher.md new file mode 100644 index 0000000..7c3dede --- /dev/null +++ b/docs/Model/CampaignsCreateRequestBodyVoucher.md @@ -0,0 +1,15 @@ +# # CampaignsCreateRequestBodyVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**codeConfig** | [**\OpenAPI\Client\Model\CodeConfig**](CodeConfig.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucherRedemption**](CampaignsCreateRequestBodyVoucherRedemption.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\CampaignLoyaltyCard**](CampaignLoyaltyCard.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/CampaignsCreateRequestBodyVoucherRedemption.md b/docs/Model/CampaignsCreateRequestBodyVoucherRedemption.md new file mode 100644 index 0000000..6189694 --- /dev/null +++ b/docs/Model/CampaignsCreateRequestBodyVoucherRedemption.md @@ -0,0 +1,9 @@ +# # CampaignsCreateRequestBodyVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsCreateResponseBody.md b/docs/Model/CampaignsCreateResponseBody.md new file mode 100644 index 0000000..bb6afab --- /dev/null +++ b/docs/Model/CampaignsCreateResponseBody.md @@ -0,0 +1,40 @@ +# # CampaignsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**\OpenAPI\Client\Model\CampaignVoucher**](CampaignVoucher.md) | | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **string** | Unique category name. | [optional] +**creationStatus** | **string** | Indicates the status of the campaign creation. | [optional] +**vouchersGenerationStatus** | **string** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**referralProgram** | [**\OpenAPI\Client\Model\ReferralProgram**](ReferralProgram.md) | | [optional] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**promotion** | [**\OpenAPI\Client\Model\PromotionTiersList**](PromotionTiersList.md) | | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**accessSettingsAssignments** | [**\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.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/CampaignsDeleteResponseBody.md b/docs/Model/CampaignsDeleteResponseBody.md new file mode 100644 index 0000000..0985c19 --- /dev/null +++ b/docs/Model/CampaignsDeleteResponseBody.md @@ -0,0 +1,9 @@ +# # CampaignsDeleteResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/CampaignsGetResponseBody.md b/docs/Model/CampaignsGetResponseBody.md new file mode 100644 index 0000000..7c95f8c --- /dev/null +++ b/docs/Model/CampaignsGetResponseBody.md @@ -0,0 +1,40 @@ +# # CampaignsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**\OpenAPI\Client\Model\CampaignVoucher**](CampaignVoucher.md) | | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **string** | Unique category name. | [optional] +**creationStatus** | **string** | Indicates the status of the campaign creation. | [optional] +**vouchersGenerationStatus** | **string** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**referralProgram** | [**\OpenAPI\Client\Model\ReferralProgram**](ReferralProgram.md) | | [optional] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**promotion** | [**\OpenAPI\Client\Model\PromotionTiersList**](PromotionTiersList.md) | | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**accessSettingsAssignments** | [**\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.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/CampaignsImportCreateResponseBody.md b/docs/Model/CampaignsImportCreateResponseBody.md new file mode 100644 index 0000000..3813c18 --- /dev/null +++ b/docs/Model/CampaignsImportCreateResponseBody.md @@ -0,0 +1,9 @@ +# # CampaignsImportCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/CampaignsImportCsvCreateResponseBody.md b/docs/Model/CampaignsImportCsvCreateResponseBody.md new file mode 100644 index 0000000..5d0a7d1 --- /dev/null +++ b/docs/Model/CampaignsImportCsvCreateResponseBody.md @@ -0,0 +1,9 @@ +# # CampaignsImportCsvCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/CampaignsImportVoucherItem.md b/docs/Model/CampaignsImportVoucherItem.md new file mode 100644 index 0000000..0498c41 --- /dev/null +++ b/docs/Model/CampaignsImportVoucherItem.md @@ -0,0 +1,22 @@ +# # CampaignsImportVoucherItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Value representing the imported code. | [optional] +**redemption** | [**\OpenAPI\Client\Model\CampaignsImportVoucherItemRedemption**](CampaignsImportVoucherItemRedemption.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**metadata** | **object** | | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**startDate** | **\DateTime** | Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] +**expirationDate** | **\DateTime** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**type** | **string** | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/CampaignsImportVoucherItemRedemption.md b/docs/Model/CampaignsImportVoucherItemRedemption.md new file mode 100644 index 0000000..e8ed50c --- /dev/null +++ b/docs/Model/CampaignsImportVoucherItemRedemption.md @@ -0,0 +1,9 @@ +# # CampaignsImportVoucherItemRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsListResponseBody.md b/docs/Model/CampaignsListResponseBody.md new file mode 100644 index 0000000..9f470e7 --- /dev/null +++ b/docs/Model/CampaignsListResponseBody.md @@ -0,0 +1,12 @@ +# # CampaignsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about campaigns in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of campaign objects. | [optional] [default to 'campaigns'] +**campaigns** | [**\OpenAPI\Client\Model\CampaignBase[]**](CampaignBase.md) | Contains array of campaign objects. | [optional] +**total** | **int** | Total number of campaigns. | [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/CampaignsUpdateRequestBody.md b/docs/Model/CampaignsUpdateRequestBody.md new file mode 100644 index 0000000..07e5d21 --- /dev/null +++ b/docs/Model/CampaignsUpdateRequestBody.md @@ -0,0 +1,30 @@ +# # CampaignsUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**category** | **string** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | | [optional] +**unsetMetadataFields** | **string[]** | Determine which metadata should be removed from campaign. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] +**discount** | **object** | | [optional] +**referralProgram** | [**\OpenAPI\Client\Model\ReferralProgram**](ReferralProgram.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**options** | [**\OpenAPI\Client\Model\CampaignsUpdateRequestBodyOptions**](CampaignsUpdateRequestBodyOptions.md) | | [optional] +**winnersCount** | **string** | It represents the total number of winners in a lucky draw. | [optional] +**uniqueWinnersPerDraw** | **string** | It indicates whether each winner in a draw is unique or not. | [optional] +**uniqueWinners** | **string** | Specifies whether each participant can win only once across multiple draws. | [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/CampaignsUpdateRequestBodyOptions.md b/docs/Model/CampaignsUpdateRequestBodyOptions.md new file mode 100644 index 0000000..a178e7b --- /dev/null +++ b/docs/Model/CampaignsUpdateRequestBodyOptions.md @@ -0,0 +1,9 @@ +# # CampaignsUpdateRequestBodyOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**recalculateTiers** | **bool** | Determine if tiers should be recalculated or no. | [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/CampaignsUpdateResponseBody.md b/docs/Model/CampaignsUpdateResponseBody.md new file mode 100644 index 0000000..ada6214 --- /dev/null +++ b/docs/Model/CampaignsUpdateResponseBody.md @@ -0,0 +1,40 @@ +# # CampaignsUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**\OpenAPI\Client\Model\CampaignVoucher**](CampaignVoucher.md) | | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **string** | Unique category name. | [optional] +**creationStatus** | **string** | Indicates the status of the campaign creation. | [optional] +**vouchersGenerationStatus** | **string** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**referralProgram** | [**\OpenAPI\Client\Model\ReferralProgram**](ReferralProgram.md) | | [optional] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**promotion** | [**\OpenAPI\Client\Model\PromotionTiersList**](PromotionTiersList.md) | | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**accessSettingsAssignments** | [**\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.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/CampaignsVouchersCreateCombinedResponseBody.md b/docs/Model/CampaignsVouchersCreateCombinedResponseBody.md new file mode 100644 index 0000000..9392ee7 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateCombinedResponseBody.md @@ -0,0 +1,38 @@ +# # CampaignsVouchersCreateCombinedResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyGift**](CampaignsVouchersCreateCombinedResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard**](CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyPublish**](CampaignsVouchersCreateCombinedResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyRedemption**](CampaignsVouchersCreateCombinedResponseBodyRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/CampaignsVouchersCreateCombinedResponseBodyGift.md b/docs/Model/CampaignsVouchersCreateCombinedResponseBodyGift.md new file mode 100644 index 0000000..52761bc --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateCombinedResponseBodyGift.md @@ -0,0 +1,11 @@ +# # CampaignsVouchersCreateCombinedResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md b/docs/Model/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..419d758 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/CampaignsVouchersCreateCombinedResponseBodyPublish.md b/docs/Model/CampaignsVouchersCreateCombinedResponseBodyPublish.md new file mode 100644 index 0000000..eaa2b3e --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateCombinedResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # CampaignsVouchersCreateCombinedResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsVouchersCreateCombinedResponseBodyRedemption.md b/docs/Model/CampaignsVouchersCreateCombinedResponseBodyRedemption.md new file mode 100644 index 0000000..e4dfbef --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateCombinedResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # CampaignsVouchersCreateCombinedResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsVouchersCreateInBulkRequestBody.md b/docs/Model/CampaignsVouchersCreateInBulkRequestBody.md new file mode 100644 index 0000000..a3cd289 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateInBulkRequestBody.md @@ -0,0 +1,16 @@ +# # CampaignsVouchersCreateInBulkRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Unique voucher code. | [optional] +**codeConfig** | [**\OpenAPI\Client\Model\CodeConfig**](CodeConfig.md) | | [optional] +**category** | **string** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**redemption** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBodyRedemption**](CampaignsVouchersCreateInBulkRequestBodyRedemption.md) | | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsVouchersCreateInBulkRequestBodyRedemption.md b/docs/Model/CampaignsVouchersCreateInBulkRequestBodyRedemption.md new file mode 100644 index 0000000..b0c29a3 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateInBulkRequestBodyRedemption.md @@ -0,0 +1,9 @@ +# # CampaignsVouchersCreateInBulkRequestBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsVouchersCreateRequestBody.md b/docs/Model/CampaignsVouchersCreateRequestBody.md new file mode 100644 index 0000000..b8da9ee --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateRequestBody.md @@ -0,0 +1,14 @@ +# # CampaignsVouchersCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **string** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**redemption** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateRequestBodyRedemption**](CampaignsVouchersCreateRequestBodyRedemption.md) | | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsVouchersCreateRequestBodyRedemption.md b/docs/Model/CampaignsVouchersCreateRequestBodyRedemption.md new file mode 100644 index 0000000..b6c03b8 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateRequestBodyRedemption.md @@ -0,0 +1,9 @@ +# # CampaignsVouchersCreateRequestBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsVouchersCreateResponseBody.md b/docs/Model/CampaignsVouchersCreateResponseBody.md new file mode 100644 index 0000000..dce7c28 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateResponseBody.md @@ -0,0 +1,37 @@ +# # CampaignsVouchersCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyGift**](CampaignsVouchersCreateResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyLoyaltyCard**](CampaignsVouchersCreateResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyPublish**](CampaignsVouchersCreateResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyRedemption**](CampaignsVouchersCreateResponseBodyRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.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/CampaignsVouchersCreateResponseBodyGift.md b/docs/Model/CampaignsVouchersCreateResponseBodyGift.md new file mode 100644 index 0000000..b6da893 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateResponseBodyGift.md @@ -0,0 +1,11 @@ +# # CampaignsVouchersCreateResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/CampaignsVouchersCreateResponseBodyLoyaltyCard.md b/docs/Model/CampaignsVouchersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..80e8e65 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # CampaignsVouchersCreateResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/CampaignsVouchersCreateResponseBodyPublish.md b/docs/Model/CampaignsVouchersCreateResponseBodyPublish.md new file mode 100644 index 0000000..8254b54 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # CampaignsVouchersCreateResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CampaignsVouchersCreateResponseBodyRedemption.md b/docs/Model/CampaignsVouchersCreateResponseBodyRedemption.md new file mode 100644 index 0000000..a013436 --- /dev/null +++ b/docs/Model/CampaignsVouchersCreateResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # CampaignsVouchersCreateResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CategoriesCreateRequestBody.md b/docs/Model/CategoriesCreateRequestBody.md new file mode 100644 index 0000000..12e91f1 --- /dev/null +++ b/docs/Model/CategoriesCreateRequestBody.md @@ -0,0 +1,10 @@ +# # CategoriesCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [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/CategoriesCreateResponseBody.md b/docs/Model/CategoriesCreateResponseBody.md new file mode 100644 index 0000000..f948a43 --- /dev/null +++ b/docs/Model/CategoriesCreateResponseBody.md @@ -0,0 +1,13 @@ +# # CategoriesCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique category ID assigned by Voucherify. | [optional] +**name** | **string** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] +**object** | **string** | | [optional] [default to 'category'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CategoriesGetResponseBody.md b/docs/Model/CategoriesGetResponseBody.md new file mode 100644 index 0000000..c910368 --- /dev/null +++ b/docs/Model/CategoriesGetResponseBody.md @@ -0,0 +1,15 @@ +# # CategoriesGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique category ID assigned by Voucherify. | [optional] +**name** | **string** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the category. | [optional] [default to 'category'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] +**stackingRulesType** | **string** | The type of the stacking rule eligibility. | [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/CategoriesListResponseBody.md b/docs/Model/CategoriesListResponseBody.md new file mode 100644 index 0000000..0ba4729 --- /dev/null +++ b/docs/Model/CategoriesListResponseBody.md @@ -0,0 +1,12 @@ +# # CategoriesListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about categories in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of category objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | | [optional] +**total** | **int** | Total number of categories. | [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/CategoriesUpdateRequestBody.md b/docs/Model/CategoriesUpdateRequestBody.md new file mode 100644 index 0000000..e8184df --- /dev/null +++ b/docs/Model/CategoriesUpdateRequestBody.md @@ -0,0 +1,10 @@ +# # CategoriesUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [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/CategoriesUpdateResponseBody.md b/docs/Model/CategoriesUpdateResponseBody.md new file mode 100644 index 0000000..a8b6d29 --- /dev/null +++ b/docs/Model/CategoriesUpdateResponseBody.md @@ -0,0 +1,14 @@ +# # CategoriesUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique category ID assigned by Voucherify. | [optional] +**name** | **string** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] +**object** | **string** | | [optional] [default to 'category'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Category.md b/docs/Model/Category.md new file mode 100644 index 0000000..44f07cd --- /dev/null +++ b/docs/Model/Category.md @@ -0,0 +1,15 @@ +# # Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique category ID assigned by Voucherify. | [optional] +**name** | **string** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the category. | [optional] [default to 'category'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] +**stackingRulesType** | **string** | The type of the stacking rule eligibility. | [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/ClientEventsCreateRequestBody.md b/docs/Model/ClientEventsCreateRequestBody.md new file mode 100644 index 0000000..ad0abe3 --- /dev/null +++ b/docs/Model/ClientEventsCreateRequestBody.md @@ -0,0 +1,13 @@ +# # ClientEventsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event** | **string** | Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | +**referral** | [**\OpenAPI\Client\Model\ClientEventsCreateRequestBodyReferral**](ClientEventsCreateRequestBodyReferral.md) | | [optional] +**loyalty** | [**\OpenAPI\Client\Model\ClientEventsCreateRequestBodyLoyalty**](ClientEventsCreateRequestBodyLoyalty.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientEventsCreateRequestBodyLoyalty.md b/docs/Model/ClientEventsCreateRequestBodyLoyalty.md new file mode 100644 index 0000000..c100b5e --- /dev/null +++ b/docs/Model/ClientEventsCreateRequestBodyLoyalty.md @@ -0,0 +1,9 @@ +# # ClientEventsCreateRequestBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientEventsCreateRequestBodyReferral.md b/docs/Model/ClientEventsCreateRequestBodyReferral.md new file mode 100644 index 0000000..2938428 --- /dev/null +++ b/docs/Model/ClientEventsCreateRequestBodyReferral.md @@ -0,0 +1,10 @@ +# # ClientEventsCreateRequestBodyReferral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | A code through which a new visitor has been referred to a service. | [optional] +**referrerId** | **string** | Unique ID of the referring person - it is optional and not required if the referral **code** is provided. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientEventsCreateResponseBody.md b/docs/Model/ClientEventsCreateResponseBody.md new file mode 100644 index 0000000..83aea15 --- /dev/null +++ b/docs/Model/ClientEventsCreateResponseBody.md @@ -0,0 +1,14 @@ +# # ClientEventsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The object represented is an `event`. | [optional] [default to 'event'] +**type** | **string** | The event name. | [optional] +**customer** | [**\OpenAPI\Client\Model\SimpleCustomerRequiredObjectType**](SimpleCustomerRequiredObjectType.md) | | +**referral** | **object** | A `null` referral object. | [optional] +**loyalty** | **object** | A `null` loyalty object. | [optional] +**metadata** | **object** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientPromotionsTiersListResponseBody.md b/docs/Model/ClientPromotionsTiersListResponseBody.md new file mode 100644 index 0000000..605afc9 --- /dev/null +++ b/docs/Model/ClientPromotionsTiersListResponseBody.md @@ -0,0 +1,13 @@ +# # ClientPromotionsTiersListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional] [default to 'tiers'] +**tiers** | [**\OpenAPI\Client\Model\PromotionTier[]**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] +**total** | **int** | Total number of promotion tiers. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [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/ClientQualificationsCheckEligibilityRequestBody.md b/docs/Model/ClientQualificationsCheckEligibilityRequestBody.md new file mode 100644 index 0000000..f205d50 --- /dev/null +++ b/docs/Model/ClientQualificationsCheckEligibilityRequestBody.md @@ -0,0 +1,14 @@ +# # ClientQualificationsCheckEligibilityRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**trackingId** | **string** | Is correspondent to Customer's source_id | [optional] +**scenario** | **string** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] +**options** | [**\OpenAPI\Client\Model\QualificationsOption**](QualificationsOption.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientQualificationsCheckEligibilityResponseBody.md b/docs/Model/ClientQualificationsCheckEligibilityResponseBody.md new file mode 100644 index 0000000..e98b938 --- /dev/null +++ b/docs/Model/ClientQualificationsCheckEligibilityResponseBody.md @@ -0,0 +1,12 @@ +# # ClientQualificationsCheckEligibilityResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemables** | [**\OpenAPI\Client\Model\QualificationsRedeemables**](QualificationsRedeemables.md) | | [optional] +**trackingId** | **string** | This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**stackingRules** | [**\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/ClientQualificationsCheckEligibilityResponseBodyOrder.md b/docs/Model/ClientQualificationsCheckEligibilityResponseBodyOrder.md new file mode 100644 index 0000000..6712dab --- /dev/null +++ b/docs/Model/ClientQualificationsCheckEligibilityResponseBodyOrder.md @@ -0,0 +1,20 @@ +# # ClientQualificationsCheckEligibilityResponseBodyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItem[]**](OrderItem.md) | Array of items applied to the order. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**customer_id** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrer** | [**\OpenAPI\Client\Model\Referrer**](Referrer.md) | | [optional] +**referrer_id** | **string** | Unique referrer ID. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**created_at** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [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/ClientRedemptionsRedeemRequestBody.md b/docs/Model/ClientRedemptionsRedeemRequestBody.md new file mode 100644 index 0000000..eda8d13 --- /dev/null +++ b/docs/Model/ClientRedemptionsRedeemRequestBody.md @@ -0,0 +1,15 @@ +# # ClientRedemptionsRedeemRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**options** | [**\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyOptions**](ClientRedemptionsRedeemRequestBodyOptions.md) | | [optional] +**redeemables** | [**\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItem[]**](ClientRedemptionsRedeemRequestBodyRedeemablesItem.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**session** | [**\OpenAPI\Client\Model\Session**](Session.md) | | [optional] +**trackingId** | **string** | Is correspondent to Customer's source_id | [optional] +**metadata** | **object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientRedemptionsRedeemRequestBodyOptions.md b/docs/Model/ClientRedemptionsRedeemRequestBodyOptions.md new file mode 100644 index 0000000..d783df0 --- /dev/null +++ b/docs/Model/ClientRedemptionsRedeemRequestBodyOptions.md @@ -0,0 +1,9 @@ +# # ClientRedemptionsRedeemRequestBodyOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expand** | **string[]** | Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.<br>- Returns redemption object `metadata`.<br>- Returns an expanded `categories` object, showing details about the category. | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md b/docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md new file mode 100644 index 0000000..cd89bdf --- /dev/null +++ b/docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md @@ -0,0 +1,12 @@ +# # ClientRedemptionsRedeemRequestBodyRedeemablesItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | | [optional] +**id** | **string** | | [optional] +**gift** | [**\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItemGift**](ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItemReward**](ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.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/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md b/docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md new file mode 100644 index 0000000..ef7ac8f --- /dev/null +++ b/docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md @@ -0,0 +1,9 @@ +# # ClientRedemptionsRedeemRequestBodyRedeemablesItemGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md b/docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md new file mode 100644 index 0000000..fef7529 --- /dev/null +++ b/docs/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md @@ -0,0 +1,10 @@ +# # ClientRedemptionsRedeemRequestBodyRedeemablesItemReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientRedemptionsRedeemResponseBody.md b/docs/Model/ClientRedemptionsRedeemResponseBody.md new file mode 100644 index 0000000..8a4ad33 --- /dev/null +++ b/docs/Model/ClientRedemptionsRedeemResponseBody.md @@ -0,0 +1,13 @@ +# # ClientRedemptionsRedeemResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\Redemption[]**](Redemption.md) | | [optional] +**parentRedemption** | [**\OpenAPI\Client\Model\Redemption**](Redemption.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**inapplicableRedeemables** | [**\OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] +**skippedRedeemables** | [**\OpenAPI\Client\Model\ValidationsRedeemableSkipped[]**](ValidationsRedeemableSkipped.md) | Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientValidationsValidateRequestBody.md b/docs/Model/ClientValidationsValidateRequestBody.md new file mode 100644 index 0000000..32c23a4 --- /dev/null +++ b/docs/Model/ClientValidationsValidateRequestBody.md @@ -0,0 +1,15 @@ +# # ClientValidationsValidateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**options** | [**\OpenAPI\Client\Model\ClientValidationsValidateRequestBodyOptions**](ClientValidationsValidateRequestBodyOptions.md) | | [optional] +**redeemables** | [**\OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItem[]**](ClientValidationsValidateRequestBodyRedeemablesItem.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**session** | [**\OpenAPI\Client\Model\Session**](Session.md) | | [optional] +**trackingId** | **string** | Is correspondent to Customer's source_id | [optional] +**metadata** | **object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientValidationsValidateRequestBodyOptions.md b/docs/Model/ClientValidationsValidateRequestBodyOptions.md new file mode 100644 index 0000000..199669a --- /dev/null +++ b/docs/Model/ClientValidationsValidateRequestBodyOptions.md @@ -0,0 +1,9 @@ +# # ClientValidationsValidateRequestBodyOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expand** | **string[]** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientValidationsValidateRequestBodyRedeemablesItem.md b/docs/Model/ClientValidationsValidateRequestBodyRedeemablesItem.md new file mode 100644 index 0000000..3f34ba5 --- /dev/null +++ b/docs/Model/ClientValidationsValidateRequestBodyRedeemablesItem.md @@ -0,0 +1,12 @@ +# # ClientValidationsValidateRequestBodyRedeemablesItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | | [optional] +**id** | **string** | | [optional] +**gift** | [**\OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItemGift**](ClientValidationsValidateRequestBodyRedeemablesItemGift.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItemReward**](ClientValidationsValidateRequestBodyRedeemablesItemReward.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/ClientValidationsValidateRequestBodyRedeemablesItemGift.md b/docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemGift.md new file mode 100644 index 0000000..a770f97 --- /dev/null +++ b/docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemGift.md @@ -0,0 +1,9 @@ +# # ClientValidationsValidateRequestBodyRedeemablesItemGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemReward.md b/docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemReward.md new file mode 100644 index 0000000..1adeb9f --- /dev/null +++ b/docs/Model/ClientValidationsValidateRequestBodyRedeemablesItemReward.md @@ -0,0 +1,10 @@ +# # ClientValidationsValidateRequestBodyRedeemablesItemReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientValidationsValidateResponseBody.md b/docs/Model/ClientValidationsValidateResponseBody.md new file mode 100644 index 0000000..9a2cedf --- /dev/null +++ b/docs/Model/ClientValidationsValidateResponseBody.md @@ -0,0 +1,16 @@ +# # ClientValidationsValidateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**valid** | **bool** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | [optional] +**redeemables** | [**\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItem[]**](ClientValidationsValidateResponseBodyRedeemablesItem.md) | | [optional] +**skippedRedeemables** | [**\OpenAPI\Client\Model\ValidationsRedeemableSkipped[]**](ValidationsRedeemableSkipped.md) | Lists validation results of each skipped redeemable. | [optional] +**inapplicableRedeemables** | [**\OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**session** | [**\OpenAPI\Client\Model\Session**](Session.md) | | [optional] +**stackingRules** | [**\OpenAPI\Client\Model\StackingRules**](StackingRules.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItem.md b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItem.md new file mode 100644 index 0000000..c7e81c3 --- /dev/null +++ b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItem.md @@ -0,0 +1,17 @@ +# # ClientValidationsValidateResponseBodyRedeemablesItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | | [optional] +**id** | **string** | Redeemable ID, i.e. the voucher code. | [optional] +**object** | **string** | Redeemable's object type. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ApplicableToResultList**](ApplicableToResultList.md) | | [optional] +**inapplicableTo** | [**\OpenAPI\Client\Model\InapplicableToResultList**](InapplicableToResultList.md) | | [optional] +**result** | [**\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResult**](ClientValidationsValidateResponseBodyRedeemablesItemResult.md) | | [optional] +**metadata** | **object** | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/ClientValidationsValidateResponseBodyRedeemablesItemResult.md b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResult.md new file mode 100644 index 0000000..9af8011 --- /dev/null +++ b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResult.md @@ -0,0 +1,13 @@ +# # ClientValidationsValidateResponseBodyRedeemablesItemResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount**](ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultGift**](ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard**](ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) | | [optional] +**error** | [**\OpenAPI\Client\Model\Error**](Error.md) | | [optional] +**details** | [**\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDetails**](ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.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/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md new file mode 100644 index 0000000..0f63a75 --- /dev/null +++ b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md @@ -0,0 +1,10 @@ +# # ClientValidationsValidateResponseBodyRedeemablesItemResultDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **string** | | [optional] +**message** | **string** | | [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/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md new file mode 100644 index 0000000..847a7dc --- /dev/null +++ b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md @@ -0,0 +1,25 @@ +# # ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**amountOff** | **float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] +**amountOffFormula** | **string** | | [optional] +**aggregatedAmountLimit** | **int** | Maximum discount amount per order. | [optional] +**effect** | **string** | | [optional] +**isDynamic** | **bool** | Flag indicating whether the discount was calculated using a formula. | [optional] +**unitOff** | **int** | Number of units to be granted a full value discount. | [optional] +**unitOffFormula** | **string** | | [optional] +**unitType** | **string** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] +**product** | [**\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct**](ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) | | [optional] +**sku** | [**\OpenAPI\Client\Model\SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] +**units** | [**\OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]**](DiscountUnitMultipleOneUnit.md) | | [optional] +**percentOff** | **float** | The percent discount that the customer will receive. | [optional] +**percentOffFormula** | **string** | | [optional] +**amountLimit** | **float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**fixedAmount** | **float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] +**fixedAmountFormula** | **string** | | [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/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md new file mode 100644 index 0000000..24cbc0c --- /dev/null +++ b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md @@ -0,0 +1,11 @@ +# # ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID, assigned by Voucherify. | [optional] +**sourceId** | **string** | Product's source ID. | [optional] +**name** | **string** | Product name. | [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/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md new file mode 100644 index 0000000..c4ee786 --- /dev/null +++ b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md @@ -0,0 +1,9 @@ +# # ClientValidationsValidateResponseBodyRedeemablesItemResultGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md new file mode 100644 index 0000000..4d426df --- /dev/null +++ b/docs/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md @@ -0,0 +1,9 @@ +# # ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total number of loyalty points to be applied in the redemption. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CodeConfig.md b/docs/Model/CodeConfig.md new file mode 100644 index 0000000..ca8c0aa --- /dev/null +++ b/docs/Model/CodeConfig.md @@ -0,0 +1,14 @@ +# # CodeConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **float** | Number of characters in a generated code (excluding prefix and postfix). | [optional] +**charset** | **string** | Characters that can appear in the code. Examples: - Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` - Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` - Numbers: `0123456789` - Custom: a custom character set | [optional] +**prefix** | **string** | A text appended before the code. | [optional] +**postfix** | **string** | A text appended after the code. | [optional] +**pattern** | **string** | A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`. | [optional] +**initialCount** | **int** | Internal value, does not change anything if provided. | [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/CreatePublicationCampaign.md b/docs/Model/CreatePublicationCampaign.md new file mode 100644 index 0000000..98c7986 --- /dev/null +++ b/docs/Model/CreatePublicationCampaign.md @@ -0,0 +1,10 @@ +# # CreatePublicationCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify. | [optional] +**count** | **int** | Number of vouchers to be published to customer. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Customer.md b/docs/Model/Customer.md new file mode 100644 index 0000000..9f74e61 --- /dev/null +++ b/docs/Model/Customer.md @@ -0,0 +1,18 @@ +# # Customer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**sourceId** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\CustomerAddress**](CustomerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerActivity.md b/docs/Model/CustomerActivity.md new file mode 100644 index 0000000..356224f --- /dev/null +++ b/docs/Model/CustomerActivity.md @@ -0,0 +1,13 @@ +# # CustomerActivity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique event ID, assigned by Voucherify. | [optional] +**type** | **string** | Event type. | [optional] +**data** | **object** | Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the customer activity occurred in ISO 8601 format. | [optional] +**groupId** | **string** | Unique identifier of the request that caused the event. | [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/CustomerAddress.md b/docs/Model/CustomerAddress.md new file mode 100644 index 0000000..cf2d20c --- /dev/null +++ b/docs/Model/CustomerAddress.md @@ -0,0 +1,14 @@ +# # CustomerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/CustomerId.md b/docs/Model/CustomerId.md new file mode 100644 index 0000000..1885aac --- /dev/null +++ b/docs/Model/CustomerId.md @@ -0,0 +1,10 @@ +# # CustomerId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of an existing customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerLoyalty.md b/docs/Model/CustomerLoyalty.md new file mode 100644 index 0000000..f361913 --- /dev/null +++ b/docs/Model/CustomerLoyalty.md @@ -0,0 +1,11 @@ +# # CustomerLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Customer's loyalty points. | [optional] +**referredCustomers** | **int** | Total number of customers referred by the customer. | [optional] +**campaigns** | [**array**](CustomerLoyaltyCampaignsEntry.md) | Contains campaigns with details about point balances and how many customers were referred by the customer. | [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/CustomerLoyaltyCampaignsEntry.md b/docs/Model/CustomerLoyaltyCampaignsEntry.md new file mode 100644 index 0000000..dfdd319 --- /dev/null +++ b/docs/Model/CustomerLoyaltyCampaignsEntry.md @@ -0,0 +1,11 @@ +# # CustomerLoyaltyCampaignsEntry + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Remaining point balance in campaign. | [optional] +**loyaltyTier** | **string** | Customer's loyalty tier within the campaign. | [optional] +**referredCustomers** | **int** | Number of customers referred by the customer in campaign. | [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/CustomerRedeemable.md b/docs/Model/CustomerRedeemable.md new file mode 100644 index 0000000..4010c48 --- /dev/null +++ b/docs/Model/CustomerRedeemable.md @@ -0,0 +1,18 @@ +# # CustomerRedeemable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redeemable holder identifier. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the redeemable was assigned. The value is shown in the ISO 8601 format. | [optional] +**redeemableId** | **string** | Identifier of the redeemable item. | [optional] +**redeemableObject** | **string** | Type of the redeemable. | [optional] +**customerId** | **string** | Identifier of the customer. | [optional] +**holderRole** | **string** | Role of the holder. | [optional] [default to 'OWNER'] +**campaignId** | **string** | Unique campaign identifier, assigned by Voucherify. | [optional] +**campaignType** | **string** | Defines the type of the campaign. | [optional] [default to 'DISCOUNT_COUPONS'] +**voucherType** | **string** | Defines the type of the voucher. | [optional] [default to 'DISCOUNT_VOUCHER'] +**redeemable** | [**\OpenAPI\Client\Model\CustomerRedeemableRedeemable**](CustomerRedeemableRedeemable.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/CustomerRedeemableRedeemable.md b/docs/Model/CustomerRedeemableRedeemable.md new file mode 100644 index 0000000..725463f --- /dev/null +++ b/docs/Model/CustomerRedeemableRedeemable.md @@ -0,0 +1,11 @@ +# # CustomerRedeemableRedeemable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of the redeemable. | [optional] +**voucher** | [**\OpenAPI\Client\Model\RedeemableVoucher**](RedeemableVoucher.md) | | +**status** | **string** | Status of the redeemable. | [optional] [default to 'ACTIVE'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerReferrals.md b/docs/Model/CustomerReferrals.md new file mode 100644 index 0000000..9204b3f --- /dev/null +++ b/docs/Model/CustomerReferrals.md @@ -0,0 +1,10 @@ +# # CustomerReferrals + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **int** | Total number of times this customer received a referral, i.e. was referred by another customer. | [optional] +**campaigns** | [**\OpenAPI\Client\Model\CustomerReferralsCampaignsItem[]**](CustomerReferralsCampaignsItem.md) | Contains an array of campaigns that served as the source of a referral for the customer. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerReferralsCampaignsItem.md b/docs/Model/CustomerReferralsCampaignsItem.md new file mode 100644 index 0000000..04f7e67 --- /dev/null +++ b/docs/Model/CustomerReferralsCampaignsItem.md @@ -0,0 +1,13 @@ +# # CustomerReferralsCampaignsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaignId** | **string** | Unique campaign ID, assigned by Voucherify. | +**referrerId** | **string** | Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer. | +**relatedObjectId** | **string** | Related object id | +**relatedObjectType** | **string** | Related object type, i.e. `redemption`. | +**date** | **\DateTime** | Timestamp representing the date and time when the customer was referred in ISO 8601 format. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerSummary.md b/docs/Model/CustomerSummary.md new file mode 100644 index 0000000..6d876d9 --- /dev/null +++ b/docs/Model/CustomerSummary.md @@ -0,0 +1,10 @@ +# # CustomerSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\CustomerSummaryRedemptions**](CustomerSummaryRedemptions.md) | | +**orders** | [**\OpenAPI\Client\Model\CustomerSummaryOrders**](CustomerSummaryOrders.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerSummaryOrders.md b/docs/Model/CustomerSummaryOrders.md new file mode 100644 index 0000000..2a2e43a --- /dev/null +++ b/docs/Model/CustomerSummaryOrders.md @@ -0,0 +1,13 @@ +# # CustomerSummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**totalCount** | **int** | Total number of orders made by the customer. | [optional] +**averageAmount** | **int** | Average amount spent on orders. `total_amount` &divide; `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**lastOrderAmount** | **int** | Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**lastOrderDate** | **\DateTime** | Timestamp representing the date and time of the customer's last order in ISO 8601 format. | [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/CustomerSummaryRedemptions.md b/docs/Model/CustomerSummaryRedemptions.md new file mode 100644 index 0000000..58bb241 --- /dev/null +++ b/docs/Model/CustomerSummaryRedemptions.md @@ -0,0 +1,16 @@ +# # CustomerSummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Total number of redemptions made by the customer. | [optional] +**totalFailed** | **int** | Total number of redemptions that failed. | [optional] +**totalSucceeded** | **int** | Total number of redemptions that succeeded. | [optional] +**totalRolledBack** | **int** | Total number of redemptions that were rolled back for the customer. | [optional] +**totalRollbackFailed** | **int** | Total number of redemption rollbacks that failed. | [optional] +**totalRollbackSucceeded** | **int** | Total number of redemption rollbacks that succeeded. | [optional] +**gift** | [**\OpenAPI\Client\Model\CustomerSummaryRedemptionsGift**](CustomerSummaryRedemptionsGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\CustomerSummaryRedemptionsLoyaltyCard**](CustomerSummaryRedemptionsLoyaltyCard.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/CustomerSummaryRedemptionsGift.md b/docs/Model/CustomerSummaryRedemptionsGift.md new file mode 100644 index 0000000..7fa1558 --- /dev/null +++ b/docs/Model/CustomerSummaryRedemptionsGift.md @@ -0,0 +1,10 @@ +# # CustomerSummaryRedemptionsGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemedAmount** | **int** | Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] [default to 0] +**amountToGo** | **int** | Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] [default to 0] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerSummaryRedemptionsLoyaltyCard.md b/docs/Model/CustomerSummaryRedemptionsLoyaltyCard.md new file mode 100644 index 0000000..c89f548 --- /dev/null +++ b/docs/Model/CustomerSummaryRedemptionsLoyaltyCard.md @@ -0,0 +1,10 @@ +# # CustomerSummaryRedemptionsLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemedPoints** | **int** | Total number of loyalty points redeemed by the customer. | [optional] +**pointsToGo** | **int** | Sum of remaining available point balance across all loyalty cards. | [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/CustomerWithSummaryLoyaltyReferrals.md b/docs/Model/CustomerWithSummaryLoyaltyReferrals.md new file mode 100644 index 0000000..060dff9 --- /dev/null +++ b/docs/Model/CustomerWithSummaryLoyaltyReferrals.md @@ -0,0 +1,26 @@ +# # CustomerWithSummaryLoyaltyReferrals + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer that will be linked to redemption in this request. | [optional] +**sourceId** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**summary** | [**\OpenAPI\Client\Model\CustomerSummary**](CustomerSummary.md) | | [optional] +**loyalty** | [**\OpenAPI\Client\Model\CustomerLoyalty**](CustomerLoyalty.md) | | [optional] +**referrals** | [**\OpenAPI\Client\Model\CustomerReferrals**](CustomerReferrals.md) | | [optional] +**systemMetadata** | **object** | Object used to store system metadata information. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] +**assets** | [**\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferralsAssets**](CustomerWithSummaryLoyaltyReferralsAssets.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferralsAddress**](CustomerWithSummaryLoyaltyReferralsAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomerWithSummaryLoyaltyReferralsAddress.md b/docs/Model/CustomerWithSummaryLoyaltyReferralsAddress.md new file mode 100644 index 0000000..63dfb0a --- /dev/null +++ b/docs/Model/CustomerWithSummaryLoyaltyReferralsAddress.md @@ -0,0 +1,14 @@ +# # CustomerWithSummaryLoyaltyReferralsAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/CustomerWithSummaryLoyaltyReferralsAssets.md b/docs/Model/CustomerWithSummaryLoyaltyReferralsAssets.md new file mode 100644 index 0000000..97cfaf2 --- /dev/null +++ b/docs/Model/CustomerWithSummaryLoyaltyReferralsAssets.md @@ -0,0 +1,9 @@ +# # CustomerWithSummaryLoyaltyReferralsAssets + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cockpitUrl** | **string** | Customer's cockpit URL address. | [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/CustomersActivitiesListResponseBody.md b/docs/Model/CustomersActivitiesListResponseBody.md new file mode 100644 index 0000000..a405afa --- /dev/null +++ b/docs/Model/CustomersActivitiesListResponseBody.md @@ -0,0 +1,12 @@ +# # CustomersActivitiesListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about customer activities in a dictionary. | [optional] [default to 'list'] +**data_ref** | **string** | Identifies the name of the attribute that contains the array of customer activity objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\CustomerActivity[]**](CustomerActivity.md) | Array of customer activity objects. | [optional] +**total** | **int** | Total number of customer activities. | [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/CustomersActivityListResponseBody.md b/docs/Model/CustomersActivityListResponseBody.md new file mode 100644 index 0000000..7b83ca8 --- /dev/null +++ b/docs/Model/CustomersActivityListResponseBody.md @@ -0,0 +1,13 @@ +# # CustomersActivityListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about customer activities in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of customer activity objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\CustomerActivity[]**](CustomerActivity.md) | Array of customer activity objects. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] +**moreStartingAfter** | **string** | Returns an ID that can be used to return another page of results. Use the event id in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersCreateRequestBody.md b/docs/Model/CustomersCreateRequestBody.md new file mode 100644 index 0000000..a6d7faa --- /dev/null +++ b/docs/Model/CustomersCreateRequestBody.md @@ -0,0 +1,18 @@ +# # CustomersCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**sourceId** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\CustomersCreateRequestBodyAddress**](CustomersCreateRequestBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersCreateRequestBodyAddress.md b/docs/Model/CustomersCreateRequestBodyAddress.md new file mode 100644 index 0000000..b3926f2 --- /dev/null +++ b/docs/Model/CustomersCreateRequestBodyAddress.md @@ -0,0 +1,14 @@ +# # CustomersCreateRequestBodyAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/CustomersCreateResponseBody.md b/docs/Model/CustomersCreateResponseBody.md new file mode 100644 index 0000000..ddf8313 --- /dev/null +++ b/docs/Model/CustomersCreateResponseBody.md @@ -0,0 +1,26 @@ +# # CustomersCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer that will be linked to redemption in this request. | [optional] +**sourceId** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**summary** | [**\OpenAPI\Client\Model\CustomerSummary**](CustomerSummary.md) | | [optional] +**loyalty** | [**\OpenAPI\Client\Model\CustomerLoyalty**](CustomerLoyalty.md) | | [optional] +**referrals** | [**\OpenAPI\Client\Model\CustomerReferrals**](CustomerReferrals.md) | | [optional] +**systemMetadata** | **object** | Object used to store system metadata information. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] +**assets** | [**\OpenAPI\Client\Model\CustomersCreateResponseBodyAssets**](CustomersCreateResponseBodyAssets.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\CustomersCreateResponseBodyAddress**](CustomersCreateResponseBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersCreateResponseBodyAddress.md b/docs/Model/CustomersCreateResponseBodyAddress.md new file mode 100644 index 0000000..592cafb --- /dev/null +++ b/docs/Model/CustomersCreateResponseBodyAddress.md @@ -0,0 +1,14 @@ +# # CustomersCreateResponseBodyAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/CustomersCreateResponseBodyAssets.md b/docs/Model/CustomersCreateResponseBodyAssets.md new file mode 100644 index 0000000..495d91c --- /dev/null +++ b/docs/Model/CustomersCreateResponseBodyAssets.md @@ -0,0 +1,9 @@ +# # CustomersCreateResponseBodyAssets + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cockpitUrl** | **string** | Customer's cockpit URL address. | [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/CustomersGetResponseBody.md b/docs/Model/CustomersGetResponseBody.md new file mode 100644 index 0000000..2d5bee9 --- /dev/null +++ b/docs/Model/CustomersGetResponseBody.md @@ -0,0 +1,26 @@ +# # CustomersGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer that will be linked to redemption in this request. | [optional] +**sourceId** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**summary** | [**\OpenAPI\Client\Model\CustomerSummary**](CustomerSummary.md) | | [optional] +**loyalty** | [**\OpenAPI\Client\Model\CustomerLoyalty**](CustomerLoyalty.md) | | [optional] +**referrals** | [**\OpenAPI\Client\Model\CustomerReferrals**](CustomerReferrals.md) | | [optional] +**systemMetadata** | **object** | Object used to store system metadata information. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] +**assets** | [**\OpenAPI\Client\Model\CustomersGetResponseBodyAssets**](CustomersGetResponseBodyAssets.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\CustomersGetResponseBodyAddress**](CustomersGetResponseBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersGetResponseBodyAddress.md b/docs/Model/CustomersGetResponseBodyAddress.md new file mode 100644 index 0000000..186cba5 --- /dev/null +++ b/docs/Model/CustomersGetResponseBodyAddress.md @@ -0,0 +1,14 @@ +# # CustomersGetResponseBodyAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/CustomersGetResponseBodyAssets.md b/docs/Model/CustomersGetResponseBodyAssets.md new file mode 100644 index 0000000..c371e15 --- /dev/null +++ b/docs/Model/CustomersGetResponseBodyAssets.md @@ -0,0 +1,9 @@ +# # CustomersGetResponseBodyAssets + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cockpitUrl** | **string** | Customer's cockpit URL address. | [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/CustomersImportCsvCreateResponseBody.md b/docs/Model/CustomersImportCsvCreateResponseBody.md new file mode 100644 index 0000000..bd50437 --- /dev/null +++ b/docs/Model/CustomersImportCsvCreateResponseBody.md @@ -0,0 +1,9 @@ +# # CustomersImportCsvCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/CustomersListResponseBody.md b/docs/Model/CustomersListResponseBody.md new file mode 100644 index 0000000..3d0cfcf --- /dev/null +++ b/docs/Model/CustomersListResponseBody.md @@ -0,0 +1,13 @@ +# # CustomersListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about customers in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of customer objects. | [optional] [default to 'customers'] +**customers** | [**\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals[]**](CustomerWithSummaryLoyaltyReferrals.md) | Contains array of customer objects. | [optional] +**total** | **int** | Total number of customers. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different end date filter) to get more records returned in the results. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersMetadataUpdateInBulkRequestBody.md b/docs/Model/CustomersMetadataUpdateInBulkRequestBody.md new file mode 100644 index 0000000..d58ab51 --- /dev/null +++ b/docs/Model/CustomersMetadataUpdateInBulkRequestBody.md @@ -0,0 +1,10 @@ +# # CustomersMetadataUpdateInBulkRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceIds** | **string[]** | An array of customer `source_id`'s. | [optional] +**metadata** | **object** | Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersMetadataUpdateInBulkResponseBody.md b/docs/Model/CustomersMetadataUpdateInBulkResponseBody.md new file mode 100644 index 0000000..3041870 --- /dev/null +++ b/docs/Model/CustomersMetadataUpdateInBulkResponseBody.md @@ -0,0 +1,9 @@ +# # CustomersMetadataUpdateInBulkResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/CustomersPermanentDeletionCreateResponseBody.md b/docs/Model/CustomersPermanentDeletionCreateResponseBody.md new file mode 100644 index 0000000..45d7ac3 --- /dev/null +++ b/docs/Model/CustomersPermanentDeletionCreateResponseBody.md @@ -0,0 +1,15 @@ +# # CustomersPermanentDeletionCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique permanent deletion object ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format. | [optional] +**relatedObjectId** | **string** | Unique customer ID that is being deleted. | [optional] +**relatedObject** | **string** | Object being deleted. | [optional] [default to 'customer'] +**status** | **string** | Deletion status. | [optional] [default to 'DONE'] +**dataJson** | [**\OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBodyDataJson**](CustomersPermanentDeletionCreateResponseBodyDataJson.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'pernament_deletion'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersPermanentDeletionCreateResponseBodyDataJson.md b/docs/Model/CustomersPermanentDeletionCreateResponseBodyDataJson.md new file mode 100644 index 0000000..1736aaf --- /dev/null +++ b/docs/Model/CustomersPermanentDeletionCreateResponseBodyDataJson.md @@ -0,0 +1,15 @@ +# # CustomersPermanentDeletionCreateResponseBodyDataJson + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**events** | **int** | Number of events deleted. | [optional] +**customerEvents** | **int** | Number of customer events deleted. | [optional] +**dailyEvents** | **int** | Number of daily events deleted. | [optional] +**segments** | **int** | Number of segments deleted. | [optional] +**orders** | **int** | Number of orders deleted. | [optional] +**orderEvents** | **int** | Number of order events deleted. | [optional] +**customer** | **int** | Number of customers deleted. | [optional] [default to 1] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersRedeemablesListResponseBody.md b/docs/Model/CustomersRedeemablesListResponseBody.md new file mode 100644 index 0000000..0ea1881 --- /dev/null +++ b/docs/Model/CustomersRedeemablesListResponseBody.md @@ -0,0 +1,14 @@ +# # CustomersRedeemablesListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about customer redeemables. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of redeemables. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\CustomerRedeemable[]**](CustomerRedeemable.md) | A dictionary that contains an array of redeemables. | [optional] +**total** | **int** | Total number of results returned. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] +**moreStartingAfter** | **string** | Returns an ID that can be used to return another page of results. Use the ID in the `starting_after_id` query parameter to display another page of the results occuring after the field with that ID. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersSegmentsListResponseBody.md b/docs/Model/CustomersSegmentsListResponseBody.md new file mode 100644 index 0000000..5f9ab75 --- /dev/null +++ b/docs/Model/CustomersSegmentsListResponseBody.md @@ -0,0 +1,12 @@ +# # CustomersSegmentsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about customer segments. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of segment IDs. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\SimpleSegment[]**](SimpleSegment.md) | A dictionary that contains an array of segment IDs and names. | [optional] +**total** | **int** | Total number of segments the customer belongs to. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersUpdateInBulkRequestBody.md b/docs/Model/CustomersUpdateInBulkRequestBody.md new file mode 100644 index 0000000..f50b11a --- /dev/null +++ b/docs/Model/CustomersUpdateInBulkRequestBody.md @@ -0,0 +1,17 @@ +# # CustomersUpdateInBulkRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceId** | **string** | Unique customer source ID. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\CustomersUpdateInBulkRequestBodyAddress**](CustomersUpdateInBulkRequestBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersUpdateInBulkRequestBodyAddress.md b/docs/Model/CustomersUpdateInBulkRequestBodyAddress.md new file mode 100644 index 0000000..18e98fd --- /dev/null +++ b/docs/Model/CustomersUpdateInBulkRequestBodyAddress.md @@ -0,0 +1,14 @@ +# # CustomersUpdateInBulkRequestBodyAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/CustomersUpdateInBulkResponseBody.md b/docs/Model/CustomersUpdateInBulkResponseBody.md new file mode 100644 index 0000000..22c8caa --- /dev/null +++ b/docs/Model/CustomersUpdateInBulkResponseBody.md @@ -0,0 +1,9 @@ +# # CustomersUpdateInBulkResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/CustomersUpdateRequestBody.md b/docs/Model/CustomersUpdateRequestBody.md new file mode 100644 index 0000000..45578a9 --- /dev/null +++ b/docs/Model/CustomersUpdateRequestBody.md @@ -0,0 +1,16 @@ +# # CustomersUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\CustomersUpdateRequestBodyAddress**](CustomersUpdateRequestBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersUpdateRequestBodyAddress.md b/docs/Model/CustomersUpdateRequestBodyAddress.md new file mode 100644 index 0000000..4a0d8b0 --- /dev/null +++ b/docs/Model/CustomersUpdateRequestBodyAddress.md @@ -0,0 +1,14 @@ +# # CustomersUpdateRequestBodyAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/CustomersUpdateResponseBody.md b/docs/Model/CustomersUpdateResponseBody.md new file mode 100644 index 0000000..d4572a8 --- /dev/null +++ b/docs/Model/CustomersUpdateResponseBody.md @@ -0,0 +1,26 @@ +# # CustomersUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer that will be linked to redemption in this request. | [optional] +**sourceId** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**summary** | [**\OpenAPI\Client\Model\CustomerSummary**](CustomerSummary.md) | | [optional] +**loyalty** | [**\OpenAPI\Client\Model\CustomerLoyalty**](CustomerLoyalty.md) | | [optional] +**referrals** | [**\OpenAPI\Client\Model\CustomerReferrals**](CustomerReferrals.md) | | [optional] +**systemMetadata** | **object** | Object used to store system metadata information. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] +**assets** | [**\OpenAPI\Client\Model\CustomersUpdateResponseBodyAssets**](CustomersUpdateResponseBodyAssets.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\CustomersUpdateResponseBodyAddress**](CustomersUpdateResponseBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CustomersUpdateResponseBodyAddress.md b/docs/Model/CustomersUpdateResponseBodyAddress.md new file mode 100644 index 0000000..ad00654 --- /dev/null +++ b/docs/Model/CustomersUpdateResponseBodyAddress.md @@ -0,0 +1,14 @@ +# # CustomersUpdateResponseBodyAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/CustomersUpdateResponseBodyAssets.md b/docs/Model/CustomersUpdateResponseBodyAssets.md new file mode 100644 index 0000000..eec69a0 --- /dev/null +++ b/docs/Model/CustomersUpdateResponseBodyAssets.md @@ -0,0 +1,9 @@ +# # CustomersUpdateResponseBodyAssets + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cockpitUrl** | **string** | Customer's cockpit URL address. | [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/Discount.md b/docs/Model/Discount.md new file mode 100644 index 0000000..1d0574f --- /dev/null +++ b/docs/Model/Discount.md @@ -0,0 +1,25 @@ +# # Discount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**amountOff** | **float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] +**amountOffFormula** | **string** | | [optional] +**aggregatedAmountLimit** | **int** | Maximum discount amount per order. | [optional] +**effect** | **string** | | [optional] +**isDynamic** | **bool** | Flag indicating whether the discount was calculated using a formula. | [optional] +**unitOff** | **int** | Number of units to be granted a full value discount. | [optional] +**unitOffFormula** | **string** | | [optional] +**unitType** | **string** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] +**product** | [**\OpenAPI\Client\Model\SimpleProductDiscountUnit**](SimpleProductDiscountUnit.md) | | [optional] +**sku** | [**\OpenAPI\Client\Model\SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] +**units** | [**\OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]**](DiscountUnitMultipleOneUnit.md) | | [optional] +**percentOff** | **float** | The percent discount that the customer will receive. | [optional] +**percentOffFormula** | **string** | | [optional] +**amountLimit** | **float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**fixedAmount** | **float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] +**fixedAmountFormula** | **string** | | [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/DiscountUnitMultipleOneUnit.md b/docs/Model/DiscountUnitMultipleOneUnit.md new file mode 100644 index 0000000..af60da4 --- /dev/null +++ b/docs/Model/DiscountUnitMultipleOneUnit.md @@ -0,0 +1,14 @@ +# # DiscountUnitMultipleOneUnit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**unitOff** | **float** | Number of units to be granted a full value discount. | [optional] +**unitOffFormula** | **string** | | [optional] +**effect** | **string** | Defines how the unit is added to the customer's order. | [optional] +**unitType** | **string** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] +**product** | [**\OpenAPI\Client\Model\SimpleProductDiscountUnit**](SimpleProductDiscountUnit.md) | | [optional] +**sku** | [**\OpenAPI\Client\Model\SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.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/EarningRule.md b/docs/Model/EarningRule.md new file mode 100644 index 0000000..e5fb40d --- /dev/null +++ b/docs/Model/EarningRule.md @@ -0,0 +1,27 @@ +# # EarningRule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\EarningRuleLoyalty**](EarningRuleLoyalty.md) | | [optional] +**event** | **string** | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\EarningRuleCustomEvent**](EarningRuleCustomEvent.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\EarningRuleSegment**](EarningRuleSegment.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyTier**](EarningRuleLoyaltyTier.md) | | [optional] +**source** | [**\OpenAPI\Client\Model\EarningRuleSource**](EarningRuleSource.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automationId** | **string** | For internal use by Voucherify. | [optional] +**startDate** | **string** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expirationDate** | **string** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**validationRuleId** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EarningRuleCustomEvent.md b/docs/Model/EarningRuleCustomEvent.md new file mode 100644 index 0000000..3d546ee --- /dev/null +++ b/docs/Model/EarningRuleCustomEvent.md @@ -0,0 +1,9 @@ +# # EarningRuleCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schemaId** | **string** | Unique identifier of the custom event schema | [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/EarningRuleLoyalty.md b/docs/Model/EarningRuleLoyalty.md new file mode 100644 index 0000000..f16e3de --- /dev/null +++ b/docs/Model/EarningRuleLoyalty.md @@ -0,0 +1,15 @@ +# # EarningRuleLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**calculationType** | **string** | | [optional] +**order** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyOrder**](EarningRuleLoyaltyOrder.md) | | [optional] +**orderItems** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyOrderItems**](EarningRuleLoyaltyOrderItems.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyCustomer**](EarningRuleLoyaltyCustomer.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyCustomEvent**](EarningRuleLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EarningRuleLoyaltyCustomEvent.md b/docs/Model/EarningRuleLoyaltyCustomEvent.md new file mode 100644 index 0000000..605bd6a --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # EarningRuleLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyCustomEventMetadata**](EarningRuleLoyaltyCustomEventMetadata.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/EarningRuleLoyaltyCustomEventMetadata.md b/docs/Model/EarningRuleLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..0b51870 --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # EarningRuleLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/EarningRuleLoyaltyCustomer.md b/docs/Model/EarningRuleLoyaltyCustomer.md new file mode 100644 index 0000000..24ca57a --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # EarningRuleLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyCustomerMetadata**](EarningRuleLoyaltyCustomerMetadata.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/EarningRuleLoyaltyCustomerMetadata.md b/docs/Model/EarningRuleLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..675e83e --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # EarningRuleLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/EarningRuleLoyaltyOrder.md b/docs/Model/EarningRuleLoyaltyOrder.md new file mode 100644 index 0000000..e6f30ff --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # EarningRuleLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyOrderAmount**](EarningRuleLoyaltyOrderAmount.md) | | [optional] +**totalAmount** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyOrderTotalAmount**](EarningRuleLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyOrderMetadata**](EarningRuleLoyaltyOrderMetadata.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/EarningRuleLoyaltyOrderAmount.md b/docs/Model/EarningRuleLoyaltyOrderAmount.md new file mode 100644 index 0000000..da2542b --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # EarningRuleLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EarningRuleLoyaltyOrderItems.md b/docs/Model/EarningRuleLoyaltyOrderItems.md new file mode 100644 index 0000000..4db6be5 --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # EarningRuleLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsQuantity**](EarningRuleLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsAmount**](EarningRuleLoyaltyOrderItemsAmount.md) | | [optional] +**subtotalAmount** | [**\OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsSubtotalAmount**](EarningRuleLoyaltyOrderItemsSubtotalAmount.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/EarningRuleLoyaltyOrderItemsAmount.md b/docs/Model/EarningRuleLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..a89f243 --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # EarningRuleLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/EarningRuleLoyaltyOrderItemsQuantity.md b/docs/Model/EarningRuleLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..b80651c --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # EarningRuleLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/EarningRuleLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/EarningRuleLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..50de595 --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # EarningRuleLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/EarningRuleLoyaltyOrderMetadata.md b/docs/Model/EarningRuleLoyaltyOrderMetadata.md new file mode 100644 index 0000000..3ecd0c6 --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # EarningRuleLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/EarningRuleLoyaltyOrderTotalAmount.md b/docs/Model/EarningRuleLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..d6f2249 --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # EarningRuleLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EarningRuleLoyaltyTier.md b/docs/Model/EarningRuleLoyaltyTier.md new file mode 100644 index 0000000..fd694ee --- /dev/null +++ b/docs/Model/EarningRuleLoyaltyTier.md @@ -0,0 +1,9 @@ +# # EarningRuleLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [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/EarningRuleSegment.md b/docs/Model/EarningRuleSegment.md new file mode 100644 index 0000000..40786f0 --- /dev/null +++ b/docs/Model/EarningRuleSegment.md @@ -0,0 +1,9 @@ +# # EarningRuleSegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [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/EarningRuleSource.md b/docs/Model/EarningRuleSource.md new file mode 100644 index 0000000..bbd5d2c --- /dev/null +++ b/docs/Model/EarningRuleSource.md @@ -0,0 +1,11 @@ +# # EarningRuleSource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**objectId** | **string** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**objectType** | **string** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Error.md b/docs/Model/Error.md new file mode 100644 index 0000000..315b47f --- /dev/null +++ b/docs/Model/Error.md @@ -0,0 +1,15 @@ +# # Error + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | Error's HTTP status code. | [optional] +**key** | **string** | Short string describing the kind of error which occurred. | [optional] +**message** | **string** | A human-readable message providing a short description about the error. | [optional] +**details** | **string** | A human-readable message providing more details about the error. | [optional] +**requestId** | **string** | This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team. | [optional] +**resourceId** | **string** | Unique resource ID that can be used in another endpoint to get more details. | [optional] +**resourceType** | **string** | The resource type. | [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/EventsCreateRequestBody.md b/docs/Model/EventsCreateRequestBody.md new file mode 100644 index 0000000..5886eed --- /dev/null +++ b/docs/Model/EventsCreateRequestBody.md @@ -0,0 +1,13 @@ +# # EventsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event** | **string** | Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | +**referral** | [**\OpenAPI\Client\Model\EventsCreateRequestBodyReferral**](EventsCreateRequestBodyReferral.md) | | [optional] +**loyalty** | [**\OpenAPI\Client\Model\EventsCreateRequestBodyLoyalty**](EventsCreateRequestBodyLoyalty.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EventsCreateRequestBodyLoyalty.md b/docs/Model/EventsCreateRequestBodyLoyalty.md new file mode 100644 index 0000000..93285f5 --- /dev/null +++ b/docs/Model/EventsCreateRequestBodyLoyalty.md @@ -0,0 +1,9 @@ +# # EventsCreateRequestBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EventsCreateRequestBodyReferral.md b/docs/Model/EventsCreateRequestBodyReferral.md new file mode 100644 index 0000000..5425f9d --- /dev/null +++ b/docs/Model/EventsCreateRequestBodyReferral.md @@ -0,0 +1,10 @@ +# # EventsCreateRequestBodyReferral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | A code through which a new visitor has been referred to a service. | [optional] +**referrerId** | **string** | Unique ID of the referring person - it is optional and not required if the referral **code** is provided. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EventsCreateResponseBody.md b/docs/Model/EventsCreateResponseBody.md new file mode 100644 index 0000000..40957e0 --- /dev/null +++ b/docs/Model/EventsCreateResponseBody.md @@ -0,0 +1,14 @@ +# # EventsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The object represented is an `event`. | [optional] [default to 'event'] +**type** | **string** | The event name. | [optional] +**customer** | [**\OpenAPI\Client\Model\SimpleCustomerRequiredObjectType**](SimpleCustomerRequiredObjectType.md) | | +**referral** | **object** | A `null` referral object. | [optional] +**loyalty** | **object** | A `null` loyalty object. | [optional] +**metadata** | **object** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Export.md b/docs/Model/Export.md new file mode 100644 index 0000000..01d4b92 --- /dev/null +++ b/docs/Model/Export.md @@ -0,0 +1,17 @@ +# # Export + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique export ID. | [optional] +**object** | **string** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **string** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] +**channel** | **string** | The channel through which the export was triggered. | [optional] +**result** | [**\OpenAPI\Client\Model\ExportResult**](ExportResult.md) | | [optional] +**userId** | **string** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exportedObject** | **string** | | [optional] +**parameters** | [**\OpenAPI\Client\Model\ExportParameters**](ExportParameters.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/ExportParameters.md b/docs/Model/ExportParameters.md new file mode 100644 index 0000000..4fe59fd --- /dev/null +++ b/docs/Model/ExportParameters.md @@ -0,0 +1,11 @@ +# # ExportParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**\OpenAPI\Client\Model\ExportParametersFilters**](ExportParametersFilters.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/ExportParametersFilters.md b/docs/Model/ExportParametersFilters.md new file mode 100644 index 0000000..24e6eda --- /dev/null +++ b/docs/Model/ExportParametersFilters.md @@ -0,0 +1,12 @@ +# # ExportParametersFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**campaignId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**voucherId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ExportResult.md b/docs/Model/ExportResult.md new file mode 100644 index 0000000..a96bd72 --- /dev/null +++ b/docs/Model/ExportResult.md @@ -0,0 +1,9 @@ +# # ExportResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | URL of the CSV file location. It contains the token used for authorization in the Download export method. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ExportVoucherTransactionsFilters.md b/docs/Model/ExportVoucherTransactionsFilters.md new file mode 100644 index 0000000..b3aeda4 --- /dev/null +++ b/docs/Model/ExportVoucherTransactionsFilters.md @@ -0,0 +1,12 @@ +# # ExportVoucherTransactionsFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**voucherId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**campaignId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ExportsCreateRequestBody.md b/docs/Model/ExportsCreateRequestBody.md new file mode 100644 index 0000000..ad51b26 --- /dev/null +++ b/docs/Model/ExportsCreateRequestBody.md @@ -0,0 +1,10 @@ +# # ExportsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exportedObject** | **string** | | [optional] +**parameters** | [**\OpenAPI\Client\Model\ExportsCreateRequestBodyParameters**](ExportsCreateRequestBodyParameters.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/ExportsCreateRequestBodyParameters.md b/docs/Model/ExportsCreateRequestBodyParameters.md new file mode 100644 index 0000000..bb55238 --- /dev/null +++ b/docs/Model/ExportsCreateRequestBodyParameters.md @@ -0,0 +1,11 @@ +# # ExportsCreateRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**\OpenAPI\Client\Model\ExportsCreateRequestBodyParametersFilters**](ExportsCreateRequestBodyParametersFilters.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/ExportsCreateRequestBodyParametersFilters.md b/docs/Model/ExportsCreateRequestBodyParametersFilters.md new file mode 100644 index 0000000..ae73063 --- /dev/null +++ b/docs/Model/ExportsCreateRequestBodyParametersFilters.md @@ -0,0 +1,12 @@ +# # ExportsCreateRequestBodyParametersFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**campaignId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**voucherId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ExportsCreateResponseBody.md b/docs/Model/ExportsCreateResponseBody.md new file mode 100644 index 0000000..fa8537e --- /dev/null +++ b/docs/Model/ExportsCreateResponseBody.md @@ -0,0 +1,17 @@ +# # ExportsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique export ID. | [optional] +**object** | **string** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **string** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] [default to 'SCHEDULED'] +**channel** | **string** | The channel through which the export was triggered. | [optional] +**result** | **object** | Contains the URL of the CSV file. | [optional] +**userId** | **string** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exportedObject** | **string** | | [optional] +**parameters** | [**\OpenAPI\Client\Model\ExportsCreateResponseBodyParameters**](ExportsCreateResponseBodyParameters.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/ExportsCreateResponseBodyParameters.md b/docs/Model/ExportsCreateResponseBodyParameters.md new file mode 100644 index 0000000..c8ebc2f --- /dev/null +++ b/docs/Model/ExportsCreateResponseBodyParameters.md @@ -0,0 +1,11 @@ +# # ExportsCreateResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**\OpenAPI\Client\Model\ExportsCreateResponseBodyParametersFilters**](ExportsCreateResponseBodyParametersFilters.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/ExportsCreateResponseBodyParametersFilters.md b/docs/Model/ExportsCreateResponseBodyParametersFilters.md new file mode 100644 index 0000000..9b01e38 --- /dev/null +++ b/docs/Model/ExportsCreateResponseBodyParametersFilters.md @@ -0,0 +1,12 @@ +# # ExportsCreateResponseBodyParametersFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**campaignId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**voucherId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ExportsGetResponseBody.md b/docs/Model/ExportsGetResponseBody.md new file mode 100644 index 0000000..1e062c8 --- /dev/null +++ b/docs/Model/ExportsGetResponseBody.md @@ -0,0 +1,17 @@ +# # ExportsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique export ID. | [optional] +**object** | **string** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **string** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] +**channel** | **string** | The channel through which the export was triggered. | [optional] +**result** | [**\OpenAPI\Client\Model\ExportsGetResponseBodyResult**](ExportsGetResponseBodyResult.md) | | [optional] +**userId** | **string** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exportedObject** | **string** | | [optional] +**parameters** | [**\OpenAPI\Client\Model\ExportsGetResponseBodyParameters**](ExportsGetResponseBodyParameters.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/ExportsGetResponseBodyParameters.md b/docs/Model/ExportsGetResponseBodyParameters.md new file mode 100644 index 0000000..8f7295b --- /dev/null +++ b/docs/Model/ExportsGetResponseBodyParameters.md @@ -0,0 +1,11 @@ +# # ExportsGetResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**\OpenAPI\Client\Model\ExportsGetResponseBodyParametersFilters**](ExportsGetResponseBodyParametersFilters.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/ExportsGetResponseBodyParametersFilters.md b/docs/Model/ExportsGetResponseBodyParametersFilters.md new file mode 100644 index 0000000..475b7f3 --- /dev/null +++ b/docs/Model/ExportsGetResponseBodyParametersFilters.md @@ -0,0 +1,12 @@ +# # ExportsGetResponseBodyParametersFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**campaignId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**voucherId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ExportsGetResponseBodyResult.md b/docs/Model/ExportsGetResponseBodyResult.md new file mode 100644 index 0000000..6905d05 --- /dev/null +++ b/docs/Model/ExportsGetResponseBodyResult.md @@ -0,0 +1,9 @@ +# # ExportsGetResponseBodyResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | URL of the CSV file location. It contains the token used for authorization in the Download export method. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ExportsListResponseBody.md b/docs/Model/ExportsListResponseBody.md new file mode 100644 index 0000000..a970b39 --- /dev/null +++ b/docs/Model/ExportsListResponseBody.md @@ -0,0 +1,12 @@ +# # ExportsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about exports. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of exports. | [optional] [default to 'exports'] +**exports** | [**\OpenAPI\Client\Model\Export[]**](Export.md) | An array of export objects. | [optional] +**total** | **int** | Total number of exports. | [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/FieldConditions.md b/docs/Model/FieldConditions.md new file mode 100644 index 0000000..468b1d6 --- /dev/null +++ b/docs/Model/FieldConditions.md @@ -0,0 +1,9 @@ +# # FieldConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FiltersCondition**](FiltersCondition.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/FilterConditionsDateTime.md b/docs/Model/FilterConditionsDateTime.md new file mode 100644 index 0000000..048365a --- /dev/null +++ b/docs/Model/FilterConditionsDateTime.md @@ -0,0 +1,9 @@ +# # FilterConditionsDateTime + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsDateTimeConditions**](FilterConditionsDateTimeConditions.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/FilterConditionsDateTimeConditions.md b/docs/Model/FilterConditionsDateTimeConditions.md new file mode 100644 index 0000000..67ef533 --- /dev/null +++ b/docs/Model/FilterConditionsDateTimeConditions.md @@ -0,0 +1,14 @@ +# # FilterConditionsDateTimeConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**after** | **\DateTime** | Value is after this date. The value for this parameter is shown in the ISO 8601 format. | [optional] +**before** | **\DateTime** | Value is before this date. The value for this parameter is shown in the ISO 8601 format. | [optional] +**has_value** | **string** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**is_unknown** | **string** | Value is null. The value for this parameter is an empty string. | [optional] +**more_than** | **int** | Value is more days ago before the current date and time, e.g. more than `10` days ago. | [optional] +**less_than** | **int** | Value is less days before the current date and time, e.g. less than `10` days ago. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FilterConditionsString.md b/docs/Model/FilterConditionsString.md new file mode 100644 index 0000000..a2365a4 --- /dev/null +++ b/docs/Model/FilterConditionsString.md @@ -0,0 +1,16 @@ +# # FilterConditionsString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**notIn** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**is** | **string** | Value is exactly this value (single value). | [optional] +**isNot** | **string** | Results omit this value (single value). | [optional] +**hasValue** | **string** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**isUnknown** | **string** | Value is null. The value for this parameter is an empty string. | [optional] +**startsWith** | **string** | Value starts with the specified string. | [optional] +**endsWith** | **string** | Value ends with the specified string. | [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/FiltersCondition.md b/docs/Model/FiltersCondition.md new file mode 100644 index 0000000..a3b8294 --- /dev/null +++ b/docs/Model/FiltersCondition.md @@ -0,0 +1,33 @@ +# # FiltersCondition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **mixed** | | [optional] +**notIn** | **mixed** | | [optional] +**is** | **mixed** | | [optional] +**isDaysAgo** | **mixed** | | [optional] +**isDaysInFuture** | **mixed** | | [optional] +**isNot** | **mixed** | | [optional] +**hasValue** | **mixed** | | [optional] +**isUnknown** | **mixed** | | [optional] +**contains** | **mixed** | | [optional] +**notContain** | **mixed** | | [optional] +**startsWith** | **mixed** | | [optional] +**endsWith** | **mixed** | | [optional] +**moreThan** | **mixed** | | [optional] +**lessThan** | **mixed** | | [optional] +**moreThanAgo** | **mixed** | | [optional] +**lessThanAgo** | **mixed** | | [optional] +**moreThanFuture** | **mixed** | | [optional] +**lessThanFuture** | **mixed** | | [optional] +**moreThanEqual** | **mixed** | | [optional] +**lessThanEqual** | **mixed** | | [optional] +**after** | **mixed** | | [optional] +**before** | **mixed** | | [optional] +**count** | **mixed** | | [optional] +**countLess** | **mixed** | | [optional] +**countMore** | **mixed** | | [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/Gift.md b/docs/Model/Gift.md new file mode 100644 index 0000000..98b8611 --- /dev/null +++ b/docs/Model/Gift.md @@ -0,0 +1,11 @@ +# # Gift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **float** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **float** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/InapplicableTo.md b/docs/Model/InapplicableTo.md new file mode 100644 index 0000000..b43e462 --- /dev/null +++ b/docs/Model/InapplicableTo.md @@ -0,0 +1,25 @@ +# # InapplicableTo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | This object stores information about the product collection. | [optional] +**id** | **string** | Unique product collection ID assigned by Voucherify. | [optional] +**sourceId** | **string** | The source ID from your inventory system. | [optional] +**productId** | **string** | Parent product's unique ID assigned by Voucherify. | [optional] +**productSourceId** | **string** | Parent product's source ID from your inventory system. | [optional] +**strict** | **bool** | | [optional] +**price** | **float** | New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price. | [optional] +**priceFormula** | **float** | Formula used to calculate the discounted price of an item. | [optional] +**effect** | **string** | | [optional] +**quantityLimit** | **int** | The maximum number of units allowed to be discounted per order line item. | [optional] +**aggregatedQuantityLimit** | **int** | The maximum number of units allowed to be discounted combined across all matched order line items. | [optional] +**amountLimit** | **int** | Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**aggregatedAmountLimit** | **int** | Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value) | [optional] +**orderItemIndices** | **int[]** | | [optional] +**repeat** | **int** | | [optional] +**skipInitially** | **int** | | [optional] +**target** | **string** | | [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/InapplicableToResultList.md b/docs/Model/InapplicableToResultList.md new file mode 100644 index 0000000..66fd82c --- /dev/null +++ b/docs/Model/InapplicableToResultList.md @@ -0,0 +1,12 @@ +# # InapplicableToResultList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**\OpenAPI\Client\Model\InapplicableTo[]**](InapplicableTo.md) | Contains array of items to which the discount cannot apply. | [optional] +**total** | **int** | Total number of objects defining included products, SKUs, or product collections. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'list'] +**dataRef** | **string** | The type of the object represented by JSON. | [optional] [default to 'data'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ListPublicationsItemVoucher.md b/docs/Model/ListPublicationsItemVoucher.md new file mode 100644 index 0000000..40f2484 --- /dev/null +++ b/docs/Model/ListPublicationsItemVoucher.md @@ -0,0 +1,15 @@ +# # ListPublicationsItemVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Voucher code. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'voucher'] +**campaign** | **string** | Campaign name | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**loyaltyCard** | **object** | Defines the loyalty card details. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [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/LoyaltiesCreateCampaignRequestBody.md b/docs/Model/LoyaltiesCreateCampaignRequestBody.md new file mode 100644 index 0000000..403f807 --- /dev/null +++ b/docs/Model/LoyaltiesCreateCampaignRequestBody.md @@ -0,0 +1,27 @@ +# # LoyaltiesCreateCampaignRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign (size of campaign). | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**validationRules** | **string[]** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] +**category** | **string** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**voucher** | [**\OpenAPI\Client\Model\CampaignLoyaltyVoucher**](CampaignLoyaltyVoucher.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/LoyaltiesCreateCampaignResponseBody.md b/docs/Model/LoyaltiesCreateCampaignResponseBody.md new file mode 100644 index 0000000..16860b9 --- /dev/null +++ b/docs/Model/LoyaltiesCreateCampaignResponseBody.md @@ -0,0 +1,38 @@ +# # LoyaltiesCreateCampaignResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**\OpenAPI\Client\Model\LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **string** | Unique category name. | [optional] +**creationStatus** | **string** | Indicates the status of the campaign creation. | [optional] +**vouchersGenerationStatus** | **string** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**accessSettingsAssignments** | [**\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.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/LoyaltiesDeleteResponseBody.md b/docs/Model/LoyaltiesDeleteResponseBody.md new file mode 100644 index 0000000..05bcce2 --- /dev/null +++ b/docs/Model/LoyaltiesDeleteResponseBody.md @@ -0,0 +1,9 @@ +# # LoyaltiesDeleteResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/LoyaltiesEarningRulesCreateCustomEventRequestBody.md b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBody.md new file mode 100644 index 0000000..b75be25 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBody.md @@ -0,0 +1,20 @@ +# # LoyaltiesEarningRulesCreateCustomEventRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**validation_rule_id** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyalty**](LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyalty.md) | | [optional] +**custom_event** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateCustomEventRequestBodyCustomEvent**](LoyaltiesEarningRulesCreateCustomEventRequestBodyCustomEvent.md) | | [optional] +**event** | **string** | Defines the event which triggers the earning rule to add points to a loyalty card. - `custom_event_name` the name of a custom event defined in the Dashboard &rarr; **Project Settings** &rarr; **EVENT SCHEMA** &rarr; **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateCustomEventRequestBodySource**](LoyaltiesEarningRulesCreateCustomEventRequestBodySource.md) | | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] +**start_date** | **\DateTime** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] +**expiration_date** | **\DateTime** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyCustomEvent.md new file mode 100644 index 0000000..faad16f --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateCustomEventRequestBodyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schema_id** | **string** | Contains a unique identifier of a custom event schema. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyalty.md new file mode 100644 index 0000000..f4bdca6 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyalty.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] +**calculation_type** | **string** | CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute). | [optional] [default to 'CUSTOM_EVENT_METADATA'] +**custom_event** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEvent.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/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEvent.md new file mode 100644 index 0000000..7b8612a --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEventMetadata.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/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEventMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..8d7e473 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateCustomEventRequestBodyLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/LoyaltiesEarningRulesCreateCustomEventRequestBodySource.md b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodySource.md new file mode 100644 index 0000000..d159c46 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateCustomEventRequestBodySource.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateCustomEventRequestBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBody.md b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBody.md new file mode 100644 index 0000000..97b7b61 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBody.md @@ -0,0 +1,20 @@ +# # LoyaltiesEarningRulesCreateEnteredSegmentRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**validation_rule_id** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyalty**](LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyalty.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySegment**](LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySegment.md) | | [optional] +**event** | **string** | Defines the event which triggers the earning rule to add points to a loyalty card. - `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment. | [optional] [default to 'customer.segment.entered'] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySource**](LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySource.md) | | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] +**start_date** | **\DateTime** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] +**expiration_date** | **\DateTime** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyalty.md new file mode 100644 index 0000000..1a395d0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyalty.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] +**calculation_type** | **string** | CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object) | [optional] [default to 'CUSTOMER_METADATA'] +**customer** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomer**](LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomer.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/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomer.md b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomer.md new file mode 100644 index 0000000..1294f9b --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomerMetadata.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/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomerMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..f6a6c22 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateEnteredSegmentRequestBodyLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySegment.md b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySegment.md new file mode 100644 index 0000000..09079d0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySegment.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySource.md b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySource.md new file mode 100644 index 0000000..799d41e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySource.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateEnteredSegmentRequestBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBody.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBody.md new file mode 100644 index 0000000..a41fa6c --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBody.md @@ -0,0 +1,19 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**validation_rule_id** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyalty**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyalty.md) | | [optional] +**event** | **string** | Defines the event which triggers the earning rule to add points to a loyalty card. - `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. | [optional] [default to 'order.paid'] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodySource**](LoyaltiesEarningRulesCreateOrderPaidRequestBodySource.md) | | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] +**start_date** | **\DateTime** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] +**expiration_date** | **\DateTime** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyalty.md new file mode 100644 index 0000000..2007e44 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyalty.md @@ -0,0 +1,13 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**calculation_type** | **string** | | [optional] +**order_items** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItems**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItems.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrder**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrder.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrder.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrder.md new file mode 100644 index 0000000..6a090b3 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderMetadata.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/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderAmount.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderAmount.md new file mode 100644 index 0000000..6baaa4a --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItems.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItems.md new file mode 100644 index 0000000..2b5bcfa --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsSubtotalAmount.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/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsAmount.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..fb30bb5 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsQuantity.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..ca49efc --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..9cf707f --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderMetadata.md new file mode 100644 index 0000000..57f3f0e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderTotalAmount.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..a1100ab --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodyLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodySource.md b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodySource.md new file mode 100644 index 0000000..bacad17 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateOrderPaidRequestBodySource.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateOrderPaidRequestBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItem.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItem.md new file mode 100644 index 0000000..ec3899e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItem.md @@ -0,0 +1,22 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**validationRuleId** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyalty**](LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md) | | [optional] +**event** | **string** | | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemSource**](LoyaltiesEarningRulesCreateRequestBodyItemSource.md) | | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] +**startDate** | **\DateTime** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] +**expirationDate** | **\DateTime** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | | [optional] +**segment** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemSegment**](LoyaltiesEarningRulesCreateRequestBodyItemSegment.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent**](LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.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/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md new file mode 100644 index 0000000..5683dae --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schemaId** | **string** | Contains a unique identifier of a custom event schema. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md new file mode 100644 index 0000000..fdebb30 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md @@ -0,0 +1,15 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] +**calculationType** | **string** | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md) | | [optional] +**orderItems** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md new file mode 100644 index 0000000..b89f566 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..0226b43 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md new file mode 100644 index 0000000..ac8df25 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..735dac2 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md new file mode 100644 index 0000000..e89aec0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md) | | [optional] +**totalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md new file mode 100644 index 0000000..45375c4 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md new file mode 100644 index 0000000..748d6f0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md) | | [optional] +**subtotalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..1b8ab04 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..de2f716 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..2a0a57d --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md new file mode 100644 index 0000000..49e12fd --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..2591144 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md new file mode 100644 index 0000000..40b4c79 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [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/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md new file mode 100644 index 0000000..4ab404f --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemSegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesCreateRequestBodyItemSource.md b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemSource.md new file mode 100644 index 0000000..f8b3a82 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateRequestBodyItemSource.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateRequestBodyItemSource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateResponseBody.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBody.md new file mode 100644 index 0000000..57105e1 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBody.md @@ -0,0 +1,27 @@ +# # LoyaltiesEarningRulesCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyalty**](LoyaltiesEarningRulesCreateResponseBodyLoyalty.md) | | [optional] +**event** | **string** | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyCustomEvent**](LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodySegment**](LoyaltiesEarningRulesCreateResponseBodySegment.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodySource**](LoyaltiesEarningRulesCreateResponseBodySource.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automationId** | **string** | For internal use by Voucherify. | [optional] +**startDate** | **string** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expirationDate** | **string** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**validationRuleId** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md new file mode 100644 index 0000000..cca8179 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateResponseBodyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schemaId** | **string** | Unique identifier of the custom event schema | [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/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md new file mode 100644 index 0000000..336621e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md @@ -0,0 +1,15 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**calculationType** | **string** | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md) | | [optional] +**orderItems** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 0000000..70ba7d8 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..ec139cf --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md new file mode 100644 index 0000000..201c742 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..11593ad --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md new file mode 100644 index 0000000..891a4db --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md) | | [optional] +**totalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 0000000..4749af1 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md new file mode 100644 index 0000000..bc39df1 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..6339654 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..6c095dd --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..5e4fd48 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 0000000..1d3f01b --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..fab92f6 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md new file mode 100644 index 0000000..e0d7d7e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [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/LoyaltiesEarningRulesCreateResponseBodySegment.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodySegment.md new file mode 100644 index 0000000..2072b0e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodySegment.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateResponseBodySegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesCreateResponseBodySource.md b/docs/Model/LoyaltiesEarningRulesCreateResponseBodySource.md new file mode 100644 index 0000000..6595d01 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateResponseBodySource.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesCreateResponseBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**objectId** | **string** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**objectType** | **string** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBody.md b/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBody.md new file mode 100644 index 0000000..c09b45c --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBody.md @@ -0,0 +1,20 @@ +# # LoyaltiesEarningRulesCreateTierChangeRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**validation_rule_id** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyalty**](LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyalty.md) | | [optional] +**event** | **string** | Defines the event which triggers the earning rule to add points to a loyalty card. - `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier - `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier - `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded - `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded - `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged | [optional] +**loyalty_tier** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyaltyTier**](LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyaltyTier.md) | | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateTierChangeRequestBodySource**](LoyaltiesEarningRulesCreateTierChangeRequestBodySource.md) | | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] +**start_date** | **\DateTime** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] +**expiration_date** | **\DateTime** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyalty.md new file mode 100644 index 0000000..1cc63ab --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyalty.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | The number of points to be added to the loyalty card. | [optional] [default to 'FIXED'] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyaltyTier.md b/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyaltyTier.md new file mode 100644 index 0000000..82af4b4 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyaltyTier.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateTierChangeRequestBodyLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [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/LoyaltiesEarningRulesCreateTierChangeRequestBodySource.md b/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodySource.md new file mode 100644 index 0000000..c17e205 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesCreateTierChangeRequestBodySource.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesCreateTierChangeRequestBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesDisableResponseBody.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBody.md new file mode 100644 index 0000000..fb99a0e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBody.md @@ -0,0 +1,26 @@ +# # LoyaltiesEarningRulesDisableResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyalty**](LoyaltiesEarningRulesDisableResponseBodyLoyalty.md) | | [optional] +**event** | **string** | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyCustomEvent**](LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodySegment**](LoyaltiesEarningRulesDisableResponseBodySegment.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodySource**](LoyaltiesEarningRulesDisableResponseBodySource.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automationId** | **string** | For internal use by Voucherify. | [optional] +**startDate** | **string** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expirationDate** | **string** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. | [optional] [default to false] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md new file mode 100644 index 0000000..d16f749 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesDisableResponseBodyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schemaId** | **string** | Unique identifier of the custom event schema | [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/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md new file mode 100644 index 0000000..3560d23 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md @@ -0,0 +1,15 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**calculationType** | **string** | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md) | | [optional] +**orderItems** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 0000000..ec87d39 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..3ad72ac --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md new file mode 100644 index 0000000..8ff861c --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..3798e0c --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md new file mode 100644 index 0000000..25bfa30 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md) | | [optional] +**totalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 0000000..66f413c --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md new file mode 100644 index 0000000..2ecac1e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..fd43686 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..66defd0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..326ab7d --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 0000000..58d1d95 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..bfa0372 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md new file mode 100644 index 0000000..360115c --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [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/LoyaltiesEarningRulesDisableResponseBodySegment.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodySegment.md new file mode 100644 index 0000000..e67984a --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodySegment.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesDisableResponseBodySegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesDisableResponseBodySource.md b/docs/Model/LoyaltiesEarningRulesDisableResponseBodySource.md new file mode 100644 index 0000000..0ad5f29 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesDisableResponseBodySource.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesDisableResponseBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**objectId** | **string** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**objectType** | **string** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesEnableResponseBody.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBody.md new file mode 100644 index 0000000..bec803d --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBody.md @@ -0,0 +1,26 @@ +# # LoyaltiesEarningRulesEnableResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyalty**](LoyaltiesEarningRulesEnableResponseBodyLoyalty.md) | | [optional] +**event** | **string** | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyCustomEvent**](LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodySegment**](LoyaltiesEarningRulesEnableResponseBodySegment.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodySource**](LoyaltiesEarningRulesEnableResponseBodySource.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automationId** | **string** | For internal use by Voucherify. | [optional] +**startDate** | **string** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expirationDate** | **string** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. | [optional] [default to true] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md new file mode 100644 index 0000000..f6ffabf --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesEnableResponseBodyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schemaId** | **string** | Unique identifier of the custom event schema | [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/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md new file mode 100644 index 0000000..2d292b6 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md @@ -0,0 +1,15 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**calculationType** | **string** | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md) | | [optional] +**orderItems** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 0000000..0bcca5e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..662bd43 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md new file mode 100644 index 0000000..3cceb12 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..bc61e93 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md new file mode 100644 index 0000000..0e9fd19 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md) | | [optional] +**totalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 0000000..cda6be0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md new file mode 100644 index 0000000..da8fbf2 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..50bdb6d --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..f95176b --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..a7b76e1 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 0000000..1dbf004 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..b07e45e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md new file mode 100644 index 0000000..bf73c2b --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [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/LoyaltiesEarningRulesEnableResponseBodySegment.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodySegment.md new file mode 100644 index 0000000..898d37d --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodySegment.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesEnableResponseBodySegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesEnableResponseBodySource.md b/docs/Model/LoyaltiesEarningRulesEnableResponseBodySource.md new file mode 100644 index 0000000..00433dd --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesEnableResponseBodySource.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesEnableResponseBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**objectId** | **string** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**objectType** | **string** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesGetResponseBody.md b/docs/Model/LoyaltiesEarningRulesGetResponseBody.md new file mode 100644 index 0000000..21076c0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBody.md @@ -0,0 +1,27 @@ +# # LoyaltiesEarningRulesGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyalty**](LoyaltiesEarningRulesGetResponseBodyLoyalty.md) | | [optional] +**event** | **string** | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyCustomEvent**](LoyaltiesEarningRulesGetResponseBodyCustomEvent.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodySegment**](LoyaltiesEarningRulesGetResponseBodySegment.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyTier**](LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodySource**](LoyaltiesEarningRulesGetResponseBodySource.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automationId** | **string** | For internal use by Voucherify. | [optional] +**startDate** | **string** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expirationDate** | **string** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**validationRuleId** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md new file mode 100644 index 0000000..b601f11 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesGetResponseBodyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schemaId** | **string** | Unique identifier of the custom event schema | [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/LoyaltiesEarningRulesGetResponseBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyalty.md new file mode 100644 index 0000000..08ccacd --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyalty.md @@ -0,0 +1,15 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**calculationType** | **string** | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md) | | [optional] +**orderItems** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 0000000..b241fee --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..fadd585 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md new file mode 100644 index 0000000..cef16f3 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..efdfa03 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md new file mode 100644 index 0000000..18eb1e0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md) | | [optional] +**totalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 0000000..f3e62d9 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md new file mode 100644 index 0000000..bff6c28 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..37b8d4f --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..5c5a3c4 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..14cc3de --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 0000000..64b1bae --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..bbc7f11 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md new file mode 100644 index 0000000..3bad01c --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesGetResponseBodyLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [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/LoyaltiesEarningRulesGetResponseBodySegment.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodySegment.md new file mode 100644 index 0000000..898e818 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodySegment.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesGetResponseBodySegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesGetResponseBodySource.md b/docs/Model/LoyaltiesEarningRulesGetResponseBodySource.md new file mode 100644 index 0000000..1464cf6 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesGetResponseBodySource.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesGetResponseBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**objectId** | **string** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**objectType** | **string** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesListResponseBody.md b/docs/Model/LoyaltiesEarningRulesListResponseBody.md new file mode 100644 index 0000000..cc0897c --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about earning rules in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of earning rule objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\EarningRule[]**](EarningRule.md) | Contains array of earning rule objects. | [optional] +**total** | **int** | Total number of earning rule objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateRequestBody.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBody.md new file mode 100644 index 0000000..822da89 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBody.md @@ -0,0 +1,18 @@ +# # LoyaltiesEarningRulesUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**validationRuleId** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyalty**](LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md) | | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodySource**](LoyaltiesEarningRulesUpdateRequestBodySource.md) | | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] +**startDate** | **\DateTime** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] +**expirationDate** | **\DateTime** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md new file mode 100644 index 0000000..6d5840d --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md @@ -0,0 +1,15 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**calculationType** | **string** | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md) | | [optional] +**orderItems** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md new file mode 100644 index 0000000..c8ab9e2 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..007837f --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md new file mode 100644 index 0000000..1b23c52 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..4055e25 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md new file mode 100644 index 0000000..d61e7a1 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md) | | [optional] +**totalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md new file mode 100644 index 0000000..0fd9f03 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md new file mode 100644 index 0000000..efc5dba --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..b42b619 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..d157ae6 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..b24c723 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md new file mode 100644 index 0000000..da29d1d --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..3a48ad4 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateRequestBodySource.md b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodySource.md new file mode 100644 index 0000000..a02ede3 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateRequestBodySource.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesUpdateRequestBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateResponseBody.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBody.md new file mode 100644 index 0000000..ea21535 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBody.md @@ -0,0 +1,27 @@ +# # LoyaltiesEarningRulesUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyalty**](LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md) | | [optional] +**event** | **string** | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyCustomEvent**](LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodySegment**](LoyaltiesEarningRulesUpdateResponseBodySegment.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodySource**](LoyaltiesEarningRulesUpdateResponseBodySource.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automationId** | **string** | For internal use by Voucherify. | [optional] +**startDate** | **string** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expirationDate** | **string** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**validationRuleId** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md new file mode 100644 index 0000000..1e365fb --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schemaId** | **string** | Unique identifier of the custom event schema | [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/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md new file mode 100644 index 0000000..a821061 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md @@ -0,0 +1,15 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**calculationType** | **string** | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md) | | [optional] +**orderItems** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 0000000..5924d5f --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 0000000..c5acf1d --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Custom event metadata property. | [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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md new file mode 100644 index 0000000..f16c396 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 0000000..a81dfa0 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Customer metadata property. | [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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md new file mode 100644 index 0000000..bc59c4a --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md) | | [optional] +**totalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 0000000..2b9af31 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md new file mode 100644 index 0000000..0cb46a9 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotalAmount** | [**\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 0000000..15b49a2 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 0000000..de133b9 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 0000000..5c33a19 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,12 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **string** | Type of object taken under consideration. | [optional] +**id** | **string** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 0000000..7717f40 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**property** | **string** | Order metadata property. | [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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 0000000..6574b72 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,10 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md new file mode 100644 index 0000000..33d3b8e --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [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/LoyaltiesEarningRulesUpdateResponseBodySegment.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodySegment.md new file mode 100644 index 0000000..305c0d8 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodySegment.md @@ -0,0 +1,9 @@ +# # LoyaltiesEarningRulesUpdateResponseBodySegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [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/LoyaltiesEarningRulesUpdateResponseBodySource.md b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodySource.md new file mode 100644 index 0000000..1a891c8 --- /dev/null +++ b/docs/Model/LoyaltiesEarningRulesUpdateResponseBodySource.md @@ -0,0 +1,11 @@ +# # LoyaltiesEarningRulesUpdateResponseBodySource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**objectId** | **string** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**objectType** | **string** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesGetCampaignResponseBody.md b/docs/Model/LoyaltiesGetCampaignResponseBody.md new file mode 100644 index 0000000..166686a --- /dev/null +++ b/docs/Model/LoyaltiesGetCampaignResponseBody.md @@ -0,0 +1,38 @@ +# # LoyaltiesGetCampaignResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**\OpenAPI\Client\Model\LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **string** | Unique category name. | [optional] +**creationStatus** | **string** | Indicates the status of the campaign creation. | [optional] +**vouchersGenerationStatus** | **string** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**accessSettingsAssignments** | [**\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.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/LoyaltiesListCampaignsResponseBody.md b/docs/Model/LoyaltiesListCampaignsResponseBody.md new file mode 100644 index 0000000..c3f57aa --- /dev/null +++ b/docs/Model/LoyaltiesListCampaignsResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesListCampaignsResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about loyalty campaigns in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of loyalty campaign objects. | [optional] [default to 'campaigns'] +**campaigns** | [**\OpenAPI\Client\Model\LoyaltyCampaign[]**](LoyaltyCampaign.md) | Contains an array of loyalty campaign objects. | [optional] +**total** | **int** | Total number of loyalty campaign objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesListMembersResponseBody.md b/docs/Model/LoyaltiesListMembersResponseBody.md new file mode 100644 index 0000000..3e4b62b --- /dev/null +++ b/docs/Model/LoyaltiesListMembersResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesListMembersResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about members in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of voucher objects. | [optional] [default to 'vouchers'] +**vouchers** | [**\OpenAPI\Client\Model\LoyaltyMember[]**](LoyaltyMember.md) | Contains array of voucher objects representing loyalty cards, in other words, loyalty program members. | [optional] +**total** | **int** | Total number of voucher objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesLoyaltyTierReward.md b/docs/Model/LoyaltiesLoyaltyTierReward.md new file mode 100644 index 0000000..79a1feb --- /dev/null +++ b/docs/Model/LoyaltiesLoyaltyTierReward.md @@ -0,0 +1,11 @@ +# # LoyaltiesLoyaltyTierReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reward** | [**\OpenAPI\Client\Model\Reward**](Reward.md) | | +**assignment** | [**\OpenAPI\Client\Model\RewardAssignment**](RewardAssignment.md) | | +**object** | **string** | The type of the object represented by JSON. This object stores information about the loyalty tier reward. | [default to 'loyalty_tier_reward'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMemberActivityListResponseBody.md b/docs/Model/LoyaltiesMemberActivityListResponseBody.md new file mode 100644 index 0000000..446cad6 --- /dev/null +++ b/docs/Model/LoyaltiesMemberActivityListResponseBody.md @@ -0,0 +1,13 @@ +# # LoyaltiesMemberActivityListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about member activities in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of member activity objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\MemberActivity[]**](MemberActivity.md) | Array of member activity objects. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] +**moreStartingAfter** | **string** | Returns an ID that can be used to return another page of results. Use the event id in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersBalanceUpdateRequestBody.md b/docs/Model/LoyaltiesMembersBalanceUpdateRequestBody.md new file mode 100644 index 0000000..f14dd7a --- /dev/null +++ b/docs/Model/LoyaltiesMembersBalanceUpdateRequestBody.md @@ -0,0 +1,13 @@ +# # LoyaltiesMembersBalanceUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Incremental balance to be added to/subtracted from the loyalty card. - To add points: 100 - To subtract points, add a minus: -100 | [optional] +**expirationType** | **string** | | [optional] +**expirationDate** | **\DateTime** | Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`. | [optional] +**reason** | **string** | Reason for the transfer. | [optional] +**sourceId** | **string** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersBalanceUpdateResponseBody.md b/docs/Model/LoyaltiesMembersBalanceUpdateResponseBody.md new file mode 100644 index 0000000..dba46d5 --- /dev/null +++ b/docs/Model/LoyaltiesMembersBalanceUpdateResponseBody.md @@ -0,0 +1,15 @@ +# # LoyaltiesMembersBalanceUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The incremental points removed or added to the current balance on the loyalty card. | [optional] +**total** | **int** | The total of points accrued over the lifetime of the loyalty card. | [optional] +**balance** | **int** | The balance after adding/removing points. | [optional] +**type** | **string** | The type of voucher being modified. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is balance. | [optional] [default to 'balance'] +**relatedObject** | [**\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject**](LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md) | | [optional] +**operationType** | **string** | | [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/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md b/docs/Model/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md new file mode 100644 index 0000000..9a5a5e4 --- /dev/null +++ b/docs/Model/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | The object being modified. | [optional] [default to 'voucher'] +**id** | **string** | Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersCreateRequestBody.md b/docs/Model/LoyaltiesMembersCreateRequestBody.md new file mode 100644 index 0000000..e1f1d28 --- /dev/null +++ b/docs/Model/LoyaltiesMembersCreateRequestBody.md @@ -0,0 +1,13 @@ +# # LoyaltiesMembersCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**voucher** | **string** | Code of voucher being published. | [optional] +**sourceId** | **string** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] +**channel** | **string** | Specify the distribution channel. | [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/LoyaltiesMembersCreateResponseBody.md b/docs/Model/LoyaltiesMembersCreateResponseBody.md new file mode 100644 index 0000000..cc6d7b2 --- /dev/null +++ b/docs/Model/LoyaltiesMembersCreateResponseBody.md @@ -0,0 +1,34 @@ +# # LoyaltiesMembersCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] [default to 'LOYALTY_CARD'] +**discount** | **object** | | [optional] +**gift** | **object** | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyLoyaltyCard**](LoyaltiesMembersCreateResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | This is always false for loyalty members. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique identifier of the customer who owns the voucher. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyPublish**](LoyaltiesMembersCreateResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyRedemption**](LoyaltiesMembersCreateResponseBodyRedemption.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/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md b/docs/Model/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..bf9ca8d --- /dev/null +++ b/docs/Model/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersCreateResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/LoyaltiesMembersCreateResponseBodyPublish.md b/docs/Model/LoyaltiesMembersCreateResponseBodyPublish.md new file mode 100644 index 0000000..f89ce41 --- /dev/null +++ b/docs/Model/LoyaltiesMembersCreateResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # LoyaltiesMembersCreateResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication event counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersCreateResponseBodyRedemption.md b/docs/Model/LoyaltiesMembersCreateResponseBodyRedemption.md new file mode 100644 index 0000000..fe9cb0e --- /dev/null +++ b/docs/Model/LoyaltiesMembersCreateResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # LoyaltiesMembersCreateResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersGetResponseBody.md b/docs/Model/LoyaltiesMembersGetResponseBody.md new file mode 100644 index 0000000..576d1aa --- /dev/null +++ b/docs/Model/LoyaltiesMembersGetResponseBody.md @@ -0,0 +1,34 @@ +# # LoyaltiesMembersGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] [default to 'LOYALTY_CARD'] +**discount** | **object** | | [optional] +**gift** | **object** | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyLoyaltyCard**](LoyaltiesMembersGetResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | This is always false for loyalty members. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique identifier of the customer who owns the voucher. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyPublish**](LoyaltiesMembersGetResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyRedemption**](LoyaltiesMembersGetResponseBodyRedemption.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/LoyaltiesMembersGetResponseBodyLoyaltyCard.md b/docs/Model/LoyaltiesMembersGetResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..49cf244 --- /dev/null +++ b/docs/Model/LoyaltiesMembersGetResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersGetResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/LoyaltiesMembersGetResponseBodyPublish.md b/docs/Model/LoyaltiesMembersGetResponseBodyPublish.md new file mode 100644 index 0000000..88c77fe --- /dev/null +++ b/docs/Model/LoyaltiesMembersGetResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # LoyaltiesMembersGetResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication event counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersGetResponseBodyRedemption.md b/docs/Model/LoyaltiesMembersGetResponseBodyRedemption.md new file mode 100644 index 0000000..694fc9c --- /dev/null +++ b/docs/Model/LoyaltiesMembersGetResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # LoyaltiesMembersGetResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersPointsExpirationListResponseBody.md b/docs/Model/LoyaltiesMembersPointsExpirationListResponseBody.md new file mode 100644 index 0000000..0db2fb1 --- /dev/null +++ b/docs/Model/LoyaltiesMembersPointsExpirationListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersPointsExpirationListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBodyDataItem[]**](LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md) | Contains array of loyalty points expiration buckets. | [optional] +**total** | **int** | Total number of point expiration buckets. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md b/docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md new file mode 100644 index 0000000..db38887 --- /dev/null +++ b/docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md @@ -0,0 +1,17 @@ +# # LoyaltiesMembersPointsExpirationListResponseBodyDataItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique loyalty points bucket ID. | +**voucherId** | **string** | Unique parent loyalty card ID. | +**campaignId** | **string** | Unique parent campaign ID. | +**bucket** | [**\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket**](LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md) | | +**createdAt** | **\DateTime** | Timestamp representing the date and time when the loyalty points bucket object was created. The value is shown in the ISO 8601 format. | +**status** | **string** | Loyalty points bucket point status. | +**expiresAt** | **\DateTime** | Date when the number of points defined in the bucket object are due to expire. | +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the loyalty points bucket object was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the loyalty points bucket. | [default to 'loyalty_points_bucket'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md b/docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md new file mode 100644 index 0000000..3f86c55 --- /dev/null +++ b/docs/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md @@ -0,0 +1,9 @@ +# # LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalPoints** | **int** | Total number of points in the loyalty points bucket. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemRequestBody.md b/docs/Model/LoyaltiesMembersRedemptionRedeemRequestBody.md new file mode 100644 index 0000000..80208dd --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemRequestBody.md @@ -0,0 +1,11 @@ +# # LoyaltiesMembersRedemptionRedeemRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reward** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBodyReward**](LoyaltiesMembersRedemptionRedeemRequestBodyReward.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to check against vouchers requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md b/docs/Model/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md new file mode 100644 index 0000000..fea7dee --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersRedemptionRedeemRequestBodyReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBody.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBody.md new file mode 100644 index 0000000..ca00dc1 --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBody.md @@ -0,0 +1,31 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**object** | **string** | The type of the object represented by the JSON | [optional] [default to 'redemption'] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the redeeming customer. | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. | [optional] +**redemption** | **string** | Unique redemption ID of the parent redemption. | [optional] +**result** | **string** | Redemption result. | [optional] +**status** | **string** | Redemption status. | [optional] +**relatedRedemptions** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md) | | [optional] +**failureCode** | **string** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failureMessage** | **string** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**channel** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyChannel**](LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.md) | | [optional] +**relatedObjectType** | **string** | Defines the related object. | [optional] +**relatedObjectId** | **string** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] +**voucher** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucher**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md) | | [optional] +**promotionTier** | [**\OpenAPI\Client\Model\PromotionTier**](PromotionTier.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyGift**](LoyaltiesMembersRedemptionRedeemResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard**](LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.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/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md new file mode 100644 index 0000000..629eb4c --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyChannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channelId** | **string** | Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] +**channelType** | **string** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md new file mode 100644 index 0000000..2d12c8d --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md @@ -0,0 +1,9 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..d198a89 --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md @@ -0,0 +1,9 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md new file mode 100644 index 0000000..e2f7b97 --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem[]**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem[]**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.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/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 0000000..10a698e --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 0000000..9c7c2ee --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique rollback redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md new file mode 100644 index 0000000..4247650 --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md @@ -0,0 +1,38 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md new file mode 100644 index 0000000..9d426ef --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md @@ -0,0 +1,11 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md new file mode 100644 index 0000000..9ff737c --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md new file mode 100644 index 0000000..f7ff98b --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md @@ -0,0 +1,11 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md new file mode 100644 index 0000000..21faf7f --- /dev/null +++ b/docs/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md @@ -0,0 +1,13 @@ +# # LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRewardsListResponseBody.md b/docs/Model/LoyaltiesMembersRewardsListResponseBody.md new file mode 100644 index 0000000..329f0df --- /dev/null +++ b/docs/Model/LoyaltiesMembersRewardsListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersRewardsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of loyalty reward objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBodyDataItem[]**](LoyaltiesMembersRewardsListResponseBodyDataItem.md) | Contains array of loyalty reward objects. | [optional] +**total** | **int** | Total number of loyalty reward objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersRewardsListResponseBodyDataItem.md b/docs/Model/LoyaltiesMembersRewardsListResponseBodyDataItem.md new file mode 100644 index 0000000..92c023d --- /dev/null +++ b/docs/Model/LoyaltiesMembersRewardsListResponseBodyDataItem.md @@ -0,0 +1,11 @@ +# # LoyaltiesMembersRewardsListResponseBodyDataItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reward** | [**\OpenAPI\Client\Model\Reward**](Reward.md) | | [optional] +**assignment** | [**\OpenAPI\Client\Model\RewardAssignment**](RewardAssignment.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'loyalty_reward'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersTiersListResponseBody.md b/docs/Model/LoyaltiesMembersTiersListResponseBody.md new file mode 100644 index 0000000..c760379 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTiersListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersTiersListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of loyalty tier objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\LoyaltyTier[]**](LoyaltyTier.md) | | [optional] +**total** | **int** | Total number of loyalty tier objects. | [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/LoyaltiesMembersTransactionsExportCreateRequestBody.md b/docs/Model/LoyaltiesMembersTransactionsExportCreateRequestBody.md new file mode 100644 index 0000000..66ff3a5 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransactionsExportCreateRequestBody.md @@ -0,0 +1,9 @@ +# # LoyaltiesMembersTransactionsExportCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBodyParameters**](LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.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/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md b/docs/Model/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md new file mode 100644 index 0000000..1a2bdaa --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md @@ -0,0 +1,11 @@ +# # LoyaltiesMembersTransactionsExportCreateRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**\OpenAPI\Client\Model\ExportVoucherTransactionsFilters**](ExportVoucherTransactionsFilters.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/LoyaltiesMembersTransactionsExportCreateResponseBody.md b/docs/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.md new file mode 100644 index 0000000..86a80de --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.md @@ -0,0 +1,17 @@ +# # LoyaltiesMembersTransactionsExportCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique export ID. | [optional] +**object** | **string** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **string** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] [default to 'SCHEDULED'] +**channel** | **string** | The channel through which the export was triggered. | [optional] +**result** | **object** | Contains the URL of the CSV file. | [optional] +**userId** | **string** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exportedObject** | **string** | The type of object to be exported. | [optional] [default to 'voucher_transactions'] +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBodyParameters**](LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.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/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md b/docs/Model/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md new file mode 100644 index 0000000..e2dab4b --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md @@ -0,0 +1,11 @@ +# # LoyaltiesMembersTransactionsExportCreateResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**\OpenAPI\Client\Model\ExportVoucherTransactionsFilters**](ExportVoucherTransactionsFilters.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/LoyaltiesMembersTransactionsListResponseBody.md b/docs/Model/LoyaltiesMembersTransactionsListResponseBody.md new file mode 100644 index 0000000..c321a77 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransactionsListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersTransactionsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of transaction objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\LoyaltyCardTransaction[]**](LoyaltyCardTransaction.md) | A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the has_more flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [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/LoyaltiesMembersTransfersCreateResponseBody.md b/docs/Model/LoyaltiesMembersTransfersCreateResponseBody.md new file mode 100644 index 0000000..ba6bd42 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransfersCreateResponseBody.md @@ -0,0 +1,32 @@ +# # LoyaltiesMembersTransfersCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] [default to 'LOYALTY_CARD'] +**loyaltyCard** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard**](LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**publish** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyPublish**](LoyaltiesMembersTransfersCreateResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyRedemption**](LoyaltiesMembersTransfersCreateResponseBodyRedemption.md) | | [optional] +**active** | **string** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date. - `true` indicates an active voucher - `false` indicates an inactive voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssets**](LoyaltiesMembersTransfersCreateResponseBodyAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**createdAt** | **\DateTime** | | [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/LoyaltiesMembersTransfersCreateResponseBodyAssets.md b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssets.md new file mode 100644 index 0000000..acad0ed --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssets.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersTransfersCreateResponseBodyAssets + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**qr** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssetsQr**](LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md) | | [optional] +**barcode** | [**\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode**](LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.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/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md new file mode 100644 index 0000000..254db42 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Encrypted voucher code ID. | [optional] +**url** | **string** | URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md new file mode 100644 index 0000000..7dab5d7 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md @@ -0,0 +1,10 @@ +# # LoyaltiesMembersTransfersCreateResponseBodyAssetsQr + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Encrypted voucher code ID. | [optional] +**url** | **string** | URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..3eb41a2 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **string** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/LoyaltiesMembersTransfersCreateResponseBodyPublish.md b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyPublish.md new file mode 100644 index 0000000..4c839b8 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyPublish.md @@ -0,0 +1,12 @@ +# # LoyaltiesMembersTransfersCreateResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**entries** | **string[]** | | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md new file mode 100644 index 0000000..f03eb11 --- /dev/null +++ b/docs/Model/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # LoyaltiesMembersTransfersCreateResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A null value means unlimited. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**object** | **string** | The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBody.md b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBody.md new file mode 100644 index 0000000..fee0da1 --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBody.md @@ -0,0 +1,9 @@ +# # LoyaltiesPointsExpirationExportCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParameters**](LoyaltiesPointsExpirationExportCreateRequestBodyParameters.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/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md new file mode 100644 index 0000000..1b8964c --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md @@ -0,0 +1,11 @@ +# # LoyaltiesPointsExpirationExportCreateRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] +**fields** | **string[]** | Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | | [optional] +**filters** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md new file mode 100644 index 0000000..918e09d --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md @@ -0,0 +1,11 @@ +# # LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**voucherId** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md) | | [optional] +**campaignId** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md new file mode 100644 index 0000000..0f2302c --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md @@ -0,0 +1,9 @@ +# # LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md new file mode 100644 index 0000000..b4fc01e --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md @@ -0,0 +1,12 @@ +# # LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of the resource values that should be included in the results. | [optional] +**notIn** | **string[]** | Array of the resource values that should be included in the results. | [optional] +**is** | **string** | Specify the exact resource value. | [optional] +**isNot** | **string** | Results should omit this value. | [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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md new file mode 100644 index 0000000..f649a03 --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md @@ -0,0 +1,9 @@ +# # LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md new file mode 100644 index 0000000..9abd5ad --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md @@ -0,0 +1,12 @@ +# # LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of the resource values that should be included in the results. | [optional] +**notIn** | **string[]** | Array of the resource values that should be included in the results. | [optional] +**is** | **string** | Specify the exact resource value. | [optional] +**isNot** | **string** | Results should omit this value. | [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/LoyaltiesPointsExpirationExportCreateResponseBody.md b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBody.md new file mode 100644 index 0000000..6b8551b --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBody.md @@ -0,0 +1,17 @@ +# # LoyaltiesPointsExpirationExportCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique export ID. | [optional] +**object** | **string** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **string** | Status of the export. Informs you whether the export has already been completed. | [optional] [default to 'SCHEDULED'] +**channel** | **string** | The channel through which the export was triggered. | [optional] +**exportedObject** | **string** | The type of exported object. | [optional] [default to 'points_expiration'] +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParameters**](LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md) | | [optional] +**result** | **object** | Always null. | [optional] +**userId** | **string** | `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard. `user_id` is returned when the channel value is `WEBSITE`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md new file mode 100644 index 0000000..a7e484f --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md @@ -0,0 +1,11 @@ +# # LoyaltiesPointsExpirationExportCreateResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] +**fields** | **string[]** | Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | | [optional] +**filters** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md new file mode 100644 index 0000000..25c7e15 --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md @@ -0,0 +1,11 @@ +# # LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**voucherId** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md) | | [optional] +**campaignId** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md new file mode 100644 index 0000000..e71bf58 --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md @@ -0,0 +1,9 @@ +# # LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md new file mode 100644 index 0000000..baa43bb --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md @@ -0,0 +1,12 @@ +# # LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of the resource values that should be included in the results. | [optional] +**notIn** | **string[]** | Array of the resource values that should be included in the results. | [optional] +**is** | **string** | Specify the exact resource value. | [optional] +**isNot** | **string** | Results should omit this value. | [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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md new file mode 100644 index 0000000..93d09de --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md @@ -0,0 +1,9 @@ +# # LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md new file mode 100644 index 0000000..15f800c --- /dev/null +++ b/docs/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md @@ -0,0 +1,12 @@ +# # LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of the resource values that should be included in the results. | [optional] +**notIn** | **string[]** | Array of the resource values that should be excluded from the results. | [optional] +**is** | **string** | Specify the exact resource value. | [optional] +**isNot** | **string** | Results should omit this value. | [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/LoyaltiesRewardAssignmentsGetResponseBody.md b/docs/Model/LoyaltiesRewardAssignmentsGetResponseBody.md new file mode 100644 index 0000000..6129c73 --- /dev/null +++ b/docs/Model/LoyaltiesRewardAssignmentsGetResponseBody.md @@ -0,0 +1,16 @@ +# # LoyaltiesRewardAssignmentsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**rewardId** | **string** | Associated reward ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**relatedObjectId** | **string** | Related object ID to which the reward was assigned. | [optional] +**relatedObjectType** | **string** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBodyParameters**](LoyaltiesRewardAssignmentsGetResponseBodyParameters.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/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md b/docs/Model/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md new file mode 100644 index 0000000..dc320f3 --- /dev/null +++ b/docs/Model/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardAssignmentsGetResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty**](LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.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/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md b/docs/Model/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md new file mode 100644 index 0000000..9610b03 --- /dev/null +++ b/docs/Model/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [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/LoyaltiesRewardAssignmentsListResponseBody.md b/docs/Model/LoyaltiesRewardAssignmentsListResponseBody.md new file mode 100644 index 0000000..3abd29e --- /dev/null +++ b/docs/Model/LoyaltiesRewardAssignmentsListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesRewardAssignmentsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of reward assignment objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\RewardAssignment[]**](RewardAssignment.md) | Contains array of reward assignment objects. | [optional] +**total** | **int** | Total number of reward assignment objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.md b/docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.md new file mode 100644 index 0000000..5abe328 --- /dev/null +++ b/docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.md @@ -0,0 +1,19 @@ +# # LoyaltiesRewardAssignmentsRewardGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID, assigned by Voucherify. | [optional] +**name** | **string** | Reward name. | [optional] +**stock** | **int** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] +**redeemed** | **int** | Defines the number of already invoked (successful) reward redemptions. | [optional] +**attributes** | [**\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes**](LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. | [optional] +**type** | **string** | Reward type. | [optional] +**parameters** | [**\OpenAPI\Client\Model\RewardType**](RewardType.md) | | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md b/docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md new file mode 100644 index 0000000..e8113b9 --- /dev/null +++ b/docs/Model/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md @@ -0,0 +1,10 @@ +# # LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file. | [optional] +**description** | **string** | An arbitrary string that you can attach to a material reward. | [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/LoyaltiesRewardsCreateAssignmentItemRequestBody.md b/docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBody.md new file mode 100644 index 0000000..bbcaed7 --- /dev/null +++ b/docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBody.md @@ -0,0 +1,11 @@ +# # LoyaltiesRewardsCreateAssignmentItemRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reward** | **string** | The ID of the reward that will be assigned to the campaign. | [optional] +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters**](LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md) | | [optional] +**validationRules** | **string[]** | | [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/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md b/docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md new file mode 100644 index 0000000..ecef28e --- /dev/null +++ b/docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty**](LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.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/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md b/docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md new file mode 100644 index 0000000..b3e173f --- /dev/null +++ b/docs/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesRewardsCreateAssignmentResponseBody.md b/docs/Model/LoyaltiesRewardsCreateAssignmentResponseBody.md new file mode 100644 index 0000000..5bdff37 --- /dev/null +++ b/docs/Model/LoyaltiesRewardsCreateAssignmentResponseBody.md @@ -0,0 +1,16 @@ +# # LoyaltiesRewardsCreateAssignmentResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**rewardId** | **string** | Associated reward ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**relatedObjectId** | **string** | Related object ID to which the reward was assigned. | [optional] +**relatedObjectType** | **string** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBodyParameters**](LoyaltiesRewardsCreateAssignmentResponseBodyParameters.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/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md b/docs/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md new file mode 100644 index 0000000..d9405ae --- /dev/null +++ b/docs/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsCreateAssignmentResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty**](LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.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/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md b/docs/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md new file mode 100644 index 0000000..72ae837 --- /dev/null +++ b/docs/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [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/LoyaltiesRewardsGetResponseBody.md b/docs/Model/LoyaltiesRewardsGetResponseBody.md new file mode 100644 index 0000000..d258e9c --- /dev/null +++ b/docs/Model/LoyaltiesRewardsGetResponseBody.md @@ -0,0 +1,16 @@ +# # LoyaltiesRewardsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**rewardId** | **string** | Associated reward ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**relatedObjectId** | **string** | Related object ID to which the reward was assigned. | [optional] +**relatedObjectType** | **string** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBodyParameters**](LoyaltiesRewardsGetResponseBodyParameters.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/LoyaltiesRewardsGetResponseBodyParameters.md b/docs/Model/LoyaltiesRewardsGetResponseBodyParameters.md new file mode 100644 index 0000000..82b8176 --- /dev/null +++ b/docs/Model/LoyaltiesRewardsGetResponseBodyParameters.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsGetResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBodyParametersLoyalty**](LoyaltiesRewardsGetResponseBodyParametersLoyalty.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/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md b/docs/Model/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md new file mode 100644 index 0000000..610b0af --- /dev/null +++ b/docs/Model/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsGetResponseBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [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/LoyaltiesRewardsListAssignmentsResponseBody.md b/docs/Model/LoyaltiesRewardsListAssignmentsResponseBody.md new file mode 100644 index 0000000..4d8653e --- /dev/null +++ b/docs/Model/LoyaltiesRewardsListAssignmentsResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesRewardsListAssignmentsResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of reward assignment objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\RewardAssignment[]**](RewardAssignment.md) | Contains array of reward assignment objects. | [optional] +**total** | **int** | Total number of reward assignment objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBody.md b/docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBody.md new file mode 100644 index 0000000..66417f6 --- /dev/null +++ b/docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBody.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsUpdateAssignmentRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBodyParameters**](LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.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/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md b/docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md new file mode 100644 index 0000000..b4ff764 --- /dev/null +++ b/docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsUpdateAssignmentRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty**](LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.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/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md b/docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md new file mode 100644 index 0000000..09b153a --- /dev/null +++ b/docs/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Defines how many points are required to obtain the reward. | [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/LoyaltiesRewardsUpdateAssignmentResponseBody.md b/docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBody.md new file mode 100644 index 0000000..0eae675 --- /dev/null +++ b/docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBody.md @@ -0,0 +1,16 @@ +# # LoyaltiesRewardsUpdateAssignmentResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**rewardId** | **string** | Associated reward ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**relatedObjectId** | **string** | Related object ID to which the reward was assigned. | [optional] +**relatedObjectType** | **string** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBodyParameters**](LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.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/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md b/docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md new file mode 100644 index 0000000..9af3af0 --- /dev/null +++ b/docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsUpdateAssignmentResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty**](LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.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/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md b/docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md new file mode 100644 index 0000000..1ea5eaa --- /dev/null +++ b/docs/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [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/LoyaltiesTiersCreateInBulkRequestBodyItem.md b/docs/Model/LoyaltiesTiersCreateInBulkRequestBodyItem.md new file mode 100644 index 0000000..cbd940b --- /dev/null +++ b/docs/Model/LoyaltiesTiersCreateInBulkRequestBodyItem.md @@ -0,0 +1,13 @@ +# # LoyaltiesTiersCreateInBulkRequestBodyItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Loyalty Tier name. | [optional] +**earningRules** | [**array**](MappingPoints.md) | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] +**rewards** | [**array**](MappingPoints.md) | Contains a list of reward IDs and their points mapping for the given reward. | [optional] +**points** | [**\OpenAPI\Client\Model\LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesTiersEarningRulesListResponseBody.md b/docs/Model/LoyaltiesTiersEarningRulesListResponseBody.md new file mode 100644 index 0000000..94240dd --- /dev/null +++ b/docs/Model/LoyaltiesTiersEarningRulesListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesTiersEarningRulesListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about earning rules in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of earning rule objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\EarningRule[]**](EarningRule.md) | Contains array of earning rule objects. | [optional] +**total** | **int** | Total number of earning rule objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesTiersGetResponseBody.md b/docs/Model/LoyaltiesTiersGetResponseBody.md new file mode 100644 index 0000000..c764143 --- /dev/null +++ b/docs/Model/LoyaltiesTiersGetResponseBody.md @@ -0,0 +1,20 @@ +# # LoyaltiesTiersGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Loyalty Tier name. | [optional] +**earningRules** | [**array**](MappingPoints.md) | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] +**rewards** | [**array**](MappingPoints.md) | Contains a list of reward IDs and their points mapping for the given reward. | [optional] +**points** | [**\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyPoints**](LoyaltiesTiersGetResponseBodyPoints.md) | | [optional] +**id** | **string** | Unique loyalty tier ID. | [optional] +**campaignId** | **string** | Unique parent campaign ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] +**config** | [**\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyConfig**](LoyaltiesTiersGetResponseBodyConfig.md) | | [optional] +**expiration** | [**\OpenAPI\Client\Model\LoyaltyTierExpiration**](LoyaltyTierExpiration.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the loyalty. | [optional] [default to 'loyalty_tier'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesTiersGetResponseBodyConfig.md b/docs/Model/LoyaltiesTiersGetResponseBodyConfig.md new file mode 100644 index 0000000..97ebf63 --- /dev/null +++ b/docs/Model/LoyaltiesTiersGetResponseBodyConfig.md @@ -0,0 +1,9 @@ +# # LoyaltiesTiersGetResponseBodyConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | [**\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyConfigPoints**](LoyaltiesTiersGetResponseBodyConfigPoints.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/LoyaltiesTiersGetResponseBodyConfigPoints.md b/docs/Model/LoyaltiesTiersGetResponseBodyConfigPoints.md new file mode 100644 index 0000000..5935548 --- /dev/null +++ b/docs/Model/LoyaltiesTiersGetResponseBodyConfigPoints.md @@ -0,0 +1,10 @@ +# # LoyaltiesTiersGetResponseBodyConfigPoints + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [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/LoyaltiesTiersGetResponseBodyPoints.md b/docs/Model/LoyaltiesTiersGetResponseBodyPoints.md new file mode 100644 index 0000000..d440108 --- /dev/null +++ b/docs/Model/LoyaltiesTiersGetResponseBodyPoints.md @@ -0,0 +1,10 @@ +# # LoyaltiesTiersGetResponseBodyPoints + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [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/LoyaltiesTiersListResponseBody.md b/docs/Model/LoyaltiesTiersListResponseBody.md new file mode 100644 index 0000000..700668c --- /dev/null +++ b/docs/Model/LoyaltiesTiersListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesTiersListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of loyalty tier objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\LoyaltyTier[]**](LoyaltyTier.md) | This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer's tiers. | [optional] +**total** | **int** | Total number of loyalty tier objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesTiersRewardsListResponseBody.md b/docs/Model/LoyaltiesTiersRewardsListResponseBody.md new file mode 100644 index 0000000..6dfd58d --- /dev/null +++ b/docs/Model/LoyaltiesTiersRewardsListResponseBody.md @@ -0,0 +1,12 @@ +# # LoyaltiesTiersRewardsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about loyalty tier rewards in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of loyalty tier reward objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\LoyaltiesLoyaltyTierReward[]**](LoyaltiesLoyaltyTierReward.md) | Contains array of loyalty tier reward objects. | [optional] +**total** | **int** | Total number of loyalty tier reward objects. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesTransferPoints.md b/docs/Model/LoyaltiesTransferPoints.md new file mode 100644 index 0000000..8d313a9 --- /dev/null +++ b/docs/Model/LoyaltiesTransferPoints.md @@ -0,0 +1,12 @@ +# # LoyaltiesTransferPoints + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Unique loyalty card code from which the user wants to transfer loyalty points (source). | [optional] +**points** | **int** | The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source). | [optional] +**reason** | **string** | Reason for the transfer. | [optional] +**sourceId** | **string** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltiesUpdateCampaignRequestBody.md b/docs/Model/LoyaltiesUpdateCampaignRequestBody.md new file mode 100644 index 0000000..9243336 --- /dev/null +++ b/docs/Model/LoyaltiesUpdateCampaignRequestBody.md @@ -0,0 +1,24 @@ +# # LoyaltiesUpdateCampaignRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**category** | **string** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**unsetMetadataFields** | **string[]** | Determine which metadata should be removed from campaign. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**options** | [**\OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBodyOptions**](LoyaltiesUpdateCampaignRequestBodyOptions.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/LoyaltiesUpdateCampaignRequestBodyOptions.md b/docs/Model/LoyaltiesUpdateCampaignRequestBodyOptions.md new file mode 100644 index 0000000..d9676ee --- /dev/null +++ b/docs/Model/LoyaltiesUpdateCampaignRequestBodyOptions.md @@ -0,0 +1,9 @@ +# # LoyaltiesUpdateCampaignRequestBodyOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**recalculateTiers** | **bool** | Determine if tiers should be recalculated or no. | [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/LoyaltiesUpdateCampaignResponseBody.md b/docs/Model/LoyaltiesUpdateCampaignResponseBody.md new file mode 100644 index 0000000..a016567 --- /dev/null +++ b/docs/Model/LoyaltiesUpdateCampaignResponseBody.md @@ -0,0 +1,38 @@ +# # LoyaltiesUpdateCampaignResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**\OpenAPI\Client\Model\LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **string** | Unique category name. | [optional] +**creationStatus** | **string** | Indicates the status of the campaign creation. | [optional] +**vouchersGenerationStatus** | **string** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**accessSettingsAssignments** | [**\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.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/LoyaltyCampaign.md b/docs/Model/LoyaltyCampaign.md new file mode 100644 index 0000000..cc93f17 --- /dev/null +++ b/docs/Model/LoyaltyCampaign.md @@ -0,0 +1,38 @@ +# # LoyaltyCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **string** | Campaign name. | [optional] +**description** | **string** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaignType** | **string** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**type** | **string** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**\OpenAPI\Client\Model\LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] +**autoJoin** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**joinOnce** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**useVoucherMetadataSchema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**activityDurationAfterPublishing** | **string** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] +**vouchersCount** | **int** | Total number of unique vouchers in campaign. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **string** | Unique category name. | [optional] +**creationStatus** | **string** | Indicates the status of the campaign creation. | [optional] +**vouchersGenerationStatus** | **string** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**loyaltyTiersExpiration** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**accessSettingsAssignments** | [**\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.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/LoyaltyCampaignVoucher.md b/docs/Model/LoyaltyCampaignVoucher.md new file mode 100644 index 0000000..0570a99 --- /dev/null +++ b/docs/Model/LoyaltyCampaignVoucher.md @@ -0,0 +1,18 @@ +# # LoyaltyCampaignVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of voucher. | [optional] [default to 'LOYALTY_CARD'] +**loyaltyCard** | [**\OpenAPI\Client\Model\CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\LoyaltyCampaignVoucherRedemption**](LoyaltyCampaignVoucherRedemption.md) | | [optional] +**codeConfig** | [**\OpenAPI\Client\Model\CodeConfig**](CodeConfig.md) | | +**isReferralCode** | **bool** | Always `false` for a loyalty card voucher | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.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/LoyaltyCampaignVoucherRedemption.md b/docs/Model/LoyaltyCampaignVoucherRedemption.md new file mode 100644 index 0000000..5d009c0 --- /dev/null +++ b/docs/Model/LoyaltyCampaignVoucherRedemption.md @@ -0,0 +1,9 @@ +# # LoyaltyCampaignVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyCardTransaction.md b/docs/Model/LoyaltyCardTransaction.md new file mode 100644 index 0000000..ad9cf63 --- /dev/null +++ b/docs/Model/LoyaltyCardTransaction.md @@ -0,0 +1,18 @@ +# # LoyaltyCardTransaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique transaction ID. | [optional] +**sourceId** | **string** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. | [optional] +**voucherId** | **string** | Unique voucher ID. | [optional] +**campaignId** | **string** | Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. | [optional] +**source** | **string** | The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. | [optional] +**reason** | **string** | Reason why the transaction occurred. In case of a redemption, this value is null. | [optional] +**type** | **string** | | [optional] +**details** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetails**](LoyaltyCardTransactionDetails.md) | | [optional] +**relatedTransactionId** | **string** | The related transaction ID on the receiving card. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyCardTransactionDetails.md b/docs/Model/LoyaltyCardTransactionDetails.md new file mode 100644 index 0000000..0b9106d --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetails.md @@ -0,0 +1,21 @@ +# # LoyaltyCardTransactionDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balance** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsBalance**](LoyaltyCardTransactionDetailsBalance.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsOrder**](LoyaltyCardTransactionDetailsOrder.md) | | [optional] +**event** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEvent**](LoyaltyCardTransactionDetailsEvent.md) | | [optional] +**earningRule** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEarningRule**](LoyaltyCardTransactionDetailsEarningRule.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsSegment**](LoyaltyCardTransactionDetailsSegment.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsLoyaltyTier**](LoyaltyCardTransactionDetailsLoyaltyTier.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsRedemption**](LoyaltyCardTransactionDetailsRedemption.md) | | [optional] +**rollback** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsRollback**](LoyaltyCardTransactionDetailsRollback.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsCustomEvent**](LoyaltyCardTransactionDetailsCustomEvent.md) | | [optional] +**eventSchema** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEventSchema**](LoyaltyCardTransactionDetailsEventSchema.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsReward**](LoyaltyCardTransactionDetailsReward.md) | | [optional] +**sourceVoucher** | [**\OpenAPI\Client\Model\SimpleVoucher**](SimpleVoucher.md) | | [optional] +**destinationVoucher** | [**\OpenAPI\Client\Model\SimpleVoucher**](SimpleVoucher.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/LoyaltyCardTransactionDetailsBalance.md b/docs/Model/LoyaltyCardTransactionDetailsBalance.md new file mode 100644 index 0000000..5beef38 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsBalance.md @@ -0,0 +1,14 @@ +# # LoyaltyCardTransactionDetailsBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | The type of voucher whose balance is being adjusted due to the transaction. | [optional] [default to 'loyalty_card'] +**total** | **int** | The number of all points accumulated on the card as affected by add or subtract operations. | [optional] +**object** | **string** | The type of the object represented by the JSON. | [optional] [default to 'balance'] +**points** | **int** | Points added or subtracted in the transaction. | [optional] +**balance** | **int** | The available points on the card after the transaction as affected by redemption or rollback. | [optional] +**relatedObject** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsBalanceRelatedObject**](LoyaltyCardTransactionDetailsBalanceRelatedObject.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/LoyaltyCardTransactionDetailsBalanceRelatedObject.md b/docs/Model/LoyaltyCardTransactionDetailsBalanceRelatedObject.md new file mode 100644 index 0000000..b824401 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsBalanceRelatedObject.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsBalanceRelatedObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] +**type** | **string** | The object being modified, i.e. voucher. | [optional] [default to 'voucher'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyCardTransactionDetailsCustomEvent.md b/docs/Model/LoyaltyCardTransactionDetailsCustomEvent.md new file mode 100644 index 0000000..7066fa5 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsCustomEvent.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique event ID. | [optional] +**type** | **string** | Type of custom event. | [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/LoyaltyCardTransactionDetailsEarningRule.md b/docs/Model/LoyaltyCardTransactionDetailsEarningRule.md new file mode 100644 index 0000000..fc980e4 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsEarningRule.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsEarningRule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique earning rule ID. | [optional] +**source** | [**\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEarningRuleSource**](LoyaltyCardTransactionDetailsEarningRuleSource.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/LoyaltyCardTransactionDetailsEarningRuleSource.md b/docs/Model/LoyaltyCardTransactionDetailsEarningRuleSource.md new file mode 100644 index 0000000..a857e84 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsEarningRuleSource.md @@ -0,0 +1,9 @@ +# # LoyaltyCardTransactionDetailsEarningRuleSource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyCardTransactionDetailsEvent.md b/docs/Model/LoyaltyCardTransactionDetailsEvent.md new file mode 100644 index 0000000..40c1de7 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsEvent.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique event ID. | [optional] +**type** | **string** | Type of event. | [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/LoyaltyCardTransactionDetailsEventSchema.md b/docs/Model/LoyaltyCardTransactionDetailsEventSchema.md new file mode 100644 index 0000000..6da780f --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsEventSchema.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsEventSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique metadata schema ID. | [optional] +**name** | **string** | Type of custom event. | [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/LoyaltyCardTransactionDetailsLoyaltyTier.md b/docs/Model/LoyaltyCardTransactionDetailsLoyaltyTier.md new file mode 100644 index 0000000..9dce8fa --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsLoyaltyTier.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**name** | **string** | | [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/LoyaltyCardTransactionDetailsOrder.md b/docs/Model/LoyaltyCardTransactionDetailsOrder.md new file mode 100644 index 0000000..828d81e --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsOrder.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique order ID. | [optional] +**sourceId** | **string** | The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyCardTransactionDetailsRedemption.md b/docs/Model/LoyaltyCardTransactionDetailsRedemption.md new file mode 100644 index 0000000..c363592 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsRedemption.md @@ -0,0 +1,9 @@ +# # LoyaltyCardTransactionDetailsRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [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/LoyaltyCardTransactionDetailsReward.md b/docs/Model/LoyaltyCardTransactionDetailsReward.md new file mode 100644 index 0000000..4a9d080 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsReward.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID. | [optional] +**name** | **string** | Reward name. | [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/LoyaltyCardTransactionDetailsRollback.md b/docs/Model/LoyaltyCardTransactionDetailsRollback.md new file mode 100644 index 0000000..f7db937 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsRollback.md @@ -0,0 +1,9 @@ +# # LoyaltyCardTransactionDetailsRollback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption rollback ID. | [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/LoyaltyCardTransactionDetailsSegment.md b/docs/Model/LoyaltyCardTransactionDetailsSegment.md new file mode 100644 index 0000000..5e33aa9 --- /dev/null +++ b/docs/Model/LoyaltyCardTransactionDetailsSegment.md @@ -0,0 +1,10 @@ +# # LoyaltyCardTransactionDetailsSegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**name** | **string** | | [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/LoyaltyMember.md b/docs/Model/LoyaltyMember.md new file mode 100644 index 0000000..01280cd --- /dev/null +++ b/docs/Model/LoyaltyMember.md @@ -0,0 +1,34 @@ +# # LoyaltyMember + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] [default to 'LOYALTY_CARD'] +**discount** | **object** | | [optional] +**gift** | **object** | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\LoyaltyMemberLoyaltyCard**](LoyaltyMemberLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | This is always false for loyalty members. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique identifier of the customer who owns the voucher. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\LoyaltyMemberPublish**](LoyaltyMemberPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\LoyaltyMemberRedemption**](LoyaltyMemberRedemption.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/LoyaltyMemberLoyaltyCard.md b/docs/Model/LoyaltyMemberLoyaltyCard.md new file mode 100644 index 0000000..a6e76b1 --- /dev/null +++ b/docs/Model/LoyaltyMemberLoyaltyCard.md @@ -0,0 +1,12 @@ +# # LoyaltyMemberLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/LoyaltyMemberPublish.md b/docs/Model/LoyaltyMemberPublish.md new file mode 100644 index 0000000..b5c88dd --- /dev/null +++ b/docs/Model/LoyaltyMemberPublish.md @@ -0,0 +1,11 @@ +# # LoyaltyMemberPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication event counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyMemberRedemption.md b/docs/Model/LoyaltyMemberRedemption.md new file mode 100644 index 0000000..7e91ed5 --- /dev/null +++ b/docs/Model/LoyaltyMemberRedemption.md @@ -0,0 +1,13 @@ +# # LoyaltyMemberRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyTier.md b/docs/Model/LoyaltyTier.md new file mode 100644 index 0000000..1d19000 --- /dev/null +++ b/docs/Model/LoyaltyTier.md @@ -0,0 +1,20 @@ +# # LoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Loyalty Tier name. | [optional] +**earningRules** | [**array**](MappingPoints.md) | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] +**rewards** | [**array**](MappingPoints.md) | Contains a list of reward IDs and their points mapping for the given reward. | [optional] +**points** | [**\OpenAPI\Client\Model\LoyaltyTierPoints**](LoyaltyTierPoints.md) | | [optional] +**id** | **string** | Unique loyalty tier ID. | [optional] +**campaignId** | **string** | Unique parent campaign ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] +**config** | [**\OpenAPI\Client\Model\LoyaltyTierConfig**](LoyaltyTierConfig.md) | | [optional] +**expiration** | [**\OpenAPI\Client\Model\LoyaltyTierExpiration**](LoyaltyTierExpiration.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the loyalty. | [optional] [default to 'loyalty_tier'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyTierBase.md b/docs/Model/LoyaltyTierBase.md new file mode 100644 index 0000000..36fbdc2 --- /dev/null +++ b/docs/Model/LoyaltyTierBase.md @@ -0,0 +1,12 @@ +# # LoyaltyTierBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Loyalty Tier name. | [optional] +**earningRules** | [**array**](MappingPoints.md) | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] +**rewards** | [**array**](MappingPoints.md) | Contains a list of reward IDs and their points mapping for the given reward. | [optional] +**points** | [**\OpenAPI\Client\Model\LoyaltyTierBasePoints**](LoyaltyTierBasePoints.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/LoyaltyTierBasePoints.md b/docs/Model/LoyaltyTierBasePoints.md new file mode 100644 index 0000000..f51a79a --- /dev/null +++ b/docs/Model/LoyaltyTierBasePoints.md @@ -0,0 +1,10 @@ +# # LoyaltyTierBasePoints + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [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/LoyaltyTierConfig.md b/docs/Model/LoyaltyTierConfig.md new file mode 100644 index 0000000..176f9ef --- /dev/null +++ b/docs/Model/LoyaltyTierConfig.md @@ -0,0 +1,9 @@ +# # LoyaltyTierConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | [**\OpenAPI\Client\Model\LoyaltyTierConfigPoints**](LoyaltyTierConfigPoints.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/LoyaltyTierConfigPoints.md b/docs/Model/LoyaltyTierConfigPoints.md new file mode 100644 index 0000000..a52c70b --- /dev/null +++ b/docs/Model/LoyaltyTierConfigPoints.md @@ -0,0 +1,10 @@ +# # LoyaltyTierConfigPoints + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [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/LoyaltyTierExpiration.md b/docs/Model/LoyaltyTierExpiration.md new file mode 100644 index 0000000..8955ca5 --- /dev/null +++ b/docs/Model/LoyaltyTierExpiration.md @@ -0,0 +1,15 @@ +# # LoyaltyTierExpiration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customerId** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**campaignId** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**tierId** | **string** | Unique tier ID, assigned by Voucherify. | [optional] +**startDate** | **string** | Activation timestamp defines when the loyalty tier starts to be active in ISO 8601 format. Loyalty tier is inactive before this date. | [optional] +**expirationDate** | **string** | Expiration timestamp defines when the loyalty tier expires in ISO 8601 format. Loyalty tier is inactive after this date. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyTierPoints.md b/docs/Model/LoyaltyTierPoints.md new file mode 100644 index 0000000..6318da0 --- /dev/null +++ b/docs/Model/LoyaltyTierPoints.md @@ -0,0 +1,10 @@ +# # LoyaltyTierPoints + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [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/LoyaltyTiersExpirationAll.md b/docs/Model/LoyaltyTiersExpirationAll.md new file mode 100644 index 0000000..47a0dbb --- /dev/null +++ b/docs/Model/LoyaltyTiersExpirationAll.md @@ -0,0 +1,12 @@ +# # LoyaltyTiersExpirationAll + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**qualificationType** | **string** | Tier qualification. `BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier. `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold. | [optional] +**qualificationPeriod** | **string** | Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. | **Period** | **Definition** | |:---|:---| | **Calendar Month** | Points collected in one calendar month<br>January, February, March, etc. | | **Calendar Quarter** | Points collected in the quarter<br>- January - March<br>- April - June<br>- July - September<br>- October - December | | **Calendar Half-year** | Points collected in the half-year<br>- January - June<br>- July - December | | **Calendar Year** | Points collected in one calendar year<br>January - December | | [optional] +**startDate** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAllStartDate**](LoyaltyTiersExpirationAllStartDate.md) | | [optional] +**expirationDate** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAllExpirationDate**](LoyaltyTiersExpirationAllExpirationDate.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/LoyaltyTiersExpirationAllExpirationDate.md b/docs/Model/LoyaltyTiersExpirationAllExpirationDate.md new file mode 100644 index 0000000..79cac73 --- /dev/null +++ b/docs/Model/LoyaltyTiersExpirationAllExpirationDate.md @@ -0,0 +1,11 @@ +# # LoyaltyTiersExpirationAllExpirationDate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | What triggers the tier to expire for a customer. `END_OF_PERIOD`: Expire tier at the end of the period. `END_OF_NEXT_PERIOD`: Expire tier at the end of the next period. `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier. | [optional] +**extend** | **string** | Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day. | [optional] +**rounding** | [**\OpenAPI\Client\Model\LoyaltyTiersExpirationAllExpirationDateRounding**](LoyaltyTiersExpirationAllExpirationDateRounding.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/LoyaltyTiersExpirationAllExpirationDateRounding.md b/docs/Model/LoyaltyTiersExpirationAllExpirationDateRounding.md new file mode 100644 index 0000000..a20a77e --- /dev/null +++ b/docs/Model/LoyaltyTiersExpirationAllExpirationDateRounding.md @@ -0,0 +1,12 @@ +# # LoyaltyTiersExpirationAllExpirationDateRounding + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | This mechanism describes a custom rounding for the expiration date. | [optional] +**strategy** | **string** | This mechanism describes a rounding strategy for the expiration date. | [optional] +**unit** | **string** | Defines the type of unit of time in which the rounding period is counted. | [optional] [default to 'MONTH'] +**value** | **int** | Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. - `0`: January - `1`: February - `2`: March - `3`: April - `4`: May - `5`: June - `6`: July - `7`: August - `8`: September - `9`: October - `10`: November - `11`: December | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LoyaltyTiersExpirationAllStartDate.md b/docs/Model/LoyaltyTiersExpirationAllStartDate.md new file mode 100644 index 0000000..f9c52cb --- /dev/null +++ b/docs/Model/LoyaltyTiersExpirationAllStartDate.md @@ -0,0 +1,9 @@ +# # LoyaltyTiersExpirationAllStartDate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | What triggers the tier to be valid for a customer. `IMMEDIATE`: After reaching the minimum required points. `NEXT_PERIOD`: When the next qualification period starts. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LuckyDraw.md b/docs/Model/LuckyDraw.md new file mode 100644 index 0000000..1fe05b2 --- /dev/null +++ b/docs/Model/LuckyDraw.md @@ -0,0 +1,11 @@ +# # LuckyDraw + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**winnersCount** | **string** | It represents the total number of winners in a lucky draw. | [optional] +**uniqueWinnersPerDraw** | **string** | It indicates whether each winner in a draw is unique or not. | [optional] +**uniqueWinners** | **string** | Specifies whether each participant can win only once across multiple draws. | [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/MappingPoints.md b/docs/Model/MappingPoints.md new file mode 100644 index 0000000..d67aae4 --- /dev/null +++ b/docs/Model/MappingPoints.md @@ -0,0 +1,11 @@ +# # MappingPoints + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**multiplier** | **float** | Multiplication factor used to multiply the points to obtain the mapped points. | [optional] +**points** | **int** | Fixed number of points to be applied. | [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/MemberActivity.md b/docs/Model/MemberActivity.md new file mode 100644 index 0000000..0ca493f --- /dev/null +++ b/docs/Model/MemberActivity.md @@ -0,0 +1,13 @@ +# # MemberActivity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique event ID, assigned by Voucherify. | [optional] +**type** | **string** | Event type. | [optional] +**data** | **object** | Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the member activity occurred in ISO 8601 format. | [optional] +**groupId** | **string** | Unique identifier of the request that caused the event. | [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/Order.md b/docs/Model/Order.md new file mode 100644 index 0000000..f07a5f4 --- /dev/null +++ b/docs/Model/Order.md @@ -0,0 +1,16 @@ +# # Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItem[]**](OrderItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCalculated.md b/docs/Model/OrderCalculated.md new file mode 100644 index 0000000..01b6421 --- /dev/null +++ b/docs/Model/OrderCalculated.md @@ -0,0 +1,30 @@ +# # OrderCalculated + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**itemsDiscountAmount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**totalDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**totalAmount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**appliedDiscountAmount** | **int** | This field shows the order-level discount applied. | [optional] +**itemsAppliedDiscountAmount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**totalAppliedDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**\OpenAPI\Client\Model\OrderCalculatedItem[]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | [**array**](OrderRedemptionsEntry.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/OrderCalculatedCustomer.md b/docs/Model/OrderCalculatedCustomer.md new file mode 100644 index 0000000..75fa7f2 --- /dev/null +++ b/docs/Model/OrderCalculatedCustomer.md @@ -0,0 +1,18 @@ +# # OrderCalculatedCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**source_id** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\OrderCalculatedCustomerAddress**](OrderCalculatedCustomerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCalculatedCustomerAddress.md b/docs/Model/OrderCalculatedCustomerAddress.md new file mode 100644 index 0000000..69bc79d --- /dev/null +++ b/docs/Model/OrderCalculatedCustomerAddress.md @@ -0,0 +1,14 @@ +# # OrderCalculatedCustomerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line_1** | **string** | First line of address. | [optional] +**line_2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postal_code** | **string** | Postal code. | [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/OrderCalculatedEssential.md b/docs/Model/OrderCalculatedEssential.md new file mode 100644 index 0000000..9f356f2 --- /dev/null +++ b/docs/Model/OrderCalculatedEssential.md @@ -0,0 +1,18 @@ +# # OrderCalculatedEssential + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItem[]**](OrderItem.md) | Array of items applied to the order. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**customer_id** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrer** | [**\OpenAPI\Client\Model\Referrer**](Referrer.md) | | [optional] +**referrer_id** | **string** | Unique referrer ID. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCalculatedItem.md b/docs/Model/OrderCalculatedItem.md new file mode 100644 index 0000000..6a1f1bc --- /dev/null +++ b/docs/Model/OrderCalculatedItem.md @@ -0,0 +1,29 @@ +# # OrderCalculatedItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the order line item. | [optional] +**skuId** | **string** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] +**productId** | **string** | Unique identifier of the product. It is assigned by Voucherify. | [optional] +**relatedObject** | **string** | Used along with the source_id property, can be set to either sku or product. | [optional] +**sourceId** | **string** | The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] +**quantity** | **int** | The quantity of the particular item in the cart. | [optional] +**discountQuantity** | **int** | Number of dicounted items. | [optional] +**initialQuantity** | **int** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] +**amount** | **int** | The total amount of the order item (price * quantity). | [optional] +**discountAmount** | **int** | Sum of all order-item-level discounts applied to the order. | [optional] +**appliedDiscountAmount** | **int** | This field shows the order-level discount applied. | [optional] +**appliedDiscountQuantity** | **int** | Number of the discounted items applied in the transaction. | [optional] +**appliedQuantity** | **int** | Quantity of items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. | [optional] +**appliedQuantityAmount** | **int** | Amount for the items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**price** | **int** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**subtotalAmount** | **int** | Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount` | [optional] +**product** | [**\OpenAPI\Client\Model\OrderCalculatedItemProduct**](OrderCalculatedItemProduct.md) | | [optional] +**sku** | [**\OpenAPI\Client\Model\OrderCalculatedItemSku**](OrderCalculatedItemSku.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order_item'] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCalculatedItemProduct.md b/docs/Model/OrderCalculatedItemProduct.md new file mode 100644 index 0000000..4c77dad --- /dev/null +++ b/docs/Model/OrderCalculatedItemProduct.md @@ -0,0 +1,14 @@ +# # OrderCalculatedItemProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] +**sourceId** | **string** | The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**name** | **string** | Product name. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. | [optional] +**price** | **float** | Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCalculatedItemSku.md b/docs/Model/OrderCalculatedItemSku.md new file mode 100644 index 0000000..adb6958 --- /dev/null +++ b/docs/Model/OrderCalculatedItemSku.md @@ -0,0 +1,13 @@ +# # OrderCalculatedItemSku + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**sourceId** | **string** | The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**sku** | **string** | The SKU name. | [optional] +**price** | **float** | SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCalculatedNoCustomerData.md b/docs/Model/OrderCalculatedNoCustomerData.md new file mode 100644 index 0000000..27859ed --- /dev/null +++ b/docs/Model/OrderCalculatedNoCustomerData.md @@ -0,0 +1,30 @@ +# # OrderCalculatedNoCustomerData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items_discount_amount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**total_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**total_amount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**items_applied_discount_amount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItemCalculated[]**](OrderItemCalculated.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order'] +**created_at** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customer_id** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrer_id** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | [**array**](OrderRedemptions.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/OrderCalculatedReferrer.md b/docs/Model/OrderCalculatedReferrer.md new file mode 100644 index 0000000..0513a64 --- /dev/null +++ b/docs/Model/OrderCalculatedReferrer.md @@ -0,0 +1,18 @@ +# # OrderCalculatedReferrer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**source_id** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\OrderCalculatedReferrerAddress**](OrderCalculatedReferrerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderCalculatedReferrerAddress.md b/docs/Model/OrderCalculatedReferrerAddress.md new file mode 100644 index 0000000..2ce435d --- /dev/null +++ b/docs/Model/OrderCalculatedReferrerAddress.md @@ -0,0 +1,14 @@ +# # OrderCalculatedReferrerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line_1** | **string** | First line of address. | [optional] +**line_2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postal_code** | **string** | Postal code. | [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/OrderCreateBase.md b/docs/Model/OrderCreateBase.md new file mode 100644 index 0000000..c26ce7a --- /dev/null +++ b/docs/Model/OrderCreateBase.md @@ -0,0 +1,18 @@ +# # OrderCreateBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItem[]**](OrderItem.md) | Array of items applied to the order. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**customer_id** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrer** | [**\OpenAPI\Client\Model\Referrer**](Referrer.md) | | [optional] +**referrer_id** | **string** | Unique referrer ID. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderItem.md b/docs/Model/OrderItem.md new file mode 100644 index 0000000..7075468 --- /dev/null +++ b/docs/Model/OrderItem.md @@ -0,0 +1,22 @@ +# # OrderItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**skuId** | **string** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] +**productId** | **string** | Unique identifier of the product. It is assigned by Voucherify. | [optional] +**relatedObject** | **string** | Used along with the source_id property, can be set to either sku or product. | [optional] +**sourceId** | **string** | The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] +**quantity** | **int** | The quantity of the particular item in the cart. | [optional] +**discountQuantity** | **int** | Number of dicounted items. | [optional] +**initialQuantity** | **int** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] +**amount** | **int** | The total amount of the order item (price * quantity). | [optional] +**discountAmount** | **int** | Sum of all order-item-level discounts applied to the order. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**price** | **int** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**product** | [**\OpenAPI\Client\Model\OrderItemProduct**](OrderItemProduct.md) | | [optional] +**sku** | [**\OpenAPI\Client\Model\OrderItemSku**](OrderItemSku.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderItemCalculated.md b/docs/Model/OrderItemCalculated.md new file mode 100644 index 0000000..05be07e --- /dev/null +++ b/docs/Model/OrderItemCalculated.md @@ -0,0 +1,28 @@ +# # OrderItemCalculated + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sku_id** | **string** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] +**product_id** | **string** | Unique identifier of the product. It is assigned by Voucherify. | [optional] +**related_object** | **string** | Used along with the source_id property, can be set to either sku or product. | [optional] +**source_id** | **string** | The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] +**quantity** | **int** | The quantity of the particular item in the cart. | [optional] +**discount_quantity** | **int** | Number of dicounted items. | [optional] +**initial_quantity** | **int** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] +**amount** | **int** | The total amount of the order item (price * quantity). | [optional] +**discount_amount** | **int** | Sum of all order-item-level discounts applied to the order. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**applied_discount_quantity** | **int** | Number of the discounted items applied in the transaction. | [optional] +**applied_quantity** | **int** | Quantity of items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. | [optional] +**applied_quantity_amount** | **int** | Amount for the items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**price** | **int** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**subtotal_amount** | **int** | Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount` | [optional] +**product** | [**\OpenAPI\Client\Model\OrderItemCalculatedProduct**](OrderItemCalculatedProduct.md) | | [optional] +**sku** | [**\OpenAPI\Client\Model\OrderItemCalculatedSku**](OrderItemCalculatedSku.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order_item'] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderItemCalculatedProduct.md b/docs/Model/OrderItemCalculatedProduct.md new file mode 100644 index 0000000..c52e262 --- /dev/null +++ b/docs/Model/OrderItemCalculatedProduct.md @@ -0,0 +1,14 @@ +# # OrderItemCalculatedProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] +**source_id** | **string** | The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**name** | **string** | Product name. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. | [optional] +**price** | **float** | Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderItemCalculatedSku.md b/docs/Model/OrderItemCalculatedSku.md new file mode 100644 index 0000000..7241abe --- /dev/null +++ b/docs/Model/OrderItemCalculatedSku.md @@ -0,0 +1,13 @@ +# # OrderItemCalculatedSku + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**source_id** | **string** | The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**sku** | **string** | The SKU name. | [optional] +**price** | **float** | SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderItemProduct.md b/docs/Model/OrderItemProduct.md new file mode 100644 index 0000000..fc52e98 --- /dev/null +++ b/docs/Model/OrderItemProduct.md @@ -0,0 +1,14 @@ +# # OrderItemProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] +**sourceId** | **string** | The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**name** | **string** | Product name. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. | [optional] +**price** | **float** | Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderItemSku.md b/docs/Model/OrderItemSku.md new file mode 100644 index 0000000..00fed55 --- /dev/null +++ b/docs/Model/OrderItemSku.md @@ -0,0 +1,13 @@ +# # OrderItemSku + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**sourceId** | **string** | The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**sku** | **string** | The SKU name. | [optional] +**price** | **float** | SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrderRedemptions.md b/docs/Model/OrderRedemptions.md new file mode 100644 index 0000000..290d197 --- /dev/null +++ b/docs/Model/OrderRedemptions.md @@ -0,0 +1,16 @@ +# # OrderRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**date** | **\DateTime** | Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. | [optional] +**rollback_id** | **string** | Unique ID of the redemption rollback. | [optional] +**rollback_date** | **\DateTime** | Timestamp representing the date and tiem when the redemption rollback was created. The value is shown in the ISO 8601 format. | [optional] +**related_object_type** | **string** | The source of the incentive. | [optional] [default to 'redemption'] +**related_object_id** | **string** | Unique ID of the parent redemption. | [optional] +**related_object_parent_id** | **string** | Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign. | [optional] +**stacked** | **string[]** | Contains a list of unique IDs of child redemptions, which belong to the stacked incentives. | [optional] +**rollback_stacked** | **string[]** | Lists the rollback redemption IDs of the particular child redemptions. | [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/OrderRedemptionsEntry.md b/docs/Model/OrderRedemptionsEntry.md new file mode 100644 index 0000000..a6b67b9 --- /dev/null +++ b/docs/Model/OrderRedemptionsEntry.md @@ -0,0 +1,16 @@ +# # OrderRedemptionsEntry + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**date** | **\DateTime** | Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. | [optional] +**rollbackId** | **string** | Unique ID of the redemption rollback. | [optional] +**rollbackDate** | **\DateTime** | Timestamp representing the date and tiem when the redemption rollback was created. The value is shown in the ISO 8601 format. | [optional] +**relatedObjectType** | **string** | The source of the incentive. | [optional] [default to 'redemption'] +**relatedObjectId** | **string** | Unique ID of the parent redemption. | [optional] +**relatedObjectParentId** | **string** | Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign. | [optional] +**stacked** | **string[]** | Contains a list of unique IDs of child redemptions, which belong to the stacked incentives. | [optional] +**rollbackStacked** | **string[]** | Lists the rollback redemption IDs of the particular child redemptions. | [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/OrdersCreateRequestBody.md b/docs/Model/OrdersCreateRequestBody.md new file mode 100644 index 0000000..4566429 --- /dev/null +++ b/docs/Model/OrdersCreateRequestBody.md @@ -0,0 +1,20 @@ +# # OrdersCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItem[]**](OrderItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\Referrer**](Referrer.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/OrdersCreateResponseBody.md b/docs/Model/OrdersCreateResponseBody.md new file mode 100644 index 0000000..2a2eae4 --- /dev/null +++ b/docs/Model/OrdersCreateResponseBody.md @@ -0,0 +1,30 @@ +# # OrdersCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**itemsDiscountAmount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**totalDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**totalAmount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**appliedDiscountAmount** | **int** | This field shows the order-level discount applied. | [optional] +**itemsAppliedDiscountAmount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**totalAppliedDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**\OpenAPI\Client\Model\OrderCalculatedItem[]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | [**array**](OrderRedemptionsEntry.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/OrdersCreateResponseBodyCustomer.md b/docs/Model/OrdersCreateResponseBodyCustomer.md new file mode 100644 index 0000000..449e1d8 --- /dev/null +++ b/docs/Model/OrdersCreateResponseBodyCustomer.md @@ -0,0 +1,18 @@ +# # OrdersCreateResponseBodyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**source_id** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\OrdersCreateResponseBodyCustomerAddress**](OrdersCreateResponseBodyCustomerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrdersCreateResponseBodyCustomerAddress.md b/docs/Model/OrdersCreateResponseBodyCustomerAddress.md new file mode 100644 index 0000000..45f3e50 --- /dev/null +++ b/docs/Model/OrdersCreateResponseBodyCustomerAddress.md @@ -0,0 +1,14 @@ +# # OrdersCreateResponseBodyCustomerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line_1** | **string** | First line of address. | [optional] +**line_2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postal_code** | **string** | Postal code. | [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/OrdersCreateResponseBodyReferrer.md b/docs/Model/OrdersCreateResponseBodyReferrer.md new file mode 100644 index 0000000..84b0fd7 --- /dev/null +++ b/docs/Model/OrdersCreateResponseBodyReferrer.md @@ -0,0 +1,18 @@ +# # OrdersCreateResponseBodyReferrer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**source_id** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\OrdersCreateResponseBodyReferrerAddress**](OrdersCreateResponseBodyReferrerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrdersCreateResponseBodyReferrerAddress.md b/docs/Model/OrdersCreateResponseBodyReferrerAddress.md new file mode 100644 index 0000000..56e21a9 --- /dev/null +++ b/docs/Model/OrdersCreateResponseBodyReferrerAddress.md @@ -0,0 +1,14 @@ +# # OrdersCreateResponseBodyReferrerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line_1** | **string** | First line of address. | [optional] +**line_2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postal_code** | **string** | Postal code. | [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/OrdersExportCreateRequestBody.md b/docs/Model/OrdersExportCreateRequestBody.md new file mode 100644 index 0000000..6ad88ed --- /dev/null +++ b/docs/Model/OrdersExportCreateRequestBody.md @@ -0,0 +1,9 @@ +# # OrdersExportCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**\OpenAPI\Client\Model\OrdersExportCreateRequestBodyParameters**](OrdersExportCreateRequestBodyParameters.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/OrdersExportCreateRequestBodyParameters.md b/docs/Model/OrdersExportCreateRequestBodyParameters.md new file mode 100644 index 0000000..7090d0c --- /dev/null +++ b/docs/Model/OrdersExportCreateRequestBodyParameters.md @@ -0,0 +1,11 @@ +# # OrdersExportCreateRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | **object** | Allowed additional properties must start with \"metadata.\" | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrdersExportCreateResponseBody.md b/docs/Model/OrdersExportCreateResponseBody.md new file mode 100644 index 0000000..e05331f --- /dev/null +++ b/docs/Model/OrdersExportCreateResponseBody.md @@ -0,0 +1,17 @@ +# # OrdersExportCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique export ID. | [optional] +**object** | **string** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **string** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] [default to 'SCHEDULED'] +**channel** | **string** | The channel through which the export was triggered. | [optional] +**result** | **object** | Contains the URL of the CSV file. | [optional] +**userId** | **string** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exportedObject** | **string** | The type of object to be exported. | [optional] [default to 'order'] +**parameters** | [**\OpenAPI\Client\Model\OrdersExportCreateResponseBodyParameters**](OrdersExportCreateResponseBodyParameters.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/OrdersExportCreateResponseBodyParameters.md b/docs/Model/OrdersExportCreateResponseBodyParameters.md new file mode 100644 index 0000000..6fb059d --- /dev/null +++ b/docs/Model/OrdersExportCreateResponseBodyParameters.md @@ -0,0 +1,11 @@ +# # OrdersExportCreateResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | **object** | Allowed additional properties must start with \"metadata.\" | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrdersGetResponseBody.md b/docs/Model/OrdersGetResponseBody.md new file mode 100644 index 0000000..6834886 --- /dev/null +++ b/docs/Model/OrdersGetResponseBody.md @@ -0,0 +1,30 @@ +# # OrdersGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**itemsDiscountAmount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**totalDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**totalAmount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**appliedDiscountAmount** | **int** | This field shows the order-level discount applied. | [optional] +**itemsAppliedDiscountAmount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**totalAppliedDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**\OpenAPI\Client\Model\OrderCalculatedItem[]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | [**array**](OrderRedemptionsEntry.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/OrdersImportCreateRequestBodyItem.md b/docs/Model/OrdersImportCreateRequestBodyItem.md new file mode 100644 index 0000000..aa98ee7 --- /dev/null +++ b/docs/Model/OrdersImportCreateRequestBodyItem.md @@ -0,0 +1,20 @@ +# # OrdersImportCreateRequestBodyItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItem[]**](OrderItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\Referrer**](Referrer.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/OrdersImportCreateResponseBody.md b/docs/Model/OrdersImportCreateResponseBody.md new file mode 100644 index 0000000..e300292 --- /dev/null +++ b/docs/Model/OrdersImportCreateResponseBody.md @@ -0,0 +1,9 @@ +# # OrdersImportCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/OrdersListResponseBody.md b/docs/Model/OrdersListResponseBody.md new file mode 100644 index 0000000..b9f6841 --- /dev/null +++ b/docs/Model/OrdersListResponseBody.md @@ -0,0 +1,12 @@ +# # OrdersListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about orders in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of order objects. | [optional] [default to 'orders'] +**orders** | [**\OpenAPI\Client\Model\OrderCalculated[]**](OrderCalculated.md) | Contains array of order objects. | [optional] +**total** | **int** | Total number of orders. | [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/OrdersUpdateRequestBody.md b/docs/Model/OrdersUpdateRequestBody.md new file mode 100644 index 0000000..68a6f97 --- /dev/null +++ b/docs/Model/OrdersUpdateRequestBody.md @@ -0,0 +1,19 @@ +# # OrdersUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItem[]**](OrderItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\Referrer**](Referrer.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/OrdersUpdateResponseBody.md b/docs/Model/OrdersUpdateResponseBody.md new file mode 100644 index 0000000..6173ff4 --- /dev/null +++ b/docs/Model/OrdersUpdateResponseBody.md @@ -0,0 +1,30 @@ +# # OrdersUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**itemsDiscountAmount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**totalDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**totalAmount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**appliedDiscountAmount** | **int** | This field shows the order-level discount applied. | [optional] +**itemsAppliedDiscountAmount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**totalAppliedDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**\OpenAPI\Client\Model\OrderCalculatedItem[]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | [**array**](OrderRedemptionsEntry.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/OrdersUpdateResponseBodyCustomer.md b/docs/Model/OrdersUpdateResponseBodyCustomer.md new file mode 100644 index 0000000..ef8674d --- /dev/null +++ b/docs/Model/OrdersUpdateResponseBodyCustomer.md @@ -0,0 +1,18 @@ +# # OrdersUpdateResponseBodyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**source_id** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\OrdersUpdateResponseBodyCustomerAddress**](OrdersUpdateResponseBodyCustomerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrdersUpdateResponseBodyCustomerAddress.md b/docs/Model/OrdersUpdateResponseBodyCustomerAddress.md new file mode 100644 index 0000000..a8245f7 --- /dev/null +++ b/docs/Model/OrdersUpdateResponseBodyCustomerAddress.md @@ -0,0 +1,14 @@ +# # OrdersUpdateResponseBodyCustomerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line_1** | **string** | First line of address. | [optional] +**line_2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postal_code** | **string** | Postal code. | [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/OrdersUpdateResponseBodyReferrer.md b/docs/Model/OrdersUpdateResponseBodyReferrer.md new file mode 100644 index 0000000..3459e8e --- /dev/null +++ b/docs/Model/OrdersUpdateResponseBodyReferrer.md @@ -0,0 +1,18 @@ +# # OrdersUpdateResponseBodyReferrer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**source_id** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\OrdersUpdateResponseBodyReferrerAddress**](OrdersUpdateResponseBodyReferrerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrdersUpdateResponseBodyReferrerAddress.md b/docs/Model/OrdersUpdateResponseBodyReferrerAddress.md new file mode 100644 index 0000000..cfd9ee8 --- /dev/null +++ b/docs/Model/OrdersUpdateResponseBodyReferrerAddress.md @@ -0,0 +1,14 @@ +# # OrdersUpdateResponseBodyReferrerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line_1** | **string** | First line of address. | [optional] +**line_2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postal_code** | **string** | Postal code. | [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/ParameterActivityCategory.md b/docs/Model/ParameterActivityCategory.md new file mode 100644 index 0000000..2212958 --- /dev/null +++ b/docs/Model/ParameterActivityCategory.md @@ -0,0 +1,8 @@ +# # ParameterActivityCategory + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterCampaignType.md b/docs/Model/ParameterCampaignType.md new file mode 100644 index 0000000..5d2128d --- /dev/null +++ b/docs/Model/ParameterCampaignType.md @@ -0,0 +1,8 @@ +# # ParameterCampaignType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterCreatedBeforeAfter.md b/docs/Model/ParameterCreatedBeforeAfter.md new file mode 100644 index 0000000..7a9afcf --- /dev/null +++ b/docs/Model/ParameterCreatedBeforeAfter.md @@ -0,0 +1,10 @@ +# # ParameterCreatedBeforeAfter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**before** | **\DateTime** | Timestamp representing the date and time before the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**after** | **\DateTime** | Timestamp representing the date and time after the voucher was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterExpandListCampaigns.md b/docs/Model/ParameterExpandListCampaigns.md new file mode 100644 index 0000000..5551674 --- /dev/null +++ b/docs/Model/ParameterExpandListCampaigns.md @@ -0,0 +1,8 @@ +# # ParameterExpandListCampaigns + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterFiltersListCustomerRedeemables.md b/docs/Model/ParameterFiltersListCustomerRedeemables.md new file mode 100644 index 0000000..7eaca93 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemables.md @@ -0,0 +1,16 @@ +# # ParameterFiltersListCustomerRedeemables + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesId**](ParameterFiltersListCustomerRedeemablesId.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCreatedAt**](ParameterFiltersListCustomerRedeemablesCreatedAt.md) | | [optional] +**redeemableId** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableId**](ParameterFiltersListCustomerRedeemablesRedeemableId.md) | | [optional] +**redeemableObject** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableObject**](ParameterFiltersListCustomerRedeemablesRedeemableObject.md) | | [optional] +**holderRole** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesHolderRole**](ParameterFiltersListCustomerRedeemablesHolderRole.md) | | [optional] +**campaignId** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignId**](ParameterFiltersListCustomerRedeemablesCampaignId.md) | | [optional] +**campaignType** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignType**](ParameterFiltersListCustomerRedeemablesCampaignType.md) | | [optional] +**voucherType** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesVoucherType**](ParameterFiltersListCustomerRedeemablesVoucherType.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/ParameterFiltersListCustomerRedeemablesCampaignId.md b/docs/Model/ParameterFiltersListCustomerRedeemablesCampaignId.md new file mode 100644 index 0000000..170947f --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesCampaignId.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListCustomerRedeemablesCampaignId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListCustomerRedeemablesCampaignType.md b/docs/Model/ParameterFiltersListCustomerRedeemablesCampaignType.md new file mode 100644 index 0000000..db36c55 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesCampaignType.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListCustomerRedeemablesCampaignType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignTypeConditions**](ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md b/docs/Model/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md new file mode 100644 index 0000000..badbb6d --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md @@ -0,0 +1,16 @@ +# # ParameterFiltersListCustomerRedeemablesCampaignTypeConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**notIn** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**is** | **string** | Value is exactly this value (single value). | [optional] +**isNot** | **string** | Results omit this value (single value). | [optional] +**hasValue** | **string** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**isUnknown** | **string** | Value is null. The value for this parameter is an empty string. | [optional] +**startsWith** | **string** | Value starts with the specified string. | [optional] +**endsWith** | **string** | Value ends with the specified string. | [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/ParameterFiltersListCustomerRedeemablesCreatedAt.md b/docs/Model/ParameterFiltersListCustomerRedeemablesCreatedAt.md new file mode 100644 index 0000000..8cded67 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesCreatedAt.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListCustomerRedeemablesCreatedAt + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCreatedAtConditions**](ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md b/docs/Model/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md new file mode 100644 index 0000000..9f015c5 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md @@ -0,0 +1,14 @@ +# # ParameterFiltersListCustomerRedeemablesCreatedAtConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**after** | **\DateTime** | Value is after this date. The value for this parameter is shown in the ISO 8601 format. | [optional] +**before** | **\DateTime** | Value is before this date. The value for this parameter is shown in the ISO 8601 format. | [optional] +**hasValue** | **string** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**isUnknown** | **string** | Value is null. The value for this parameter is an empty string. | [optional] +**moreThan** | **int** | Value is more days ago before the current date and time, e.g. more than `10` days ago. | [optional] +**lessThan** | **int** | Value is less days before the current date and time, e.g. less than `10` days ago. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterFiltersListCustomerRedeemablesHolderRole.md b/docs/Model/ParameterFiltersListCustomerRedeemablesHolderRole.md new file mode 100644 index 0000000..ebc0870 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesHolderRole.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListCustomerRedeemablesHolderRole + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesHolderRoleConditions**](ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md b/docs/Model/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md new file mode 100644 index 0000000..e738d96 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md @@ -0,0 +1,16 @@ +# # ParameterFiltersListCustomerRedeemablesHolderRoleConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**notIn** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**is** | **string** | Value is exactly this value (single value). | [optional] +**isNot** | **string** | Results omit this value (single value). | [optional] +**hasValue** | **string** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**isUnknown** | **string** | Value is null. The value for this parameter is an empty string. | [optional] +**startsWith** | **string** | Value starts with the specified string. | [optional] +**endsWith** | **string** | Value ends with the specified string. | [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/ParameterFiltersListCustomerRedeemablesId.md b/docs/Model/ParameterFiltersListCustomerRedeemablesId.md new file mode 100644 index 0000000..9d65dd0 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesId.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListCustomerRedeemablesId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListCustomerRedeemablesRedeemableId.md b/docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableId.md new file mode 100644 index 0000000..eb1c6fd --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableId.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListCustomerRedeemablesRedeemableId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListCustomerRedeemablesRedeemableObject.md b/docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableObject.md new file mode 100644 index 0000000..d2f5f39 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableObject.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListCustomerRedeemablesRedeemableObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions**](ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md b/docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md new file mode 100644 index 0000000..48b9262 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md @@ -0,0 +1,16 @@ +# # ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**notIn** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**is** | **string** | Value is exactly this value (single value). | [optional] [default to 'voucher'] +**isNot** | **string** | Results omit this value (single value). | [optional] [default to 'voucher'] +**hasValue** | **string** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**isUnknown** | **string** | Value is null. The value for this parameter is an empty string. | [optional] +**startsWith** | **string** | Value starts with the specified string. | [optional] +**endsWith** | **string** | Value ends with the specified string. | [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/ParameterFiltersListCustomerRedeemablesVoucherType.md b/docs/Model/ParameterFiltersListCustomerRedeemablesVoucherType.md new file mode 100644 index 0000000..4e6de47 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesVoucherType.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListCustomerRedeemablesVoucherType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesVoucherTypeConditions**](ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md b/docs/Model/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md new file mode 100644 index 0000000..04141b3 --- /dev/null +++ b/docs/Model/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md @@ -0,0 +1,16 @@ +# # ParameterFiltersListCustomerRedeemablesVoucherTypeConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**notIn** | **string[]** | Array of resource values that should be included in the results (multiple values). | [optional] +**is** | **string** | Value is exactly this value (single value). | [optional] +**isNot** | **string** | Results omit this value (single value). | [optional] +**hasValue** | **string** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**isUnknown** | **string** | Value is null. The value for this parameter is an empty string. | [optional] +**startsWith** | **string** | Value starts with the specified string. | [optional] +**endsWith** | **string** | Value ends with the specified string. | [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/ParameterFiltersListRedemptions.md b/docs/Model/ParameterFiltersListRedemptions.md new file mode 100644 index 0000000..834515c --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptions.md @@ -0,0 +1,18 @@ +# # ParameterFiltersListRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**voucherCode** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsVoucherCode**](ParameterFiltersListRedemptionsVoucherCode.md) | | [optional] +**relatedObjectId** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsRelatedObjectId**](ParameterFiltersListRedemptionsRelatedObjectId.md) | | [optional] +**relatedObjectParentId** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsRelatedObjectParentId**](ParameterFiltersListRedemptionsRelatedObjectParentId.md) | | [optional] +**parentRedemptionId** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsParentRedemptionId**](ParameterFiltersListRedemptionsParentRedemptionId.md) | | [optional] +**failureCode** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsFailureCode**](ParameterFiltersListRedemptionsFailureCode.md) | | [optional] +**result** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsResult**](ParameterFiltersListRedemptionsResult.md) | | [optional] +**object** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsObject**](ParameterFiltersListRedemptionsObject.md) | | [optional] +**customerId** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsCustomerId**](ParameterFiltersListRedemptionsCustomerId.md) | | [optional] +**campaignName** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsCampaignName**](ParameterFiltersListRedemptionsCampaignName.md) | | [optional] +**userLogin** | [**\OpenAPI\Client\Model\ParameterFiltersListRedemptionsUserLogin**](ParameterFiltersListRedemptionsUserLogin.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/ParameterFiltersListRedemptionsCampaignName.md b/docs/Model/ParameterFiltersListRedemptionsCampaignName.md new file mode 100644 index 0000000..68ccad5 --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsCampaignName.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsCampaignName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsCustomerId.md b/docs/Model/ParameterFiltersListRedemptionsCustomerId.md new file mode 100644 index 0000000..0f29e5b --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsCustomerId.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsCustomerId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsFailureCode.md b/docs/Model/ParameterFiltersListRedemptionsFailureCode.md new file mode 100644 index 0000000..322a901 --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsFailureCode.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsFailureCode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsObject.md b/docs/Model/ParameterFiltersListRedemptionsObject.md new file mode 100644 index 0000000..6f32e50 --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsObject.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsParentRedemptionId.md b/docs/Model/ParameterFiltersListRedemptionsParentRedemptionId.md new file mode 100644 index 0000000..9045a51 --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsParentRedemptionId.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsParentRedemptionId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsRelatedObjectId.md b/docs/Model/ParameterFiltersListRedemptionsRelatedObjectId.md new file mode 100644 index 0000000..78804cf --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsRelatedObjectId.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsRelatedObjectId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsRelatedObjectParentId.md b/docs/Model/ParameterFiltersListRedemptionsRelatedObjectParentId.md new file mode 100644 index 0000000..8cac4b6 --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsRelatedObjectParentId.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsRelatedObjectParentId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsResult.md b/docs/Model/ParameterFiltersListRedemptionsResult.md new file mode 100644 index 0000000..358e848 --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsResult.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsUserLogin.md b/docs/Model/ParameterFiltersListRedemptionsUserLogin.md new file mode 100644 index 0000000..7913e9b --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsUserLogin.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsUserLogin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterFiltersListRedemptionsVoucherCode.md b/docs/Model/ParameterFiltersListRedemptionsVoucherCode.md new file mode 100644 index 0000000..688ca3b --- /dev/null +++ b/docs/Model/ParameterFiltersListRedemptionsVoucherCode.md @@ -0,0 +1,10 @@ +# # ParameterFiltersListRedemptionsVoucherCode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [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/ParameterOrder.md b/docs/Model/ParameterOrder.md new file mode 100644 index 0000000..98d799c --- /dev/null +++ b/docs/Model/ParameterOrder.md @@ -0,0 +1,8 @@ +# # ParameterOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderCreatedAt.md b/docs/Model/ParameterOrderCreatedAt.md new file mode 100644 index 0000000..b8e4c93 --- /dev/null +++ b/docs/Model/ParameterOrderCreatedAt.md @@ -0,0 +1,8 @@ +# # ParameterOrderCreatedAt + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListAllPromotionStacks.md b/docs/Model/ParameterOrderListAllPromotionStacks.md new file mode 100644 index 0000000..4ec33d2 --- /dev/null +++ b/docs/Model/ParameterOrderListAllPromotionStacks.md @@ -0,0 +1,8 @@ +# # ParameterOrderListAllPromotionStacks + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListCampaigns.md b/docs/Model/ParameterOrderListCampaigns.md new file mode 100644 index 0000000..e27e6ba --- /dev/null +++ b/docs/Model/ParameterOrderListCampaigns.md @@ -0,0 +1,8 @@ +# # ParameterOrderListCampaigns + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListCustomers.md b/docs/Model/ParameterOrderListCustomers.md new file mode 100644 index 0000000..e1067d9 --- /dev/null +++ b/docs/Model/ParameterOrderListCustomers.md @@ -0,0 +1,8 @@ +# # ParameterOrderListCustomers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListEarningRules.md b/docs/Model/ParameterOrderListEarningRules.md new file mode 100644 index 0000000..5bb5deb --- /dev/null +++ b/docs/Model/ParameterOrderListEarningRules.md @@ -0,0 +1,8 @@ +# # ParameterOrderListEarningRules + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListExports.md b/docs/Model/ParameterOrderListExports.md new file mode 100644 index 0000000..4c82fa6 --- /dev/null +++ b/docs/Model/ParameterOrderListExports.md @@ -0,0 +1,8 @@ +# # ParameterOrderListExports + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListLoyaltyTiers.md b/docs/Model/ParameterOrderListLoyaltyTiers.md new file mode 100644 index 0000000..684dba6 --- /dev/null +++ b/docs/Model/ParameterOrderListLoyaltyTiers.md @@ -0,0 +1,8 @@ +# # ParameterOrderListLoyaltyTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListOrders.md b/docs/Model/ParameterOrderListOrders.md new file mode 100644 index 0000000..3f0f6ac --- /dev/null +++ b/docs/Model/ParameterOrderListOrders.md @@ -0,0 +1,8 @@ +# # ParameterOrderListOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListPromotionTiers.md b/docs/Model/ParameterOrderListPromotionTiers.md new file mode 100644 index 0000000..e489542 --- /dev/null +++ b/docs/Model/ParameterOrderListPromotionTiers.md @@ -0,0 +1,8 @@ +# # ParameterOrderListPromotionTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListPromotionTiersClientSide.md b/docs/Model/ParameterOrderListPromotionTiersClientSide.md new file mode 100644 index 0000000..c194a38 --- /dev/null +++ b/docs/Model/ParameterOrderListPromotionTiersClientSide.md @@ -0,0 +1,8 @@ +# # ParameterOrderListPromotionTiersClientSide + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListPublications.md b/docs/Model/ParameterOrderListPublications.md new file mode 100644 index 0000000..b3a1bcb --- /dev/null +++ b/docs/Model/ParameterOrderListPublications.md @@ -0,0 +1,8 @@ +# # ParameterOrderListPublications + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListRedeemables.md b/docs/Model/ParameterOrderListRedeemables.md new file mode 100644 index 0000000..80cd2bf --- /dev/null +++ b/docs/Model/ParameterOrderListRedeemables.md @@ -0,0 +1,8 @@ +# # ParameterOrderListRedeemables + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListRedemptions.md b/docs/Model/ParameterOrderListRedemptions.md new file mode 100644 index 0000000..07d11e9 --- /dev/null +++ b/docs/Model/ParameterOrderListRedemptions.md @@ -0,0 +1,8 @@ +# # ParameterOrderListRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListValidationRuleAssignments.md b/docs/Model/ParameterOrderListValidationRuleAssignments.md new file mode 100644 index 0000000..d872cce --- /dev/null +++ b/docs/Model/ParameterOrderListValidationRuleAssignments.md @@ -0,0 +1,8 @@ +# # ParameterOrderListValidationRuleAssignments + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderListValidationRules.md b/docs/Model/ParameterOrderListValidationRules.md new file mode 100644 index 0000000..bd58351 --- /dev/null +++ b/docs/Model/ParameterOrderListValidationRules.md @@ -0,0 +1,8 @@ +# # ParameterOrderListValidationRules + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterOrderVouchers.md b/docs/Model/ParameterOrderVouchers.md new file mode 100644 index 0000000..3e0d969 --- /dev/null +++ b/docs/Model/ParameterOrderVouchers.md @@ -0,0 +1,8 @@ +# # ParameterOrderVouchers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterResultListPublications.md b/docs/Model/ParameterResultListPublications.md new file mode 100644 index 0000000..7c64102 --- /dev/null +++ b/docs/Model/ParameterResultListPublications.md @@ -0,0 +1,8 @@ +# # ParameterResultListPublications + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterUpdatedBeforeAfter.md b/docs/Model/ParameterUpdatedBeforeAfter.md new file mode 100644 index 0000000..04dd7b9 --- /dev/null +++ b/docs/Model/ParameterUpdatedBeforeAfter.md @@ -0,0 +1,10 @@ +# # ParameterUpdatedBeforeAfter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**before** | **\DateTime** | Timestamp representing the date and time before the voucher was updated. The value is shown in the ISO 8601 format. | [optional] +**after** | **\DateTime** | Timestamp representing the date and time after the voucher was updated. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ParameterVoucherTypeListPublications.md b/docs/Model/ParameterVoucherTypeListPublications.md new file mode 100644 index 0000000..d941890 --- /dev/null +++ b/docs/Model/ParameterVoucherTypeListPublications.md @@ -0,0 +1,8 @@ +# # ParameterVoucherTypeListPublications + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Product.md b/docs/Model/Product.md new file mode 100644 index 0000000..b12613d --- /dev/null +++ b/docs/Model/Product.md @@ -0,0 +1,19 @@ +# # Product + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID assigned by Voucherify. | [optional] +**sourceId** | **string** | Unique product source ID. | [optional] +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] +**skus** | [**\OpenAPI\Client\Model\SkusListForProduct**](SkusListForProduct.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/ProductCollectionsCreateRequestBody.md b/docs/Model/ProductCollectionsCreateRequestBody.md new file mode 100644 index 0000000..9a0634f --- /dev/null +++ b/docs/Model/ProductCollectionsCreateRequestBody.md @@ -0,0 +1,12 @@ +# # ProductCollectionsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Show that the product collection is static (manually selected products). | [optional] [default to 'STATIC'] +**name** | **string** | Unique user-defined product collection name. | [optional] +**products** | [**\OpenAPI\Client\Model\ProductCollectionsCreateRequestBodyProductsItem[]**](ProductCollectionsCreateRequestBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] +**filter** | [**\OpenAPI\Client\Model\ProductCollectionsCreateRequestBodyFilter**](ProductCollectionsCreateRequestBodyFilter.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/ProductCollectionsCreateRequestBodyFilter.md b/docs/Model/ProductCollectionsCreateRequestBodyFilter.md new file mode 100644 index 0000000..bf0e9fb --- /dev/null +++ b/docs/Model/ProductCollectionsCreateRequestBodyFilter.md @@ -0,0 +1,21 @@ +# # ProductCollectionsCreateRequestBodyFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**id** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**productId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**sourceId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**name** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**price** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**object** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**attributes** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**imageUrl** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**skus** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**updatedAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ProductCollectionsCreateRequestBodyProductsItem.md b/docs/Model/ProductCollectionsCreateRequestBodyProductsItem.md new file mode 100644 index 0000000..39f07d6 --- /dev/null +++ b/docs/Model/ProductCollectionsCreateRequestBodyProductsItem.md @@ -0,0 +1,11 @@ +# # ProductCollectionsCreateRequestBodyProductsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The product ID. | +**productId** | **string** | Product ID for SKUs. | [optional] +**object** | **string** | Denotes the type of the object represented by the ID. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductCollectionsCreateResponseBody.md b/docs/Model/ProductCollectionsCreateResponseBody.md new file mode 100644 index 0000000..a9d29fb --- /dev/null +++ b/docs/Model/ProductCollectionsCreateResponseBody.md @@ -0,0 +1,15 @@ +# # ProductCollectionsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Product collection ID. | [optional] +**name** | **string** | Unique user-defined product collection name. | [optional] +**type** | **string** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] +**filter** | [**\OpenAPI\Client\Model\ProductCollectionsCreateResponseBodyFilter**](ProductCollectionsCreateResponseBodyFilter.md) | | [optional] +**products** | [**\OpenAPI\Client\Model\ProductCollectionsCreateResponseBodyProductsItem[]**](ProductCollectionsCreateResponseBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional] [default to 'products_collection'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductCollectionsCreateResponseBodyFilter.md b/docs/Model/ProductCollectionsCreateResponseBodyFilter.md new file mode 100644 index 0000000..1c6ba03 --- /dev/null +++ b/docs/Model/ProductCollectionsCreateResponseBodyFilter.md @@ -0,0 +1,21 @@ +# # ProductCollectionsCreateResponseBodyFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**id** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**productId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**sourceId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**name** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**price** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**object** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**attributes** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**imageUrl** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**skus** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**updatedAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ProductCollectionsCreateResponseBodyProductsItem.md b/docs/Model/ProductCollectionsCreateResponseBodyProductsItem.md new file mode 100644 index 0000000..8d4f4ee --- /dev/null +++ b/docs/Model/ProductCollectionsCreateResponseBodyProductsItem.md @@ -0,0 +1,11 @@ +# # ProductCollectionsCreateResponseBodyProductsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The product ID. | +**productId** | **string** | Product ID for SKUs. | [optional] +**object** | **string** | Denotes the type of the object represented by the ID. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductCollectionsGetResponseBody.md b/docs/Model/ProductCollectionsGetResponseBody.md new file mode 100644 index 0000000..ba3b24b --- /dev/null +++ b/docs/Model/ProductCollectionsGetResponseBody.md @@ -0,0 +1,15 @@ +# # ProductCollectionsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Product collection ID. | [optional] +**name** | **string** | Unique user-defined product collection name. | [optional] +**type** | **string** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] +**filter** | [**\OpenAPI\Client\Model\ProductCollectionsGetResponseBodyFilter**](ProductCollectionsGetResponseBodyFilter.md) | | [optional] +**products** | [**\OpenAPI\Client\Model\ProductCollectionsGetResponseBodyProductsItem[]**](ProductCollectionsGetResponseBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional] [default to 'products_collection'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductCollectionsGetResponseBodyFilter.md b/docs/Model/ProductCollectionsGetResponseBodyFilter.md new file mode 100644 index 0000000..67ece57 --- /dev/null +++ b/docs/Model/ProductCollectionsGetResponseBodyFilter.md @@ -0,0 +1,21 @@ +# # ProductCollectionsGetResponseBodyFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**id** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**productId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**sourceId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**name** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**price** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**object** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**attributes** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**imageUrl** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**skus** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**updatedAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ProductCollectionsGetResponseBodyProductsItem.md b/docs/Model/ProductCollectionsGetResponseBodyProductsItem.md new file mode 100644 index 0000000..56a8b16 --- /dev/null +++ b/docs/Model/ProductCollectionsGetResponseBodyProductsItem.md @@ -0,0 +1,11 @@ +# # ProductCollectionsGetResponseBodyProductsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The product ID. | +**productId** | **string** | Product ID for SKUs. | [optional] +**object** | **string** | Denotes the type of the object represented by the ID. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductCollectionsItem.md b/docs/Model/ProductCollectionsItem.md new file mode 100644 index 0000000..1210233 --- /dev/null +++ b/docs/Model/ProductCollectionsItem.md @@ -0,0 +1,15 @@ +# # ProductCollectionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Product collection ID. | [optional] +**name** | **string** | Unique user-defined product collection name. | [optional] +**type** | **string** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] +**filter** | [**\OpenAPI\Client\Model\ProductCollectionsItemFilter**](ProductCollectionsItemFilter.md) | | [optional] +**products** | [**\OpenAPI\Client\Model\ProductCollectionsItemProductsItem[]**](ProductCollectionsItemProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional] [default to 'products_collection'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductCollectionsItemFilter.md b/docs/Model/ProductCollectionsItemFilter.md new file mode 100644 index 0000000..66b3697 --- /dev/null +++ b/docs/Model/ProductCollectionsItemFilter.md @@ -0,0 +1,21 @@ +# # ProductCollectionsItemFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**id** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**productId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**sourceId** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**name** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**price** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**object** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**attributes** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**metadata** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**imageUrl** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**skus** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**createdAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.md) | | [optional] +**updatedAt** | [**\OpenAPI\Client\Model\FieldConditions**](FieldConditions.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/ProductCollectionsItemProductsItem.md b/docs/Model/ProductCollectionsItemProductsItem.md new file mode 100644 index 0000000..09b1192 --- /dev/null +++ b/docs/Model/ProductCollectionsItemProductsItem.md @@ -0,0 +1,11 @@ +# # ProductCollectionsItemProductsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The product ID. | +**productId** | **string** | Product ID for SKUs. | [optional] +**object** | **string** | Denotes the type of the object represented by the ID. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductCollectionsListResponseBody.md b/docs/Model/ProductCollectionsListResponseBody.md new file mode 100644 index 0000000..945e393 --- /dev/null +++ b/docs/Model/ProductCollectionsListResponseBody.md @@ -0,0 +1,12 @@ +# # ProductCollectionsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about product collections. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of product collections. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\ProductCollectionsItem[]**](ProductCollectionsItem.md) | A dictionary that contains an array of product collections and their details. | [optional] +**total** | **int** | Total number of product collections. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductCollectionsProductsListResponseBody.md b/docs/Model/ProductCollectionsProductsListResponseBody.md new file mode 100644 index 0000000..4d0c33e --- /dev/null +++ b/docs/Model/ProductCollectionsProductsListResponseBody.md @@ -0,0 +1,12 @@ +# # ProductCollectionsProductsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about products and SKUs. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of products and SKUs. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\ProductCollectionsProductsListResponseBodyDataItem[]**](ProductCollectionsProductsListResponseBodyDataItem.md) | | [optional] +**total** | **int** | Total number of products & SKUs in the product collection. | [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/ProductCollectionsProductsListResponseBodyDataItem.md b/docs/Model/ProductCollectionsProductsListResponseBodyDataItem.md new file mode 100644 index 0000000..c59135c --- /dev/null +++ b/docs/Model/ProductCollectionsProductsListResponseBodyDataItem.md @@ -0,0 +1,22 @@ +# # ProductCollectionsProductsListResponseBodyDataItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**sourceId** | **string** | | [optional] +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | | [optional] +**imageUrl** | **string** | | [optional] +**createdAt** | **string** | | [optional] +**updatedAt** | **string** | | [optional] +**object** | **string** | | [optional] +**productId** | **string** | The parent product's unique ID. | [optional] +**sku** | **string** | Unique user-defined SKU name. | [optional] +**currency** | **string** | SKU price currency. | [optional] +**product** | [**\OpenAPI\Client\Model\ProductWithoutSkus**](ProductWithoutSkus.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/ProductWithoutSkus.md b/docs/Model/ProductWithoutSkus.md new file mode 100644 index 0000000..e62acaa --- /dev/null +++ b/docs/Model/ProductWithoutSkus.md @@ -0,0 +1,18 @@ +# # ProductWithoutSkus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID assigned by Voucherify. | [optional] +**sourceId** | **string** | Unique product source ID. | [optional] +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsCreateRequestBody.md b/docs/Model/ProductsCreateRequestBody.md new file mode 100644 index 0000000..ed1d3af --- /dev/null +++ b/docs/Model/ProductsCreateRequestBody.md @@ -0,0 +1,15 @@ +# # ProductsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] +**sourceId** | **string** | Unique product source ID. | [optional] +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsCreateResponseBody.md b/docs/Model/ProductsCreateResponseBody.md new file mode 100644 index 0000000..2921453 --- /dev/null +++ b/docs/Model/ProductsCreateResponseBody.md @@ -0,0 +1,19 @@ +# # ProductsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID assigned by Voucherify. | [optional] +**sourceId** | **string** | Unique product source ID. | [optional] +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] +**skus** | [**\OpenAPI\Client\Model\SkusListForProduct**](SkusListForProduct.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/ProductsGetResponseBody.md b/docs/Model/ProductsGetResponseBody.md new file mode 100644 index 0000000..fefc53a --- /dev/null +++ b/docs/Model/ProductsGetResponseBody.md @@ -0,0 +1,19 @@ +# # ProductsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID assigned by Voucherify. | [optional] +**sourceId** | **string** | Unique product source ID. | [optional] +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] +**skus** | [**\OpenAPI\Client\Model\SkusListForProduct**](SkusListForProduct.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/ProductsImportCsvCreateResponseBody.md b/docs/Model/ProductsImportCsvCreateResponseBody.md new file mode 100644 index 0000000..4587e34 --- /dev/null +++ b/docs/Model/ProductsImportCsvCreateResponseBody.md @@ -0,0 +1,9 @@ +# # ProductsImportCsvCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/ProductsListResponseBody.md b/docs/Model/ProductsListResponseBody.md new file mode 100644 index 0000000..e6c7239 --- /dev/null +++ b/docs/Model/ProductsListResponseBody.md @@ -0,0 +1,12 @@ +# # ProductsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about products in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of product objects. | [optional] [default to 'products'] +**products** | [**\OpenAPI\Client\Model\Product[]**](Product.md) | Contains array of product objects. | [optional] +**total** | **int** | Total number of product objects. | [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/ProductsMetadataUpdateInBulkRequestBody.md b/docs/Model/ProductsMetadataUpdateInBulkRequestBody.md new file mode 100644 index 0000000..398ecc2 --- /dev/null +++ b/docs/Model/ProductsMetadataUpdateInBulkRequestBody.md @@ -0,0 +1,10 @@ +# # ProductsMetadataUpdateInBulkRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceIds** | **string[]** | Array of unique product source IDs. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsMetadataUpdateInBulkResponseBody.md b/docs/Model/ProductsMetadataUpdateInBulkResponseBody.md new file mode 100644 index 0000000..704084d --- /dev/null +++ b/docs/Model/ProductsMetadataUpdateInBulkResponseBody.md @@ -0,0 +1,9 @@ +# # ProductsMetadataUpdateInBulkResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/ProductsSkusCreateRequestBody.md b/docs/Model/ProductsSkusCreateRequestBody.md new file mode 100644 index 0000000..9857f78 --- /dev/null +++ b/docs/Model/ProductsSkusCreateRequestBody.md @@ -0,0 +1,16 @@ +# # ProductsSkusCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique SKU ID. | [optional] +**sourceId** | **string** | A unique SKU identifier from your inventory system. | [optional] +**sku** | **string** | Unique user-defined SKU name. | [optional] +**price** | **int** | SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**currency** | **string** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsSkusCreateResponseBody.md b/docs/Model/ProductsSkusCreateResponseBody.md new file mode 100644 index 0000000..ddf5dd4 --- /dev/null +++ b/docs/Model/ProductsSkusCreateResponseBody.md @@ -0,0 +1,20 @@ +# # ProductsSkusCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**sourceId** | **string** | A unique SKU identifier from your inventory system. | [optional] +**productId** | **string** | The parent product's unique ID. | [optional] +**sku** | **string** | Unique user-defined SKU name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**currency** | **string** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional] [default to 'sku'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsSkusListResponseBody.md b/docs/Model/ProductsSkusListResponseBody.md new file mode 100644 index 0000000..e2ebffc --- /dev/null +++ b/docs/Model/ProductsSkusListResponseBody.md @@ -0,0 +1,12 @@ +# # ProductsSkusListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about SKUs. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of SKUs. | [optional] [default to 'data'] +**skus** | [**\OpenAPI\Client\Model\Sku[]**](Sku.md) | A dictionary that contains an array of SKUs. | [optional] +**total** | **int** | Total number of SKUs in the product. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsSkusUpdateRequestBody.md b/docs/Model/ProductsSkusUpdateRequestBody.md new file mode 100644 index 0000000..a082f0d --- /dev/null +++ b/docs/Model/ProductsSkusUpdateRequestBody.md @@ -0,0 +1,14 @@ +# # ProductsSkusUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sku** | **string** | Unique user-defined SKU name. | [optional] +**price** | **int** | SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**currency** | **string** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsSkusUpdateResponseBody.md b/docs/Model/ProductsSkusUpdateResponseBody.md new file mode 100644 index 0000000..dbd48c8 --- /dev/null +++ b/docs/Model/ProductsSkusUpdateResponseBody.md @@ -0,0 +1,20 @@ +# # ProductsSkusUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**sourceId** | **string** | A unique SKU identifier from your inventory system. | [optional] +**productId** | **string** | The parent product's unique ID. | [optional] +**sku** | **string** | Unique user-defined SKU name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**currency** | **string** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional] [default to 'sku'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsUpdateInBulkRequestBody.md b/docs/Model/ProductsUpdateInBulkRequestBody.md new file mode 100644 index 0000000..4870b6b --- /dev/null +++ b/docs/Model/ProductsUpdateInBulkRequestBody.md @@ -0,0 +1,14 @@ +# # ProductsUpdateInBulkRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceId** | **string** | Unique product source ID from your inventory system. | [optional] +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsUpdateInBulkResponseBody.md b/docs/Model/ProductsUpdateInBulkResponseBody.md new file mode 100644 index 0000000..0b3e252 --- /dev/null +++ b/docs/Model/ProductsUpdateInBulkResponseBody.md @@ -0,0 +1,9 @@ +# # ProductsUpdateInBulkResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/ProductsUpdateRequestBody.md b/docs/Model/ProductsUpdateRequestBody.md new file mode 100644 index 0000000..82de73a --- /dev/null +++ b/docs/Model/ProductsUpdateRequestBody.md @@ -0,0 +1,13 @@ +# # ProductsUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductsUpdateResponseBody.md b/docs/Model/ProductsUpdateResponseBody.md new file mode 100644 index 0000000..c846978 --- /dev/null +++ b/docs/Model/ProductsUpdateResponseBody.md @@ -0,0 +1,19 @@ +# # ProductsUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID assigned by Voucherify. | [optional] +**sourceId** | **string** | Unique product source ID. | [optional] +**name** | **string** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **string[]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] +**skus** | [**\OpenAPI\Client\Model\SkusListForProduct**](SkusListForProduct.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/PromotionStack.md b/docs/Model/PromotionStack.md new file mode 100644 index 0000000..c610973 --- /dev/null +++ b/docs/Model/PromotionStack.md @@ -0,0 +1,17 @@ +# # PromotionStack + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Promotion stack name. | [optional] +**tiers** | [**\OpenAPI\Client\Model\PromotionStackTiers**](PromotionStackTiers.md) | | [optional] +**id** | **string** | Unique promotion stack ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] +**campaignId** | **string** | Promotion stack's parent campaign's unique ID. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'promotion_stack'] +**categoryId** | **string** | Promotion stack category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Details about the category assigned to the promotion stack. | [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/PromotionStackBase.md b/docs/Model/PromotionStackBase.md new file mode 100644 index 0000000..443795d --- /dev/null +++ b/docs/Model/PromotionStackBase.md @@ -0,0 +1,10 @@ +# # PromotionStackBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Promotion stack name. | [optional] +**tiers** | [**\OpenAPI\Client\Model\PromotionStackBaseTiers**](PromotionStackBaseTiers.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/PromotionStackBaseTiers.md b/docs/Model/PromotionStackBaseTiers.md new file mode 100644 index 0000000..09b9783 --- /dev/null +++ b/docs/Model/PromotionStackBaseTiers.md @@ -0,0 +1,10 @@ +# # PromotionStackBaseTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **string[]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchyMode** | **string** | | [optional] [default to 'MANUAL'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionStackTiers.md b/docs/Model/PromotionStackTiers.md new file mode 100644 index 0000000..1fe8d04 --- /dev/null +++ b/docs/Model/PromotionStackTiers.md @@ -0,0 +1,10 @@ +# # PromotionStackTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **string[]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchyMode** | **string** | | [optional] [default to 'MANUAL'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionTier.md b/docs/Model/PromotionTier.md new file mode 100644 index 0000000..f59dfb9 --- /dev/null +++ b/docs/Model/PromotionTier.md @@ -0,0 +1,30 @@ +# # PromotionTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionTierAction**](PromotionTierAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\PromotionTierCampaign**](PromotionTierCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\PromotionTierSummary**](PromotionTierSummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/PromotionTierAction.md b/docs/Model/PromotionTierAction.md new file mode 100644 index 0000000..6599822 --- /dev/null +++ b/docs/Model/PromotionTierAction.md @@ -0,0 +1,9 @@ +# # PromotionTierAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionTierCampaign.md b/docs/Model/PromotionTierCampaign.md new file mode 100644 index 0000000..f628c91 --- /dev/null +++ b/docs/Model/PromotionTierCampaign.md @@ -0,0 +1,17 @@ +# # PromotionTierCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionTierCreateParams.md b/docs/Model/PromotionTierCreateParams.md new file mode 100644 index 0000000..6d7bef1 --- /dev/null +++ b/docs/Model/PromotionTierCreateParams.md @@ -0,0 +1,22 @@ +# # PromotionTierCreateParams + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionTierCreateParamsAction**](PromotionTierCreateParamsAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**validationRules** | **string[]** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**category** | **string** | Assign category to the promotion tier. | [optional] +**categoryId** | **string** | Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionTierCreateParamsAction.md b/docs/Model/PromotionTierCreateParamsAction.md new file mode 100644 index 0000000..d06eb19 --- /dev/null +++ b/docs/Model/PromotionTierCreateParamsAction.md @@ -0,0 +1,9 @@ +# # PromotionTierCreateParamsAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionTierSummary.md b/docs/Model/PromotionTierSummary.md new file mode 100644 index 0000000..ae04f61 --- /dev/null +++ b/docs/Model/PromotionTierSummary.md @@ -0,0 +1,10 @@ +# # PromotionTierSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\PromotionTierSummaryRedemptions**](PromotionTierSummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\PromotionTierSummaryOrders**](PromotionTierSummaryOrders.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/PromotionTierSummaryOrders.md b/docs/Model/PromotionTierSummaryOrders.md new file mode 100644 index 0000000..00b041b --- /dev/null +++ b/docs/Model/PromotionTierSummaryOrders.md @@ -0,0 +1,10 @@ +# # PromotionTierSummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/PromotionTierSummaryRedemptions.md b/docs/Model/PromotionTierSummaryRedemptions.md new file mode 100644 index 0000000..64426ea --- /dev/null +++ b/docs/Model/PromotionTierSummaryRedemptions.md @@ -0,0 +1,9 @@ +# # PromotionTierSummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/PromotionTiersList.md b/docs/Model/PromotionTiersList.md new file mode 100644 index 0000000..5e2a14e --- /dev/null +++ b/docs/Model/PromotionTiersList.md @@ -0,0 +1,13 @@ +# # PromotionTiersList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional] [default to 'tiers'] +**tiers** | [**\OpenAPI\Client\Model\PromotionTier[]**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] +**total** | **int** | Total number of promotion tiers. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [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/PromotionsStacksCreateRequestBody.md b/docs/Model/PromotionsStacksCreateRequestBody.md new file mode 100644 index 0000000..a70df5a --- /dev/null +++ b/docs/Model/PromotionsStacksCreateRequestBody.md @@ -0,0 +1,11 @@ +# # PromotionsStacksCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Promotion stack name. | [optional] +**tiers** | [**\OpenAPI\Client\Model\PromotionsStacksCreateRequestBodyTiers**](PromotionsStacksCreateRequestBodyTiers.md) | | [optional] +**categoryId** | **string** | Promotion stack category ID. | [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/PromotionsStacksCreateRequestBodyTiers.md b/docs/Model/PromotionsStacksCreateRequestBodyTiers.md new file mode 100644 index 0000000..5e6cfc7 --- /dev/null +++ b/docs/Model/PromotionsStacksCreateRequestBodyTiers.md @@ -0,0 +1,10 @@ +# # PromotionsStacksCreateRequestBodyTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **string[]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchyMode** | **string** | | [optional] [default to 'MANUAL'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsStacksCreateResponseBody.md b/docs/Model/PromotionsStacksCreateResponseBody.md new file mode 100644 index 0000000..b9ad481 --- /dev/null +++ b/docs/Model/PromotionsStacksCreateResponseBody.md @@ -0,0 +1,16 @@ +# # PromotionsStacksCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Promotion stack name. | [optional] +**tiers** | [**\OpenAPI\Client\Model\PromotionsStacksCreateResponseBodyTiers**](PromotionsStacksCreateResponseBodyTiers.md) | | [optional] +**id** | **string** | Unique promotion stack ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] +**campaignId** | **string** | Promotion stack's parent campaign's unique ID. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'promotion_stack'] +**categoryId** | **string** | Promotion stack category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\PromotionStackBase[]**](PromotionStackBase.md) | Details about the category assigned to the promotion stack. | [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/PromotionsStacksCreateResponseBodyTiers.md b/docs/Model/PromotionsStacksCreateResponseBodyTiers.md new file mode 100644 index 0000000..8f65b9f --- /dev/null +++ b/docs/Model/PromotionsStacksCreateResponseBodyTiers.md @@ -0,0 +1,10 @@ +# # PromotionsStacksCreateResponseBodyTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **string[]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchyMode** | **string** | | [optional] [default to 'MANUAL'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsStacksGetResponseBody.md b/docs/Model/PromotionsStacksGetResponseBody.md new file mode 100644 index 0000000..612ffd0 --- /dev/null +++ b/docs/Model/PromotionsStacksGetResponseBody.md @@ -0,0 +1,17 @@ +# # PromotionsStacksGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Promotion stack name. | [optional] +**tiers** | [**\OpenAPI\Client\Model\PromotionsStacksGetResponseBodyTiers**](PromotionsStacksGetResponseBodyTiers.md) | | [optional] +**id** | **string** | Unique promotion stack ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] +**campaignId** | **string** | Promotion stack's parent campaign's unique ID. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'promotion_stack'] +**categoryId** | **string** | Promotion stack category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Details about the category assigned to the promotion stack. | [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/PromotionsStacksGetResponseBodyTiers.md b/docs/Model/PromotionsStacksGetResponseBodyTiers.md new file mode 100644 index 0000000..e6fec61 --- /dev/null +++ b/docs/Model/PromotionsStacksGetResponseBodyTiers.md @@ -0,0 +1,10 @@ +# # PromotionsStacksGetResponseBodyTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **string[]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchyMode** | **string** | | [optional] [default to 'MANUAL'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsStacksListResponseBody.md b/docs/Model/PromotionsStacksListResponseBody.md new file mode 100644 index 0000000..efc559f --- /dev/null +++ b/docs/Model/PromotionsStacksListResponseBody.md @@ -0,0 +1,12 @@ +# # PromotionsStacksListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about promotion stacks in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of promotion stack objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\PromotionStack[]**](PromotionStack.md) | Contains array of promotion stack objects. | [optional] +**total** | **int** | Total number of promotion stacks. | [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/PromotionsStacksUpdateRequestBody.md b/docs/Model/PromotionsStacksUpdateRequestBody.md new file mode 100644 index 0000000..f7c4b77 --- /dev/null +++ b/docs/Model/PromotionsStacksUpdateRequestBody.md @@ -0,0 +1,11 @@ +# # PromotionsStacksUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Promotion stack name. | [optional] +**tiers** | [**\OpenAPI\Client\Model\PromotionsStacksUpdateRequestBodyTiers**](PromotionsStacksUpdateRequestBodyTiers.md) | | [optional] +**categoryId** | **string** | Promotion stack category ID. | [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/PromotionsStacksUpdateRequestBodyTiers.md b/docs/Model/PromotionsStacksUpdateRequestBodyTiers.md new file mode 100644 index 0000000..f4afe5c --- /dev/null +++ b/docs/Model/PromotionsStacksUpdateRequestBodyTiers.md @@ -0,0 +1,10 @@ +# # PromotionsStacksUpdateRequestBodyTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **string[]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchyMode** | **string** | Category hierarchy. | [optional] [default to 'MANUAL'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsStacksUpdateResponseBody.md b/docs/Model/PromotionsStacksUpdateResponseBody.md new file mode 100644 index 0000000..06ed2d2 --- /dev/null +++ b/docs/Model/PromotionsStacksUpdateResponseBody.md @@ -0,0 +1,17 @@ +# # PromotionsStacksUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Promotion stack name. | [optional] +**tiers** | [**\OpenAPI\Client\Model\PromotionsStacksUpdateResponseBodyTiers**](PromotionsStacksUpdateResponseBodyTiers.md) | | [optional] +**id** | **string** | Unique promotion stack ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] +**campaignId** | **string** | Promotion stack's parent campaign's unique ID. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'promotion_stack'] +**categoryId** | **string** | Promotion stack category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\PromotionStackBase[]**](PromotionStackBase.md) | Details about the category assigned to the promotion stack. | [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/PromotionsStacksUpdateResponseBodyTiers.md b/docs/Model/PromotionsStacksUpdateResponseBodyTiers.md new file mode 100644 index 0000000..fb1de8e --- /dev/null +++ b/docs/Model/PromotionsStacksUpdateResponseBodyTiers.md @@ -0,0 +1,10 @@ +# # PromotionsStacksUpdateResponseBodyTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **string[]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchyMode** | **string** | | [optional] [default to 'MANUAL'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsTiersCreateRequestBody.md b/docs/Model/PromotionsTiersCreateRequestBody.md new file mode 100644 index 0000000..4f44223 --- /dev/null +++ b/docs/Model/PromotionsTiersCreateRequestBody.md @@ -0,0 +1,22 @@ +# # PromotionsTiersCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionsTiersCreateRequestBodyAction**](PromotionsTiersCreateRequestBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category** | **string** | Assign a new or update the promotion tier's category using name. | [optional] +**categoryId** | **string** | Assign a new or update the promotion tier's category using id | [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/PromotionsTiersCreateRequestBodyAction.md b/docs/Model/PromotionsTiersCreateRequestBodyAction.md new file mode 100644 index 0000000..957ce9b --- /dev/null +++ b/docs/Model/PromotionsTiersCreateRequestBodyAction.md @@ -0,0 +1,9 @@ +# # PromotionsTiersCreateRequestBodyAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionsTiersCreateResponseBody.md b/docs/Model/PromotionsTiersCreateResponseBody.md new file mode 100644 index 0000000..12a4ec2 --- /dev/null +++ b/docs/Model/PromotionsTiersCreateResponseBody.md @@ -0,0 +1,30 @@ +# # PromotionsTiersCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodyAction**](PromotionsTiersCreateResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodyCampaign**](PromotionsTiersCreateResponseBodyCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummary**](PromotionsTiersCreateResponseBodySummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/PromotionsTiersCreateResponseBodyAction.md b/docs/Model/PromotionsTiersCreateResponseBodyAction.md new file mode 100644 index 0000000..d1daab1 --- /dev/null +++ b/docs/Model/PromotionsTiersCreateResponseBodyAction.md @@ -0,0 +1,9 @@ +# # PromotionsTiersCreateResponseBodyAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionsTiersCreateResponseBodyCampaign.md b/docs/Model/PromotionsTiersCreateResponseBodyCampaign.md new file mode 100644 index 0000000..9e95d06 --- /dev/null +++ b/docs/Model/PromotionsTiersCreateResponseBodyCampaign.md @@ -0,0 +1,17 @@ +# # PromotionsTiersCreateResponseBodyCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsTiersCreateResponseBodySummary.md b/docs/Model/PromotionsTiersCreateResponseBodySummary.md new file mode 100644 index 0000000..68b6dd9 --- /dev/null +++ b/docs/Model/PromotionsTiersCreateResponseBodySummary.md @@ -0,0 +1,10 @@ +# # PromotionsTiersCreateResponseBodySummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummaryRedemptions**](PromotionsTiersCreateResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummaryOrders**](PromotionsTiersCreateResponseBodySummaryOrders.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/PromotionsTiersCreateResponseBodySummaryOrders.md b/docs/Model/PromotionsTiersCreateResponseBodySummaryOrders.md new file mode 100644 index 0000000..f55f65a --- /dev/null +++ b/docs/Model/PromotionsTiersCreateResponseBodySummaryOrders.md @@ -0,0 +1,10 @@ +# # PromotionsTiersCreateResponseBodySummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/PromotionsTiersCreateResponseBodySummaryRedemptions.md b/docs/Model/PromotionsTiersCreateResponseBodySummaryRedemptions.md new file mode 100644 index 0000000..0285bfb --- /dev/null +++ b/docs/Model/PromotionsTiersCreateResponseBodySummaryRedemptions.md @@ -0,0 +1,9 @@ +# # PromotionsTiersCreateResponseBodySummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/PromotionsTiersDisableResponseBody.md b/docs/Model/PromotionsTiersDisableResponseBody.md new file mode 100644 index 0000000..c7fc94a --- /dev/null +++ b/docs/Model/PromotionsTiersDisableResponseBody.md @@ -0,0 +1,30 @@ +# # PromotionsTiersDisableResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodyAction**](PromotionsTiersDisableResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodyCampaign**](PromotionsTiersDisableResponseBodyCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummary**](PromotionsTiersDisableResponseBodySummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/PromotionsTiersDisableResponseBodyAction.md b/docs/Model/PromotionsTiersDisableResponseBodyAction.md new file mode 100644 index 0000000..0698cce --- /dev/null +++ b/docs/Model/PromotionsTiersDisableResponseBodyAction.md @@ -0,0 +1,9 @@ +# # PromotionsTiersDisableResponseBodyAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionsTiersDisableResponseBodyCampaign.md b/docs/Model/PromotionsTiersDisableResponseBodyCampaign.md new file mode 100644 index 0000000..35c7847 --- /dev/null +++ b/docs/Model/PromotionsTiersDisableResponseBodyCampaign.md @@ -0,0 +1,17 @@ +# # PromotionsTiersDisableResponseBodyCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsTiersDisableResponseBodySummary.md b/docs/Model/PromotionsTiersDisableResponseBodySummary.md new file mode 100644 index 0000000..dea186b --- /dev/null +++ b/docs/Model/PromotionsTiersDisableResponseBodySummary.md @@ -0,0 +1,10 @@ +# # PromotionsTiersDisableResponseBodySummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummaryRedemptions**](PromotionsTiersDisableResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummaryOrders**](PromotionsTiersDisableResponseBodySummaryOrders.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/PromotionsTiersDisableResponseBodySummaryOrders.md b/docs/Model/PromotionsTiersDisableResponseBodySummaryOrders.md new file mode 100644 index 0000000..9753e62 --- /dev/null +++ b/docs/Model/PromotionsTiersDisableResponseBodySummaryOrders.md @@ -0,0 +1,10 @@ +# # PromotionsTiersDisableResponseBodySummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/PromotionsTiersDisableResponseBodySummaryRedemptions.md b/docs/Model/PromotionsTiersDisableResponseBodySummaryRedemptions.md new file mode 100644 index 0000000..1efdbcd --- /dev/null +++ b/docs/Model/PromotionsTiersDisableResponseBodySummaryRedemptions.md @@ -0,0 +1,9 @@ +# # PromotionsTiersDisableResponseBodySummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/PromotionsTiersEnableResponseBody.md b/docs/Model/PromotionsTiersEnableResponseBody.md new file mode 100644 index 0000000..18c8102 --- /dev/null +++ b/docs/Model/PromotionsTiersEnableResponseBody.md @@ -0,0 +1,30 @@ +# # PromotionsTiersEnableResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodyAction**](PromotionsTiersEnableResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodyCampaign**](PromotionsTiersEnableResponseBodyCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummary**](PromotionsTiersEnableResponseBodySummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/PromotionsTiersEnableResponseBodyAction.md b/docs/Model/PromotionsTiersEnableResponseBodyAction.md new file mode 100644 index 0000000..3c49469 --- /dev/null +++ b/docs/Model/PromotionsTiersEnableResponseBodyAction.md @@ -0,0 +1,9 @@ +# # PromotionsTiersEnableResponseBodyAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionsTiersEnableResponseBodyCampaign.md b/docs/Model/PromotionsTiersEnableResponseBodyCampaign.md new file mode 100644 index 0000000..bff291d --- /dev/null +++ b/docs/Model/PromotionsTiersEnableResponseBodyCampaign.md @@ -0,0 +1,17 @@ +# # PromotionsTiersEnableResponseBodyCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsTiersEnableResponseBodySummary.md b/docs/Model/PromotionsTiersEnableResponseBodySummary.md new file mode 100644 index 0000000..3b5d782 --- /dev/null +++ b/docs/Model/PromotionsTiersEnableResponseBodySummary.md @@ -0,0 +1,10 @@ +# # PromotionsTiersEnableResponseBodySummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummaryRedemptions**](PromotionsTiersEnableResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummaryOrders**](PromotionsTiersEnableResponseBodySummaryOrders.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/PromotionsTiersEnableResponseBodySummaryOrders.md b/docs/Model/PromotionsTiersEnableResponseBodySummaryOrders.md new file mode 100644 index 0000000..84fc84b --- /dev/null +++ b/docs/Model/PromotionsTiersEnableResponseBodySummaryOrders.md @@ -0,0 +1,10 @@ +# # PromotionsTiersEnableResponseBodySummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/PromotionsTiersEnableResponseBodySummaryRedemptions.md b/docs/Model/PromotionsTiersEnableResponseBodySummaryRedemptions.md new file mode 100644 index 0000000..4b8812b --- /dev/null +++ b/docs/Model/PromotionsTiersEnableResponseBodySummaryRedemptions.md @@ -0,0 +1,9 @@ +# # PromotionsTiersEnableResponseBodySummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/PromotionsTiersGetResponseBody.md b/docs/Model/PromotionsTiersGetResponseBody.md new file mode 100644 index 0000000..fe129d4 --- /dev/null +++ b/docs/Model/PromotionsTiersGetResponseBody.md @@ -0,0 +1,30 @@ +# # PromotionsTiersGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionsTiersGetResponseBodyAction**](PromotionsTiersGetResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\PromotionsTiersGetResponseBodyCampaign**](PromotionsTiersGetResponseBodyCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummary**](PromotionsTiersGetResponseBodySummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/PromotionsTiersGetResponseBodyAction.md b/docs/Model/PromotionsTiersGetResponseBodyAction.md new file mode 100644 index 0000000..adcccc9 --- /dev/null +++ b/docs/Model/PromotionsTiersGetResponseBodyAction.md @@ -0,0 +1,9 @@ +# # PromotionsTiersGetResponseBodyAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionsTiersGetResponseBodyCampaign.md b/docs/Model/PromotionsTiersGetResponseBodyCampaign.md new file mode 100644 index 0000000..e6739da --- /dev/null +++ b/docs/Model/PromotionsTiersGetResponseBodyCampaign.md @@ -0,0 +1,17 @@ +# # PromotionsTiersGetResponseBodyCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsTiersGetResponseBodySummary.md b/docs/Model/PromotionsTiersGetResponseBodySummary.md new file mode 100644 index 0000000..f627fcb --- /dev/null +++ b/docs/Model/PromotionsTiersGetResponseBodySummary.md @@ -0,0 +1,10 @@ +# # PromotionsTiersGetResponseBodySummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummaryRedemptions**](PromotionsTiersGetResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummaryOrders**](PromotionsTiersGetResponseBodySummaryOrders.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/PromotionsTiersGetResponseBodySummaryOrders.md b/docs/Model/PromotionsTiersGetResponseBodySummaryOrders.md new file mode 100644 index 0000000..294f08f --- /dev/null +++ b/docs/Model/PromotionsTiersGetResponseBodySummaryOrders.md @@ -0,0 +1,10 @@ +# # PromotionsTiersGetResponseBodySummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/PromotionsTiersGetResponseBodySummaryRedemptions.md b/docs/Model/PromotionsTiersGetResponseBodySummaryRedemptions.md new file mode 100644 index 0000000..399a0c4 --- /dev/null +++ b/docs/Model/PromotionsTiersGetResponseBodySummaryRedemptions.md @@ -0,0 +1,9 @@ +# # PromotionsTiersGetResponseBodySummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/PromotionsTiersListResponseBody.md b/docs/Model/PromotionsTiersListResponseBody.md new file mode 100644 index 0000000..b898bc0 --- /dev/null +++ b/docs/Model/PromotionsTiersListResponseBody.md @@ -0,0 +1,13 @@ +# # PromotionsTiersListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional] [default to 'tiers'] +**tiers** | [**\OpenAPI\Client\Model\PromotionTier[]**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] +**total** | **int** | Total number of promotion tiers. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [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/PromotionsTiersUpdateRequestBody.md b/docs/Model/PromotionsTiersUpdateRequestBody.md new file mode 100644 index 0000000..b217663 --- /dev/null +++ b/docs/Model/PromotionsTiersUpdateRequestBody.md @@ -0,0 +1,21 @@ +# # PromotionsTiersUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionsTiersUpdateRequestBodyAction**](PromotionsTiersUpdateRequestBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category** | **string** | Assign a new or update the promotion tier's category using name. | [optional] +**categoryId** | **string** | Assign a new or update the promotion tier's category using id | [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/PromotionsTiersUpdateRequestBodyAction.md b/docs/Model/PromotionsTiersUpdateRequestBodyAction.md new file mode 100644 index 0000000..c4faac3 --- /dev/null +++ b/docs/Model/PromotionsTiersUpdateRequestBodyAction.md @@ -0,0 +1,9 @@ +# # PromotionsTiersUpdateRequestBodyAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionsTiersUpdateResponseBody.md b/docs/Model/PromotionsTiersUpdateResponseBody.md new file mode 100644 index 0000000..cff8504 --- /dev/null +++ b/docs/Model/PromotionsTiersUpdateResponseBody.md @@ -0,0 +1,30 @@ +# # PromotionsTiersUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodyAction**](PromotionsTiersUpdateResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodyCampaign**](PromotionsTiersUpdateResponseBodyCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummary**](PromotionsTiersUpdateResponseBodySummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/PromotionsTiersUpdateResponseBodyAction.md b/docs/Model/PromotionsTiersUpdateResponseBodyAction.md new file mode 100644 index 0000000..bc5d0c2 --- /dev/null +++ b/docs/Model/PromotionsTiersUpdateResponseBodyAction.md @@ -0,0 +1,9 @@ +# # PromotionsTiersUpdateResponseBodyAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/PromotionsTiersUpdateResponseBodyCampaign.md b/docs/Model/PromotionsTiersUpdateResponseBodyCampaign.md new file mode 100644 index 0000000..c1212c0 --- /dev/null +++ b/docs/Model/PromotionsTiersUpdateResponseBodyCampaign.md @@ -0,0 +1,17 @@ +# # PromotionsTiersUpdateResponseBodyCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PromotionsTiersUpdateResponseBodySummary.md b/docs/Model/PromotionsTiersUpdateResponseBodySummary.md new file mode 100644 index 0000000..cbee3aa --- /dev/null +++ b/docs/Model/PromotionsTiersUpdateResponseBodySummary.md @@ -0,0 +1,10 @@ +# # PromotionsTiersUpdateResponseBodySummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummaryRedemptions**](PromotionsTiersUpdateResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummaryOrders**](PromotionsTiersUpdateResponseBodySummaryOrders.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/PromotionsTiersUpdateResponseBodySummaryOrders.md b/docs/Model/PromotionsTiersUpdateResponseBodySummaryOrders.md new file mode 100644 index 0000000..bb82527 --- /dev/null +++ b/docs/Model/PromotionsTiersUpdateResponseBodySummaryOrders.md @@ -0,0 +1,10 @@ +# # PromotionsTiersUpdateResponseBodySummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/PromotionsTiersUpdateResponseBodySummaryRedemptions.md b/docs/Model/PromotionsTiersUpdateResponseBodySummaryRedemptions.md new file mode 100644 index 0000000..0935da5 --- /dev/null +++ b/docs/Model/PromotionsTiersUpdateResponseBodySummaryRedemptions.md @@ -0,0 +1,9 @@ +# # PromotionsTiersUpdateResponseBodySummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/PublicationsCreateRequestBody.md b/docs/Model/PublicationsCreateRequestBody.md new file mode 100644 index 0000000..0a88119 --- /dev/null +++ b/docs/Model/PublicationsCreateRequestBody.md @@ -0,0 +1,14 @@ +# # PublicationsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**voucher** | **string** | Code of the voucher being published. | [optional] +**sourceId** | **string** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] +**customer** | [**\OpenAPI\Client\Model\PublicationsCreateRequestBodyCustomer**](PublicationsCreateRequestBodyCustomer.md) | | [optional] +**metadata** | **object** | | [optional] +**channel** | **string** | Specify the distribution channel. | [optional] +**campaign** | [**\OpenAPI\Client\Model\CreatePublicationCampaign**](CreatePublicationCampaign.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/PublicationsCreateRequestBodyCustomer.md b/docs/Model/PublicationsCreateRequestBodyCustomer.md new file mode 100644 index 0000000..d4c4aa0 --- /dev/null +++ b/docs/Model/PublicationsCreateRequestBodyCustomer.md @@ -0,0 +1,18 @@ +# # PublicationsCreateRequestBodyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**sourceId** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\PublicationsCreateRequestBodyCustomerAddress**](PublicationsCreateRequestBodyCustomerAddress.md) | | [optional] +**metadata** | **object** | | [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/PublicationsCreateRequestBodyCustomerAddress.md b/docs/Model/PublicationsCreateRequestBodyCustomerAddress.md new file mode 100644 index 0000000..034cba4 --- /dev/null +++ b/docs/Model/PublicationsCreateRequestBodyCustomerAddress.md @@ -0,0 +1,14 @@ +# # PublicationsCreateRequestBodyCustomerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/PublicationsCreateResponseBody.md b/docs/Model/PublicationsCreateResponseBody.md new file mode 100644 index 0000000..611da01 --- /dev/null +++ b/docs/Model/PublicationsCreateResponseBody.md @@ -0,0 +1,21 @@ +# # PublicationsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique publication ID, assigned by Voucherify. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the `publication`. | [optional] [default to 'publication'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer receiving the publication. | [optional] +**trackingId** | **string** | Customer's `source_id`. | [optional] +**metadata** | **object** | | [optional] +**channel** | **string** | How the publication was originated. It can be your own custom channel or an example value provided here. | [optional] [default to 'API'] +**sourceId** | **string** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | [optional] +**result** | **string** | Status of the publication attempt. | [optional] [default to 'SUCCESS'] +**customer** | [**\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] +**vouchersId** | **string[]** | Contains the unique internal voucher ID that was assigned by Voucherify. | [optional] +**voucher** | [**\OpenAPI\Client\Model\Voucher**](Voucher.md) | | [optional] +**vouchers** | **string[]** | Contains the unique voucher codes that was assigned by Voucherify. | [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/PublicationsListResponseBody.md b/docs/Model/PublicationsListResponseBody.md new file mode 100644 index 0000000..7ab3572 --- /dev/null +++ b/docs/Model/PublicationsListResponseBody.md @@ -0,0 +1,12 @@ +# # PublicationsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about publications in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of publications. | [optional] [default to 'publications'] +**publications** | [**\OpenAPI\Client\Model\PublicationsListResponseBodyPublicationsItem[]**](PublicationsListResponseBodyPublicationsItem.md) | Response schema model for publishing vouchers to a specific customer. | [optional] +**total** | **int** | Total number of publications. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PublicationsListResponseBodyPublicationsItem.md b/docs/Model/PublicationsListResponseBodyPublicationsItem.md new file mode 100644 index 0000000..4ec457a --- /dev/null +++ b/docs/Model/PublicationsListResponseBodyPublicationsItem.md @@ -0,0 +1,23 @@ +# # PublicationsListResponseBodyPublicationsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique publication ID, assigned by Voucherify. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the `publication`. | [optional] [default to 'publication'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer receiving the publication. | [optional] +**trackingId** | **string** | Customer's `source_id`. | [optional] +**metadata** | [**\OpenAPI\Client\Model\PublicationsListResponseBodyPublicationsItemMetadata**](PublicationsListResponseBodyPublicationsItemMetadata.md) | | [optional] +**channel** | **string** | How the publication was originated. It can be your own custom channel or an example value provided here. | [optional] +**sourceId** | **string** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | [optional] +**customer** | [**\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] +**vouchers** | **string[]** | Contains the voucher IDs that was assigned by Voucherify. and Contains the unique voucher codes that was assigned by Voucherify. | [optional] +**vouchersId** | **string[]** | Contains the unique internal voucher IDs that was assigned by Voucherify. | [optional] +**result** | **string** | | [optional] +**voucher** | [**\OpenAPI\Client\Model\ListPublicationsItemVoucher**](ListPublicationsItemVoucher.md) | | [optional] +**failureCode** | **string** | Generic reason as to why the create publication operation failed. | [optional] +**failureMessage** | **string** | This parameter will provide more expanded reason as to why the create publication operation failed. | [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/PublicationsListResponseBodyPublicationsItemMetadata.md b/docs/Model/PublicationsListResponseBodyPublicationsItemMetadata.md new file mode 100644 index 0000000..d998488 --- /dev/null +++ b/docs/Model/PublicationsListResponseBodyPublicationsItemMetadata.md @@ -0,0 +1,11 @@ +# # PublicationsListResponseBodyPublicationsItemMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceType** | **string** | Defines the type of the distribution source. | [optional] +**sourceId** | **string** | Unique identifier of the distribution source. | [optional] +**distributionId** | **string** | Unique identifier of the distribution. | [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/QualificationsCheckEligibilityRequestBody.md b/docs/Model/QualificationsCheckEligibilityRequestBody.md new file mode 100644 index 0000000..59a19a0 --- /dev/null +++ b/docs/Model/QualificationsCheckEligibilityRequestBody.md @@ -0,0 +1,14 @@ +# # QualificationsCheckEligibilityRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**trackingId** | **string** | Is correspondent to Customer's source_id | [optional] +**scenario** | **string** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] +**options** | [**\OpenAPI\Client\Model\QualificationsOption**](QualificationsOption.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/QualificationsCheckEligibilityResponseBody.md b/docs/Model/QualificationsCheckEligibilityResponseBody.md new file mode 100644 index 0000000..5261c11 --- /dev/null +++ b/docs/Model/QualificationsCheckEligibilityResponseBody.md @@ -0,0 +1,12 @@ +# # QualificationsCheckEligibilityResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemables** | [**\OpenAPI\Client\Model\QualificationsRedeemables**](QualificationsRedeemables.md) | | [optional] +**trackingId** | **string** | This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**stackingRules** | [**\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/QualificationsCheckEligibilityResponseBodyOrder.md b/docs/Model/QualificationsCheckEligibilityResponseBodyOrder.md new file mode 100644 index 0000000..573fa1d --- /dev/null +++ b/docs/Model/QualificationsCheckEligibilityResponseBodyOrder.md @@ -0,0 +1,20 @@ +# # QualificationsCheckEligibilityResponseBodyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**items** | [**\OpenAPI\Client\Model\OrderItem[]**](OrderItem.md) | Array of items applied to the order. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**customer_id** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrer** | [**\OpenAPI\Client\Model\Referrer**](Referrer.md) | | [optional] +**referrer_id** | **string** | Unique referrer ID. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**created_at** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [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/QualificationsFieldConditions.md b/docs/Model/QualificationsFieldConditions.md new file mode 100644 index 0000000..c1bbe69 --- /dev/null +++ b/docs/Model/QualificationsFieldConditions.md @@ -0,0 +1,9 @@ +# # QualificationsFieldConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\QualificationsFiltersCondition**](QualificationsFiltersCondition.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/QualificationsFiltersCondition.md b/docs/Model/QualificationsFiltersCondition.md new file mode 100644 index 0000000..8ad1521 --- /dev/null +++ b/docs/Model/QualificationsFiltersCondition.md @@ -0,0 +1,14 @@ +# # QualificationsFiltersCondition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is** | **string[]** | | [optional] +**isNot** | **string[]** | | [optional] +**hasValue** | **mixed** | | [optional] +**isUnknown** | **mixed** | | [optional] +**in** | **string[]** | | [optional] +**notIn** | **string[]** | | [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/QualificationsOption.md b/docs/Model/QualificationsOption.md new file mode 100644 index 0000000..90c44d4 --- /dev/null +++ b/docs/Model/QualificationsOption.md @@ -0,0 +1,13 @@ +# # QualificationsOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**limit** | **int** | The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5 | [optional] +**startingAfter** | **\DateTime** | Cursor used for paging. | [optional] +**filters** | [**\OpenAPI\Client\Model\QualificationsOptionFilters**](QualificationsOptionFilters.md) | | [optional] +**expand** | **string[]** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"redeemable\"] | - Returns the redeemables' metadata. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [\"validation_rules\"] | - Returns an expanded `validation_rules` object, showing details about the validation rules. | | [optional] +**sortingRule** | **string** | Is used to determine the order in which data is displayed in the result array. - `DEFAULT` - Sorting descending by `created_at` - `BEST_DEAL` - Sorting descending by `total_applied_discount_amount` - `LEAST_DEAL` - Sorting ascending by `total_applied_discount_amount` | [optional] + +[[Back to Model list]](../../README.md#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 new file mode 100644 index 0000000..0f4de5d --- /dev/null +++ b/docs/Model/QualificationsOptionFilters.md @@ -0,0 +1,17 @@ +# # QualificationsOptionFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | **string** | Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. | [optional] +**categoryId** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**campaignId** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**campaignType** | [**\OpenAPI\Client\Model\QualificationsOptionFiltersCampaignType**](QualificationsOptionFiltersCampaignType.md) | | [optional] +**resourceId** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**resourceType** | [**\OpenAPI\Client\Model\QualificationsOptionFiltersResourceType**](QualificationsOptionFiltersResourceType.md) | | [optional] +**voucherType** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**code** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**holderRole** | [**\OpenAPI\Client\Model\QualificationsOptionFiltersHolderRole**](QualificationsOptionFiltersHolderRole.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/QualificationsOptionFiltersCampaignType.md b/docs/Model/QualificationsOptionFiltersCampaignType.md new file mode 100644 index 0000000..02bf6e1 --- /dev/null +++ b/docs/Model/QualificationsOptionFiltersCampaignType.md @@ -0,0 +1,9 @@ +# # QualificationsOptionFiltersCampaignType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\QualificationsOptionFiltersCampaignTypeConditions**](QualificationsOptionFiltersCampaignTypeConditions.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/QualificationsOptionFiltersCampaignTypeConditions.md b/docs/Model/QualificationsOptionFiltersCampaignTypeConditions.md new file mode 100644 index 0000000..07382e3 --- /dev/null +++ b/docs/Model/QualificationsOptionFiltersCampaignTypeConditions.md @@ -0,0 +1,12 @@ +# # QualificationsOptionFiltersCampaignTypeConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is** | **string[]** | | [optional] +**isNot** | **string[]** | | [optional] +**in** | **string[]** | | [optional] +**notIn** | **string[]** | | [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/QualificationsOptionFiltersHolderRole.md b/docs/Model/QualificationsOptionFiltersHolderRole.md new file mode 100644 index 0000000..231d8d5 --- /dev/null +++ b/docs/Model/QualificationsOptionFiltersHolderRole.md @@ -0,0 +1,9 @@ +# # QualificationsOptionFiltersHolderRole + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\QualificationsOptionFiltersHolderRoleConditions**](QualificationsOptionFiltersHolderRoleConditions.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/QualificationsOptionFiltersHolderRoleConditions.md b/docs/Model/QualificationsOptionFiltersHolderRoleConditions.md new file mode 100644 index 0000000..d272106 --- /dev/null +++ b/docs/Model/QualificationsOptionFiltersHolderRoleConditions.md @@ -0,0 +1,12 @@ +# # QualificationsOptionFiltersHolderRoleConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is** | **string[]** | Will return records only for the first value in the array. | [optional] +**isNot** | **string[]** | Will return records only for the first value in the array. | [optional] +**in** | **string[]** | Will return records for the values in the array. | [optional] +**notIn** | **string[]** | Will return records for the values 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/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..9042ce6 --- /dev/null +++ b/docs/Model/QualificationsOptionFiltersResourceTypeConditions.md @@ -0,0 +1,12 @@ +# # QualificationsOptionFiltersResourceTypeConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is** | **string[]** | | [optional] +**isNot** | **string[]** | | [optional] +**in** | **string[]** | | [optional] +**notIn** | **string[]** | | [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/QualificationsRedeemable.md b/docs/Model/QualificationsRedeemable.md new file mode 100644 index 0000000..1f67b7a --- /dev/null +++ b/docs/Model/QualificationsRedeemable.md @@ -0,0 +1,24 @@ +# # QualificationsRedeemable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Id of the redeemable. | [optional] +**object** | **string** | Object type of the redeemable. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**result** | [**\OpenAPI\Client\Model\RedeemableResult**](RedeemableResult.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**validationRuleId** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ApplicableToResultList**](ApplicableToResultList.md) | | [optional] +**inapplicableTo** | [**\OpenAPI\Client\Model\InapplicableToResultList**](InapplicableToResultList.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | List of category information. | [optional] +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**name** | **string** | Name of the redeemable. | [optional] +**campaignName** | **string** | Name of the campaign associated to the redeemable. This field is available only if object is not `campaign` | [optional] +**campaignId** | **string** | Id of the campaign associated to the redeemable. This field is available only if object is not `campaign` | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**redeemables** | [**\OpenAPI\Client\Model\QualificationsRedeemableBase[]**](QualificationsRedeemableBase.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/QualificationsRedeemableBase.md b/docs/Model/QualificationsRedeemableBase.md new file mode 100644 index 0000000..42f1d60 --- /dev/null +++ b/docs/Model/QualificationsRedeemableBase.md @@ -0,0 +1,23 @@ +# # QualificationsRedeemableBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Id of the redeemable. | [optional] +**object** | **string** | Object type of the redeemable. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**result** | [**\OpenAPI\Client\Model\RedeemableResult**](RedeemableResult.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**validationRuleId** | **string** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ApplicableToResultList**](ApplicableToResultList.md) | | [optional] +**inapplicableTo** | [**\OpenAPI\Client\Model\InapplicableToResultList**](InapplicableToResultList.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | List of category information. | [optional] +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**name** | **string** | Name of the redeemable. | [optional] +**campaignName** | **string** | Name of the campaign associated to the redeemable. This field is available only if object is not `campaign` | [optional] +**campaignId** | **string** | Id of the campaign associated to the redeemable. This field is available only if object is not `campaign` | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.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/QualificationsRedeemables.md b/docs/Model/QualificationsRedeemables.md new file mode 100644 index 0000000..b7140e1 --- /dev/null +++ b/docs/Model/QualificationsRedeemables.md @@ -0,0 +1,14 @@ +# # QualificationsRedeemables + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. Default is `list`. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of qualified redeemables. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\QualificationsRedeemable[]**](QualificationsRedeemable.md) | Array of qualified redeemables. | [optional] +**total** | **int** | The number of redeemables returned in the API request. | [optional] +**hasMore** | **bool** | As results are always limited, the `has_more` flag indicates if there are more records for given parameters. This lets you know if you can run another request (with different options) to get more records returned in the results. | [optional] +**moreStartingAfter** | **\DateTime** | Timestamp representing the date and time to use in `starting_after` cursor to get more redeemables. | [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/RedeemableGift.md b/docs/Model/RedeemableGift.md new file mode 100644 index 0000000..a693802 --- /dev/null +++ b/docs/Model/RedeemableGift.md @@ -0,0 +1,10 @@ +# # RedeemableGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balance** | **float** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**credits** | **float** | The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedeemableLoyaltyCard.md b/docs/Model/RedeemableLoyaltyCard.md new file mode 100644 index 0000000..6efb1c5 --- /dev/null +++ b/docs/Model/RedeemableLoyaltyCard.md @@ -0,0 +1,13 @@ +# # RedeemableLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**exchangeRatio** | **float** | The cash equivalent of the points defined in the points_ratio property. | [optional] +**pointsRatio** | **int** | The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. | [optional] +**transfers** | [**\OpenAPI\Client\Model\LoyaltiesTransferPoints[]**](LoyaltiesTransferPoints.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/RedeemableResult.md b/docs/Model/RedeemableResult.md new file mode 100644 index 0000000..36d0ca1 --- /dev/null +++ b/docs/Model/RedeemableResult.md @@ -0,0 +1,12 @@ +# # RedeemableResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedeemableGift**](RedeemableGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedeemableLoyaltyCard**](RedeemableLoyaltyCard.md) | | [optional] +**error** | [**\OpenAPI\Client\Model\Error**](Error.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/RedeemableVoucher.md b/docs/Model/RedeemableVoucher.md new file mode 100644 index 0000000..45199a0 --- /dev/null +++ b/docs/Model/RedeemableVoucher.md @@ -0,0 +1,36 @@ +# # RedeemableVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | The value is null. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**categories** | **object[]** | Contains an empty array. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedeemableVoucherGift**](RedeemableVoucherGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedeemableVoucherLoyaltyCard**](RedeemableVoucherLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\RedeemableVoucherPublish**](RedeemableVoucherPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\RedeemableVoucherRedemption**](RedeemableVoucherRedemption.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/RedeemableVoucherGift.md b/docs/Model/RedeemableVoucherGift.md new file mode 100644 index 0000000..d9d758b --- /dev/null +++ b/docs/Model/RedeemableVoucherGift.md @@ -0,0 +1,11 @@ +# # RedeemableVoucherGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/RedeemableVoucherLoyaltyCard.md b/docs/Model/RedeemableVoucherLoyaltyCard.md new file mode 100644 index 0000000..520faae --- /dev/null +++ b/docs/Model/RedeemableVoucherLoyaltyCard.md @@ -0,0 +1,12 @@ +# # RedeemableVoucherLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/RedeemableVoucherPublish.md b/docs/Model/RedeemableVoucherPublish.md new file mode 100644 index 0000000..6324fbf --- /dev/null +++ b/docs/Model/RedeemableVoucherPublish.md @@ -0,0 +1,11 @@ +# # RedeemableVoucherPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedeemableVoucherRedemption.md b/docs/Model/RedeemableVoucherRedemption.md new file mode 100644 index 0000000..cde25b7 --- /dev/null +++ b/docs/Model/RedeemableVoucherRedemption.md @@ -0,0 +1,13 @@ +# # RedeemableVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Redemption.md b/docs/Model/Redemption.md new file mode 100644 index 0000000..65c39e0 --- /dev/null +++ b/docs/Model/Redemption.md @@ -0,0 +1,31 @@ +# # Redemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**object** | **string** | The type of the object represented by the JSON | [optional] [default to 'redemption'] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the redeeming customer. | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. | [optional] +**redemption** | **string** | Unique redemption ID of the parent redemption. | [optional] +**result** | **string** | Redemption result. | [optional] +**status** | **string** | Redemption status. | [optional] +**relatedRedemptions** | [**\OpenAPI\Client\Model\RedemptionRelatedRedemptions**](RedemptionRelatedRedemptions.md) | | [optional] +**failureCode** | **string** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failureMessage** | **string** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**channel** | [**\OpenAPI\Client\Model\RedemptionChannel**](RedemptionChannel.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.md) | | [optional] +**relatedObjectType** | **string** | Defines the related object. | [optional] +**relatedObjectId** | **string** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] +**voucher** | [**\OpenAPI\Client\Model\RedemptionVoucher**](RedemptionVoucher.md) | | [optional] +**promotionTier** | [**\OpenAPI\Client\Model\PromotionTier**](PromotionTier.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionGift**](RedemptionGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionLoyaltyCard**](RedemptionLoyaltyCard.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/RedemptionChannel.md b/docs/Model/RedemptionChannel.md new file mode 100644 index 0000000..5fa5d18 --- /dev/null +++ b/docs/Model/RedemptionChannel.md @@ -0,0 +1,10 @@ +# # RedemptionChannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channelId** | **string** | Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] +**channelType** | **string** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntry.md b/docs/Model/RedemptionEntry.md new file mode 100644 index 0000000..37d960d --- /dev/null +++ b/docs/Model/RedemptionEntry.md @@ -0,0 +1,32 @@ +# # RedemptionEntry + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**object** | **string** | | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the redeeming customer. | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**metadata** | **object** | | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **string** | Unique redemption ID of the parent redemption. | [optional] +**result** | **string** | Redemption result. | [optional] +**status** | **string** | | [optional] +**relatedRedemptions** | [**\OpenAPI\Client\Model\RedemptionEntryRelatedRedemptions**](RedemptionEntryRelatedRedemptions.md) | | [optional] +**failureCode** | **string** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failureMessage** | **string** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**\OpenAPI\Client\Model\RedemptionEntryOrder**](RedemptionEntryOrder.md) | | [optional] +**channel** | [**\OpenAPI\Client\Model\RedemptionEntryChannel**](RedemptionEntryChannel.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\RedemptionEntryCustomer**](RedemptionEntryCustomer.md) | | [optional] +**relatedObjectType** | **string** | Defines the related object. | [optional] +**relatedObjectId** | **string** | | [optional] +**voucher** | [**\OpenAPI\Client\Model\RedemptionEntryVoucher**](RedemptionEntryVoucher.md) | | [optional] +**promotionTier** | [**\OpenAPI\Client\Model\RedemptionEntryPromotionTier**](RedemptionEntryPromotionTier.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionEntryGift**](RedemptionEntryGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionEntryLoyaltyCard**](RedemptionEntryLoyaltyCard.md) | | [optional] +**reason** | **string** | System generated cause for the redemption being invalid in the context of the provided parameters. | [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/RedemptionEntryChannel.md b/docs/Model/RedemptionEntryChannel.md new file mode 100644 index 0000000..65a38b6 --- /dev/null +++ b/docs/Model/RedemptionEntryChannel.md @@ -0,0 +1,10 @@ +# # RedemptionEntryChannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channelId** | **string** | | [optional] +**channelType** | **string** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryCustomer.md b/docs/Model/RedemptionEntryCustomer.md new file mode 100644 index 0000000..be66d37 --- /dev/null +++ b/docs/Model/RedemptionEntryCustomer.md @@ -0,0 +1,14 @@ +# # RedemptionEntryCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**email** | **string** | Customer's email address. | [optional] +**sourceId** | **string** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] +**metadata** | **object** | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryGift.md b/docs/Model/RedemptionEntryGift.md new file mode 100644 index 0000000..81ab542 --- /dev/null +++ b/docs/Model/RedemptionEntryGift.md @@ -0,0 +1,9 @@ +# # RedemptionEntryGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryLoyaltyCard.md b/docs/Model/RedemptionEntryLoyaltyCard.md new file mode 100644 index 0000000..2282a89 --- /dev/null +++ b/docs/Model/RedemptionEntryLoyaltyCard.md @@ -0,0 +1,9 @@ +# # RedemptionEntryLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryOrder.md b/docs/Model/RedemptionEntryOrder.md new file mode 100644 index 0000000..7c93236 --- /dev/null +++ b/docs/Model/RedemptionEntryOrder.md @@ -0,0 +1,30 @@ +# # RedemptionEntryOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**itemsDiscountAmount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**totalDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**totalAmount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**appliedDiscountAmount** | **int** | This field shows the order-level discount applied. | [optional] +**itemsAppliedDiscountAmount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**totalAppliedDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**\OpenAPI\Client\Model\OrderCalculatedItem[]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\RedemptionEntryOrderCustomer**](RedemptionEntryOrderCustomer.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\RedemptionEntryOrderReferrer**](RedemptionEntryOrderReferrer.md) | | [optional] +**redemptions** | **object** | | [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/RedemptionEntryOrderCustomer.md b/docs/Model/RedemptionEntryOrderCustomer.md new file mode 100644 index 0000000..6921c78 --- /dev/null +++ b/docs/Model/RedemptionEntryOrderCustomer.md @@ -0,0 +1,10 @@ +# # RedemptionEntryOrderCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of an existing customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryOrderReferrer.md b/docs/Model/RedemptionEntryOrderReferrer.md new file mode 100644 index 0000000..d39a2ca --- /dev/null +++ b/docs/Model/RedemptionEntryOrderReferrer.md @@ -0,0 +1,10 @@ +# # RedemptionEntryOrderReferrer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of an existing customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryPromotionTier.md b/docs/Model/RedemptionEntryPromotionTier.md new file mode 100644 index 0000000..aa87b09 --- /dev/null +++ b/docs/Model/RedemptionEntryPromotionTier.md @@ -0,0 +1,30 @@ +# # RedemptionEntryPromotionTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\RedemptionEntryPromotionTierAction**](RedemptionEntryPromotionTierAction.md) | | [optional] +**metadata** | **object** | | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\RedemptionEntryPromotionTierCampaign**](RedemptionEntryPromotionTierCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\RedemptionEntryPromotionTierSummary**](RedemptionEntryPromotionTierSummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/RedemptionEntryPromotionTierAction.md b/docs/Model/RedemptionEntryPromotionTierAction.md new file mode 100644 index 0000000..ba61049 --- /dev/null +++ b/docs/Model/RedemptionEntryPromotionTierAction.md @@ -0,0 +1,9 @@ +# # RedemptionEntryPromotionTierAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/RedemptionEntryPromotionTierCampaign.md b/docs/Model/RedemptionEntryPromotionTierCampaign.md new file mode 100644 index 0000000..4ea4770 --- /dev/null +++ b/docs/Model/RedemptionEntryPromotionTierCampaign.md @@ -0,0 +1,17 @@ +# # RedemptionEntryPromotionTierCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryPromotionTierSummary.md b/docs/Model/RedemptionEntryPromotionTierSummary.md new file mode 100644 index 0000000..6200db5 --- /dev/null +++ b/docs/Model/RedemptionEntryPromotionTierSummary.md @@ -0,0 +1,10 @@ +# # RedemptionEntryPromotionTierSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\RedemptionEntryPromotionTierSummaryRedemptions**](RedemptionEntryPromotionTierSummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\RedemptionEntryPromotionTierSummaryOrders**](RedemptionEntryPromotionTierSummaryOrders.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/RedemptionEntryPromotionTierSummaryOrders.md b/docs/Model/RedemptionEntryPromotionTierSummaryOrders.md new file mode 100644 index 0000000..0b96cc2 --- /dev/null +++ b/docs/Model/RedemptionEntryPromotionTierSummaryOrders.md @@ -0,0 +1,10 @@ +# # RedemptionEntryPromotionTierSummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/RedemptionEntryPromotionTierSummaryRedemptions.md b/docs/Model/RedemptionEntryPromotionTierSummaryRedemptions.md new file mode 100644 index 0000000..ee3f8fc --- /dev/null +++ b/docs/Model/RedemptionEntryPromotionTierSummaryRedemptions.md @@ -0,0 +1,9 @@ +# # RedemptionEntryPromotionTierSummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/RedemptionEntryRelatedRedemptions.md b/docs/Model/RedemptionEntryRelatedRedemptions.md new file mode 100644 index 0000000..9839cc8 --- /dev/null +++ b/docs/Model/RedemptionEntryRelatedRedemptions.md @@ -0,0 +1,10 @@ +# # RedemptionEntryRelatedRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**\OpenAPI\Client\Model\RedemptionEntryRelatedRedemptionsRollbacksItem[]**](RedemptionEntryRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**\OpenAPI\Client\Model\RedemptionEntryRelatedRedemptionsRedemptionsItem[]**](RedemptionEntryRelatedRedemptionsRedemptionsItem.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/RedemptionEntryRelatedRedemptionsRedemptionsItem.md b/docs/Model/RedemptionEntryRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 0000000..e98c5fd --- /dev/null +++ b/docs/Model/RedemptionEntryRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,10 @@ +# # RedemptionEntryRelatedRedemptionsRedemptionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryRelatedRedemptionsRollbacksItem.md b/docs/Model/RedemptionEntryRelatedRedemptionsRollbacksItem.md new file mode 100644 index 0000000..d7567ea --- /dev/null +++ b/docs/Model/RedemptionEntryRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,10 @@ +# # RedemptionEntryRelatedRedemptionsRollbacksItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryVoucher.md b/docs/Model/RedemptionEntryVoucher.md new file mode 100644 index 0000000..387593c --- /dev/null +++ b/docs/Model/RedemptionEntryVoucher.md @@ -0,0 +1,38 @@ +# # RedemptionEntryVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionEntryVoucherGift**](RedemptionEntryVoucherGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionEntryVoucherLoyaltyCard**](RedemptionEntryVoucherLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\RedemptionEntryVoucherPublish**](RedemptionEntryVoucherPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\RedemptionEntryVoucherRedemption**](RedemptionEntryVoucherRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.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/RedemptionEntryVoucherGift.md b/docs/Model/RedemptionEntryVoucherGift.md new file mode 100644 index 0000000..7a34fe1 --- /dev/null +++ b/docs/Model/RedemptionEntryVoucherGift.md @@ -0,0 +1,11 @@ +# # RedemptionEntryVoucherGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/RedemptionEntryVoucherLoyaltyCard.md b/docs/Model/RedemptionEntryVoucherLoyaltyCard.md new file mode 100644 index 0000000..306325a --- /dev/null +++ b/docs/Model/RedemptionEntryVoucherLoyaltyCard.md @@ -0,0 +1,12 @@ +# # RedemptionEntryVoucherLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/RedemptionEntryVoucherPublish.md b/docs/Model/RedemptionEntryVoucherPublish.md new file mode 100644 index 0000000..34fcf42 --- /dev/null +++ b/docs/Model/RedemptionEntryVoucherPublish.md @@ -0,0 +1,11 @@ +# # RedemptionEntryVoucherPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionEntryVoucherRedemption.md b/docs/Model/RedemptionEntryVoucherRedemption.md new file mode 100644 index 0000000..3f6cf54 --- /dev/null +++ b/docs/Model/RedemptionEntryVoucherRedemption.md @@ -0,0 +1,13 @@ +# # RedemptionEntryVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionGift.md b/docs/Model/RedemptionGift.md new file mode 100644 index 0000000..aa30a4f --- /dev/null +++ b/docs/Model/RedemptionGift.md @@ -0,0 +1,9 @@ +# # RedemptionGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionLoyaltyCard.md b/docs/Model/RedemptionLoyaltyCard.md new file mode 100644 index 0000000..9d0e413 --- /dev/null +++ b/docs/Model/RedemptionLoyaltyCard.md @@ -0,0 +1,9 @@ +# # RedemptionLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionRelatedRedemptions.md b/docs/Model/RedemptionRelatedRedemptions.md new file mode 100644 index 0000000..9ad0797 --- /dev/null +++ b/docs/Model/RedemptionRelatedRedemptions.md @@ -0,0 +1,10 @@ +# # RedemptionRelatedRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**\OpenAPI\Client\Model\RedemptionRelatedRedemptionsRollbacksItem[]**](RedemptionRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**\OpenAPI\Client\Model\RedemptionRelatedRedemptionsRedemptionsItem[]**](RedemptionRelatedRedemptionsRedemptionsItem.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/RedemptionRelatedRedemptionsRedemptionsItem.md b/docs/Model/RedemptionRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 0000000..f7ab986 --- /dev/null +++ b/docs/Model/RedemptionRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,10 @@ +# # RedemptionRelatedRedemptionsRedemptionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionRelatedRedemptionsRollbacksItem.md b/docs/Model/RedemptionRelatedRedemptionsRollbacksItem.md new file mode 100644 index 0000000..a16c81c --- /dev/null +++ b/docs/Model/RedemptionRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,10 @@ +# # RedemptionRelatedRedemptionsRollbacksItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique rollback redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionRewardResult.md b/docs/Model/RedemptionRewardResult.md new file mode 100644 index 0000000..cc4da84 --- /dev/null +++ b/docs/Model/RedemptionRewardResult.md @@ -0,0 +1,22 @@ +# # RedemptionRewardResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.md) | | [optional] +**assignmentId** | **string** | Unique reward assignment ID assigned by Voucherify. | [optional] +**voucher** | [**\OpenAPI\Client\Model\Voucher**](Voucher.md) | | [optional] +**product** | [**\OpenAPI\Client\Model\Product**](Product.md) | | [optional] +**sku** | [**\OpenAPI\Client\Model\Sku**](Sku.md) | | [optional] +**loyaltyTierId** | **string** | Unique loyalty tier ID assigned by Voucherify. | [optional] +**id** | **string** | Unique reward ID. | [optional] +**name** | **string** | Name of the reward. | [optional] +**object** | **string** | The type of the object represented by the JSON | [optional] [default to 'reward'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp in ISO 8601 format indicating when the reward was updated. | [optional] +**parameters** | [**\OpenAPI\Client\Model\RedemptionRewardResultParameters**](RedemptionRewardResultParameters.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a reward. The metadata object stores all custom attributes assigned to the reward. | [optional] +**type** | **string** | Reward type. | [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/RedemptionRewardResultParameters.md b/docs/Model/RedemptionRewardResultParameters.md new file mode 100644 index 0000000..e47517e --- /dev/null +++ b/docs/Model/RedemptionRewardResultParameters.md @@ -0,0 +1,11 @@ +# # RedemptionRewardResultParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | [**\OpenAPI\Client\Model\RedemptionRewardResultParametersCampaign**](RedemptionRewardResultParametersCampaign.md) | | [optional] +**product** | [**\OpenAPI\Client\Model\RedemptionRewardResultParametersProduct**](RedemptionRewardResultParametersProduct.md) | | [optional] +**coin** | [**\OpenAPI\Client\Model\RedemptionRewardResultParametersCoin**](RedemptionRewardResultParametersCoin.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/RedemptionRewardResultParametersCampaign.md b/docs/Model/RedemptionRewardResultParametersCampaign.md new file mode 100644 index 0000000..6aac2b3 --- /dev/null +++ b/docs/Model/RedemptionRewardResultParametersCampaign.md @@ -0,0 +1,11 @@ +# # RedemptionRewardResultParametersCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Campaign unique ID. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**type** | **string** | Defines the type of the campaign. | [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/RedemptionRewardResultParametersCoin.md b/docs/Model/RedemptionRewardResultParametersCoin.md new file mode 100644 index 0000000..7715d92 --- /dev/null +++ b/docs/Model/RedemptionRewardResultParametersCoin.md @@ -0,0 +1,10 @@ +# # RedemptionRewardResultParametersCoin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchangeRatio** | **int** | The cash equivalent of the points defined in the `points_ratio` property. | [optional] +**pointsRatio** | **int** | The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionRewardResultParametersProduct.md b/docs/Model/RedemptionRewardResultParametersProduct.md new file mode 100644 index 0000000..04f4e01 --- /dev/null +++ b/docs/Model/RedemptionRewardResultParametersProduct.md @@ -0,0 +1,10 @@ +# # RedemptionRewardResultParametersProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID, assigned by Voucherify. | [optional] +**skuId** | **string** | Unique identifier of the SKU. It is assigned by Voucherify. | [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/RedemptionRollback.md b/docs/Model/RedemptionRollback.md new file mode 100644 index 0000000..0bd8181 --- /dev/null +++ b/docs/Model/RedemptionRollback.md @@ -0,0 +1,32 @@ +# # RedemptionRollback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the redemption rollback. | [optional] +**object** | **string** | The type of the object represented by the JSON | [optional] [default to 'redemption_rollback'] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the redeeming customer. | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] +**amount** | **int** | For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **string** | Unique redemption ID of the parent redemption. | [optional] +**reason** | **string** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] +**result** | **string** | Redemption result. | [optional] +**status** | **string** | Redemption status. | [optional] +**relatedRedemptions** | [**\OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptions**](RedemptionRollbackRelatedRedemptions.md) | | [optional] +**failureCode** | **string** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failureMessage** | **string** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**channel** | [**\OpenAPI\Client\Model\RedemptionRollbackChannel**](RedemptionRollbackChannel.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.md) | | [optional] +**relatedObjectType** | **string** | Defines the related object. | [optional] +**relatedObjectId** | **string** | Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [optional] +**voucher** | [**\OpenAPI\Client\Model\Voucher**](Voucher.md) | | [optional] +**promotionTier** | [**\OpenAPI\Client\Model\PromotionTier**](PromotionTier.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionRollbackGift**](RedemptionRollbackGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionRollbackLoyaltyCard**](RedemptionRollbackLoyaltyCard.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/RedemptionRollbackChannel.md b/docs/Model/RedemptionRollbackChannel.md new file mode 100644 index 0000000..15861d2 --- /dev/null +++ b/docs/Model/RedemptionRollbackChannel.md @@ -0,0 +1,10 @@ +# # RedemptionRollbackChannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channelId** | **string** | Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] +**channelType** | **string** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionRollbackGift.md b/docs/Model/RedemptionRollbackGift.md new file mode 100644 index 0000000..68b86de --- /dev/null +++ b/docs/Model/RedemptionRollbackGift.md @@ -0,0 +1,9 @@ +# # RedemptionRollbackGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionRollbackLoyaltyCard.md b/docs/Model/RedemptionRollbackLoyaltyCard.md new file mode 100644 index 0000000..ca4e5c2 --- /dev/null +++ b/docs/Model/RedemptionRollbackLoyaltyCard.md @@ -0,0 +1,9 @@ +# # RedemptionRollbackLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionRollbackRelatedRedemptions.md b/docs/Model/RedemptionRollbackRelatedRedemptions.md new file mode 100644 index 0000000..f884505 --- /dev/null +++ b/docs/Model/RedemptionRollbackRelatedRedemptions.md @@ -0,0 +1,10 @@ +# # RedemptionRollbackRelatedRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**\OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptionsRollbacksItem[]**](RedemptionRollbackRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**\OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptionsRedemptionsItem[]**](RedemptionRollbackRelatedRedemptionsRedemptionsItem.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/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md b/docs/Model/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 0000000..0eb4851 --- /dev/null +++ b/docs/Model/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,10 @@ +# # RedemptionRollbackRelatedRedemptionsRedemptionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionRollbackRelatedRedemptionsRollbacksItem.md b/docs/Model/RedemptionRollbackRelatedRedemptionsRollbacksItem.md new file mode 100644 index 0000000..2041265 --- /dev/null +++ b/docs/Model/RedemptionRollbackRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,10 @@ +# # RedemptionRollbackRelatedRedemptionsRollbacksItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the redemption rollback. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionVoucher.md b/docs/Model/RedemptionVoucher.md new file mode 100644 index 0000000..4f2ece5 --- /dev/null +++ b/docs/Model/RedemptionVoucher.md @@ -0,0 +1,38 @@ +# # RedemptionVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionVoucherGift**](RedemptionVoucherGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionVoucherLoyaltyCard**](RedemptionVoucherLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\RedemptionVoucherPublish**](RedemptionVoucherPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\RedemptionVoucherRedemption**](RedemptionVoucherRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.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/RedemptionVoucherGift.md b/docs/Model/RedemptionVoucherGift.md new file mode 100644 index 0000000..8b8dc87 --- /dev/null +++ b/docs/Model/RedemptionVoucherGift.md @@ -0,0 +1,11 @@ +# # RedemptionVoucherGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/RedemptionVoucherLoyaltyCard.md b/docs/Model/RedemptionVoucherLoyaltyCard.md new file mode 100644 index 0000000..4d3dab6 --- /dev/null +++ b/docs/Model/RedemptionVoucherLoyaltyCard.md @@ -0,0 +1,12 @@ +# # RedemptionVoucherLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/RedemptionVoucherPublish.md b/docs/Model/RedemptionVoucherPublish.md new file mode 100644 index 0000000..3c07440 --- /dev/null +++ b/docs/Model/RedemptionVoucherPublish.md @@ -0,0 +1,11 @@ +# # RedemptionVoucherPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionVoucherRedemption.md b/docs/Model/RedemptionVoucherRedemption.md new file mode 100644 index 0000000..b39cd2a --- /dev/null +++ b/docs/Model/RedemptionVoucherRedemption.md @@ -0,0 +1,13 @@ +# # RedemptionVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBody.md b/docs/Model/RedemptionsGetResponseBody.md new file mode 100644 index 0000000..c6b92dd --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBody.md @@ -0,0 +1,32 @@ +# # RedemptionsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**object** | **string** | | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the redeeming customer. | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**metadata** | **object** | | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **string** | Unique redemption ID of the parent redemption. | [optional] +**result** | **string** | Redemption result. | [optional] +**status** | **string** | | [optional] +**relatedRedemptions** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptions**](RedemptionsGetResponseBodyRelatedRedemptions.md) | | [optional] +**failureCode** | **string** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failureMessage** | **string** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyOrder**](RedemptionsGetResponseBodyOrder.md) | | [optional] +**channel** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyChannel**](RedemptionsGetResponseBodyChannel.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyCustomer**](RedemptionsGetResponseBodyCustomer.md) | | [optional] +**relatedObjectType** | **string** | Defines the related object. | [optional] +**relatedObjectId** | **string** | | [optional] +**voucher** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucher**](RedemptionsGetResponseBodyVoucher.md) | | [optional] +**promotionTier** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTier**](RedemptionsGetResponseBodyPromotionTier.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyGift**](RedemptionsGetResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyLoyaltyCard**](RedemptionsGetResponseBodyLoyaltyCard.md) | | [optional] +**reason** | **string** | System generated cause for the redemption being invalid in the context of the provided parameters. | [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/RedemptionsGetResponseBodyChannel.md b/docs/Model/RedemptionsGetResponseBodyChannel.md new file mode 100644 index 0000000..9153a16 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyChannel.md @@ -0,0 +1,10 @@ +# # RedemptionsGetResponseBodyChannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channelId** | **string** | | [optional] +**channelType** | **string** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyCustomer.md b/docs/Model/RedemptionsGetResponseBodyCustomer.md new file mode 100644 index 0000000..e4a44fe --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyCustomer.md @@ -0,0 +1,14 @@ +# # RedemptionsGetResponseBodyCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**email** | **string** | Customer's email address. | [optional] +**sourceId** | **string** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] +**metadata** | **object** | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyGift.md b/docs/Model/RedemptionsGetResponseBodyGift.md new file mode 100644 index 0000000..bfe638c --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyGift.md @@ -0,0 +1,9 @@ +# # RedemptionsGetResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyLoyaltyCard.md b/docs/Model/RedemptionsGetResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..b8634c3 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyLoyaltyCard.md @@ -0,0 +1,9 @@ +# # RedemptionsGetResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyOrder.md b/docs/Model/RedemptionsGetResponseBodyOrder.md new file mode 100644 index 0000000..9a1728c --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyOrder.md @@ -0,0 +1,30 @@ +# # RedemptionsGetResponseBodyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**itemsDiscountAmount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**totalDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**totalAmount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**appliedDiscountAmount** | **int** | This field shows the order-level discount applied. | [optional] +**itemsAppliedDiscountAmount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**totalAppliedDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**\OpenAPI\Client\Model\OrderCalculatedItem[]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyOrderCustomer**](RedemptionsGetResponseBodyOrderCustomer.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyOrderReferrer**](RedemptionsGetResponseBodyOrderReferrer.md) | | [optional] +**redemptions** | **object** | | [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/RedemptionsGetResponseBodyOrderCustomer.md b/docs/Model/RedemptionsGetResponseBodyOrderCustomer.md new file mode 100644 index 0000000..f657ad9 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyOrderCustomer.md @@ -0,0 +1,10 @@ +# # RedemptionsGetResponseBodyOrderCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of an existing customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyOrderReferrer.md b/docs/Model/RedemptionsGetResponseBodyOrderReferrer.md new file mode 100644 index 0000000..dc8fc6d --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyOrderReferrer.md @@ -0,0 +1,10 @@ +# # RedemptionsGetResponseBodyOrderReferrer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of an existing customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyPromotionTier.md b/docs/Model/RedemptionsGetResponseBodyPromotionTier.md new file mode 100644 index 0000000..08f57e4 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyPromotionTier.md @@ -0,0 +1,30 @@ +# # RedemptionsGetResponseBodyPromotionTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierAction**](RedemptionsGetResponseBodyPromotionTierAction.md) | | [optional] +**metadata** | **object** | | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierCampaign**](RedemptionsGetResponseBodyPromotionTierCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummary**](RedemptionsGetResponseBodyPromotionTierSummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/RedemptionsGetResponseBodyPromotionTierAction.md b/docs/Model/RedemptionsGetResponseBodyPromotionTierAction.md new file mode 100644 index 0000000..4746b9e --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyPromotionTierAction.md @@ -0,0 +1,9 @@ +# # RedemptionsGetResponseBodyPromotionTierAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/RedemptionsGetResponseBodyPromotionTierCampaign.md b/docs/Model/RedemptionsGetResponseBodyPromotionTierCampaign.md new file mode 100644 index 0000000..187193a --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyPromotionTierCampaign.md @@ -0,0 +1,17 @@ +# # RedemptionsGetResponseBodyPromotionTierCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyPromotionTierSummary.md b/docs/Model/RedemptionsGetResponseBodyPromotionTierSummary.md new file mode 100644 index 0000000..e238f22 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyPromotionTierSummary.md @@ -0,0 +1,10 @@ +# # RedemptionsGetResponseBodyPromotionTierSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummaryRedemptions**](RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummaryOrders**](RedemptionsGetResponseBodyPromotionTierSummaryOrders.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/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md b/docs/Model/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md new file mode 100644 index 0000000..309ba31 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md @@ -0,0 +1,10 @@ +# # RedemptionsGetResponseBodyPromotionTierSummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md b/docs/Model/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md new file mode 100644 index 0000000..75e6567 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md @@ -0,0 +1,9 @@ +# # RedemptionsGetResponseBodyPromotionTierSummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/RedemptionsGetResponseBodyRelatedRedemptions.md b/docs/Model/RedemptionsGetResponseBodyRelatedRedemptions.md new file mode 100644 index 0000000..1855def --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyRelatedRedemptions.md @@ -0,0 +1,10 @@ +# # RedemptionsGetResponseBodyRelatedRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem[]**](RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem[]**](RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.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/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 0000000..8766137 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,10 @@ +# # RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 0000000..ab57d04 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,10 @@ +# # RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyVoucher.md b/docs/Model/RedemptionsGetResponseBodyVoucher.md new file mode 100644 index 0000000..e741dc8 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyVoucher.md @@ -0,0 +1,38 @@ +# # RedemptionsGetResponseBodyVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherGift**](RedemptionsGetResponseBodyVoucherGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherLoyaltyCard**](RedemptionsGetResponseBodyVoucherLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherPublish**](RedemptionsGetResponseBodyVoucherPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherRedemption**](RedemptionsGetResponseBodyVoucherRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.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/RedemptionsGetResponseBodyVoucherGift.md b/docs/Model/RedemptionsGetResponseBodyVoucherGift.md new file mode 100644 index 0000000..8dc432d --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyVoucherGift.md @@ -0,0 +1,11 @@ +# # RedemptionsGetResponseBodyVoucherGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/RedemptionsGetResponseBodyVoucherLoyaltyCard.md b/docs/Model/RedemptionsGetResponseBodyVoucherLoyaltyCard.md new file mode 100644 index 0000000..f262c91 --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyVoucherLoyaltyCard.md @@ -0,0 +1,12 @@ +# # RedemptionsGetResponseBodyVoucherLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/RedemptionsGetResponseBodyVoucherPublish.md b/docs/Model/RedemptionsGetResponseBodyVoucherPublish.md new file mode 100644 index 0000000..cb8191a --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyVoucherPublish.md @@ -0,0 +1,11 @@ +# # RedemptionsGetResponseBodyVoucherPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsGetResponseBodyVoucherRedemption.md b/docs/Model/RedemptionsGetResponseBodyVoucherRedemption.md new file mode 100644 index 0000000..16a8e3e --- /dev/null +++ b/docs/Model/RedemptionsGetResponseBodyVoucherRedemption.md @@ -0,0 +1,13 @@ +# # RedemptionsGetResponseBodyVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBody.md b/docs/Model/RedemptionsListResponseBody.md new file mode 100644 index 0000000..7763ca9 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBody.md @@ -0,0 +1,12 @@ +# # RedemptionsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about redemptions in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of redemption objects. | [optional] [default to 'redemptions'] +**redemptions** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItem[]**](RedemptionsListResponseBodyRedemptionsItem.md) | | [optional] +**total** | **int** | Total number of redemptions. | [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/RedemptionsListResponseBodyRedemptionsItem.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItem.md new file mode 100644 index 0000000..8d0b873 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItem.md @@ -0,0 +1,32 @@ +# # RedemptionsListResponseBodyRedemptionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**object** | **string** | | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the redeeming customer. | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**metadata** | **object** | | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **string** | Unique redemption ID of the parent redemption. | [optional] +**result** | **string** | Redemption result. | [optional] +**status** | **string** | | [optional] +**relatedRedemptions** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md) | | [optional] +**failureCode** | **string** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failureMessage** | **string** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrder**](RedemptionsListResponseBodyRedemptionsItemOrder.md) | | [optional] +**channel** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemChannel**](RedemptionsListResponseBodyRedemptionsItemChannel.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemCustomer**](RedemptionsListResponseBodyRedemptionsItemCustomer.md) | | [optional] +**relatedObjectType** | **string** | Defines the related object. | [optional] +**relatedObjectId** | **string** | | [optional] +**voucher** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucher**](RedemptionsListResponseBodyRedemptionsItemVoucher.md) | | [optional] +**promotionTier** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTier**](RedemptionsListResponseBodyRedemptionsItemPromotionTier.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemGift**](RedemptionsListResponseBodyRedemptionsItemGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemLoyaltyCard**](RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md) | | [optional] +**reason** | **string** | System generated cause for the redemption being invalid in the context of the provided parameters. | [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/RedemptionsListResponseBodyRedemptionsItemChannel.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemChannel.md new file mode 100644 index 0000000..51ebf64 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemChannel.md @@ -0,0 +1,10 @@ +# # RedemptionsListResponseBodyRedemptionsItemChannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channelId** | **string** | | [optional] +**channelType** | **string** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemCustomer.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemCustomer.md new file mode 100644 index 0000000..bdf18a0 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemCustomer.md @@ -0,0 +1,14 @@ +# # RedemptionsListResponseBodyRedemptionsItemCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**email** | **string** | Customer's email address. | [optional] +**sourceId** | **string** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] +**metadata** | **object** | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemGift.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemGift.md new file mode 100644 index 0000000..ba80e35 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemGift.md @@ -0,0 +1,9 @@ +# # RedemptionsListResponseBodyRedemptionsItemGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md new file mode 100644 index 0000000..544965b --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md @@ -0,0 +1,9 @@ +# # RedemptionsListResponseBodyRedemptionsItemLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemOrder.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemOrder.md new file mode 100644 index 0000000..3a0870d --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemOrder.md @@ -0,0 +1,30 @@ +# # RedemptionsListResponseBodyRedemptionsItemOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**sourceId** | **string** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **string** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initialAmount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discountAmount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**itemsDiscountAmount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**totalDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**totalAmount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**appliedDiscountAmount** | **int** | This field shows the order-level discount applied. | [optional] +**itemsAppliedDiscountAmount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**totalAppliedDiscountAmount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**\OpenAPI\Client\Model\OrderCalculatedItem[]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'order'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the customer making the purchase. | [optional] +**referrerId** | **string** | Unique referrer ID. | [optional] +**customer** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrderCustomer**](RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md) | | [optional] +**referrer** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrderReferrer**](RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md) | | [optional] +**redemptions** | **object** | | [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/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md new file mode 100644 index 0000000..acd3d48 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md @@ -0,0 +1,10 @@ +# # RedemptionsListResponseBodyRedemptionsItemOrderCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of an existing customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md new file mode 100644 index 0000000..2a5327a --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md @@ -0,0 +1,10 @@ +# # RedemptionsListResponseBodyRedemptionsItemOrderReferrer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of an existing customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md new file mode 100644 index 0000000..3d0e1a3 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md @@ -0,0 +1,30 @@ +# # RedemptionsListResponseBodyRedemptionsItemPromotionTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique promotion tier ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **string** | Name of the promotion tier. | [optional] +**banner** | **string** | Text to be displayed to your customers on your website. | [optional] +**action** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierAction**](RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md) | | [optional] +**metadata** | **object** | | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotionId** | **string** | Promotion unique ID. | [optional] +**campaign** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign**](RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md) | | [optional] +**campaignId** | **string** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md) | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validationRuleAssignments** | [**\OpenAPI\Client\Model\ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**categoryId** | **string** | Promotion tier category ID. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md new file mode 100644 index 0000000..e01e5de --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md @@ -0,0 +1,9 @@ +# # RedemptionsListResponseBodyRedemptionsItemPromotionTierAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md new file mode 100644 index 0000000..9017f05 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md @@ -0,0 +1,17 @@ +# # RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID. | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**categoryId** | **string** | Unique category ID that this campaign belongs to. | [optional] +**object** | **string** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md new file mode 100644 index 0000000..7d04012 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md @@ -0,0 +1,10 @@ +# # RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md) | | [optional] +**orders** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.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/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md new file mode 100644 index 0000000..1352894 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md @@ -0,0 +1,10 @@ +# # RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalAmount** | **int** | Sum of order totals. | [optional] +**totalDiscountAmount** | **int** | Sum of total discount applied using the promotion tier. | [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/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md new file mode 100644 index 0000000..35f5233 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md @@ -0,0 +1,9 @@ +# # RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalRedeemed** | **int** | Number of times the promotion tier was redeemed. | [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/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md new file mode 100644 index 0000000..c8fc502 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md @@ -0,0 +1,10 @@ +# # RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem[]**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem[]**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.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/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 0000000..4737cc4 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,10 @@ +# # RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md new file mode 100644 index 0000000..edf1ecb --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,10 @@ +# # RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucher.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucher.md new file mode 100644 index 0000000..6831347 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucher.md @@ -0,0 +1,38 @@ +# # RedemptionsListResponseBodyRedemptionsItemVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherGift**](RedemptionsListResponseBodyRedemptionsItemVoucherGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard**](RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherPublish**](RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherRedemption**](RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.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/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md new file mode 100644 index 0000000..6bc6cce --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md @@ -0,0 +1,11 @@ +# # RedemptionsListResponseBodyRedemptionsItemVoucherGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md new file mode 100644 index 0000000..8217072 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md @@ -0,0 +1,12 @@ +# # RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md new file mode 100644 index 0000000..c179d96 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md @@ -0,0 +1,11 @@ +# # RedemptionsListResponseBodyRedemptionsItemVoucherPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md new file mode 100644 index 0000000..444dab8 --- /dev/null +++ b/docs/Model/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md @@ -0,0 +1,13 @@ +# # RedemptionsListResponseBodyRedemptionsItemVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRedeemRequestBody.md b/docs/Model/RedemptionsRedeemRequestBody.md new file mode 100644 index 0000000..18a8ce8 --- /dev/null +++ b/docs/Model/RedemptionsRedeemRequestBody.md @@ -0,0 +1,15 @@ +# # RedemptionsRedeemRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**options** | [**\OpenAPI\Client\Model\RedemptionsRedeemRequestBodyOptions**](RedemptionsRedeemRequestBodyOptions.md) | | [optional] +**redeemables** | [**\OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItem[]**](RedemptionsRedeemRequestBodyRedeemablesItem.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**session** | [**\OpenAPI\Client\Model\Session**](Session.md) | | [optional] +**trackingId** | **string** | Is correspondent to Customer's source_id | [optional] +**metadata** | **object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRedeemRequestBodyOptions.md b/docs/Model/RedemptionsRedeemRequestBodyOptions.md new file mode 100644 index 0000000..72a2a34 --- /dev/null +++ b/docs/Model/RedemptionsRedeemRequestBodyOptions.md @@ -0,0 +1,9 @@ +# # RedemptionsRedeemRequestBodyOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expand** | **string[]** | Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.<br>- Returns redemption object `metadata`.<br>- Returns an expanded `categories` object, showing details about the category. | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRedeemRequestBodyRedeemablesItem.md b/docs/Model/RedemptionsRedeemRequestBodyRedeemablesItem.md new file mode 100644 index 0000000..da64f0f --- /dev/null +++ b/docs/Model/RedemptionsRedeemRequestBodyRedeemablesItem.md @@ -0,0 +1,12 @@ +# # RedemptionsRedeemRequestBodyRedeemablesItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | | [optional] +**id** | **string** | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItemGift**](RedemptionsRedeemRequestBodyRedeemablesItemGift.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItemReward**](RedemptionsRedeemRequestBodyRedeemablesItemReward.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/RedemptionsRedeemRequestBodyRedeemablesItemGift.md b/docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemGift.md new file mode 100644 index 0000000..6321997 --- /dev/null +++ b/docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemGift.md @@ -0,0 +1,9 @@ +# # RedemptionsRedeemRequestBodyRedeemablesItemGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemReward.md b/docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemReward.md new file mode 100644 index 0000000..bed41ea --- /dev/null +++ b/docs/Model/RedemptionsRedeemRequestBodyRedeemablesItemReward.md @@ -0,0 +1,10 @@ +# # RedemptionsRedeemRequestBodyRedeemablesItemReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRedeemResponseBody.md b/docs/Model/RedemptionsRedeemResponseBody.md new file mode 100644 index 0000000..fdd23e1 --- /dev/null +++ b/docs/Model/RedemptionsRedeemResponseBody.md @@ -0,0 +1,13 @@ +# # RedemptionsRedeemResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**\OpenAPI\Client\Model\Redemption[]**](Redemption.md) | | [optional] +**parentRedemption** | [**\OpenAPI\Client\Model\Redemption**](Redemption.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**inapplicableRedeemables** | [**\OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] +**skippedRedeemables** | [**\OpenAPI\Client\Model\ValidationsRedeemableSkipped[]**](ValidationsRedeemableSkipped.md) | Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRollbackCreateRequestBody.md b/docs/Model/RedemptionsRollbackCreateRequestBody.md new file mode 100644 index 0000000..85d60b2 --- /dev/null +++ b/docs/Model/RedemptionsRollbackCreateRequestBody.md @@ -0,0 +1,13 @@ +# # RedemptionsRollbackCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reason** | **string** | Reason for the rollback. | [optional] +**trackingId** | **string** | Customer's `source_id`. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to update **redemption** metadata. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRollbackCreateResponseBody.md b/docs/Model/RedemptionsRollbackCreateResponseBody.md new file mode 100644 index 0000000..8fe4395 --- /dev/null +++ b/docs/Model/RedemptionsRollbackCreateResponseBody.md @@ -0,0 +1,32 @@ +# # RedemptionsRollbackCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the redemption rollback. | [optional] +**object** | **string** | The type of the object represented by the JSON | [optional] [default to 'redemption_rollback'] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customerId** | **string** | Unique customer ID of the redeeming customer. | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] +**amount** | **int** | For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **string** | Unique redemption ID of the parent redemption. | [optional] +**reason** | **string** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] +**result** | **string** | Redemption result. | [optional] +**status** | **string** | Redemption status. | [optional] +**relatedRedemptions** | [**\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptions**](RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md) | | [optional] +**failureCode** | **string** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failureMessage** | **string** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**channel** | [**\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyChannel**](RedemptionsRollbackCreateResponseBodyChannel.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\SimpleCustomer**](SimpleCustomer.md) | | [optional] +**relatedObjectType** | **string** | Defines the related object. | [optional] +**relatedObjectId** | **string** | Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [optional] +**voucher** | [**\OpenAPI\Client\Model\Voucher**](Voucher.md) | | [optional] +**promotionTier** | [**\OpenAPI\Client\Model\PromotionTier**](PromotionTier.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyGift**](RedemptionsRollbackCreateResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyLoyaltyCard**](RedemptionsRollbackCreateResponseBodyLoyaltyCard.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/RedemptionsRollbackCreateResponseBodyChannel.md b/docs/Model/RedemptionsRollbackCreateResponseBodyChannel.md new file mode 100644 index 0000000..c55b9ee --- /dev/null +++ b/docs/Model/RedemptionsRollbackCreateResponseBodyChannel.md @@ -0,0 +1,10 @@ +# # RedemptionsRollbackCreateResponseBodyChannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channelId** | **string** | Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] +**channelType** | **string** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRollbackCreateResponseBodyGift.md b/docs/Model/RedemptionsRollbackCreateResponseBodyGift.md new file mode 100644 index 0000000..4377f06 --- /dev/null +++ b/docs/Model/RedemptionsRollbackCreateResponseBodyGift.md @@ -0,0 +1,9 @@ +# # RedemptionsRollbackCreateResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md b/docs/Model/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..f28e2a5 --- /dev/null +++ b/docs/Model/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,9 @@ +# # RedemptionsRollbackCreateResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md b/docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md new file mode 100644 index 0000000..956a905 --- /dev/null +++ b/docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md @@ -0,0 +1,10 @@ +# # RedemptionsRollbackCreateResponseBodyRelatedRedemptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem[]**](RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem[]**](RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.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/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 0000000..eee761c --- /dev/null +++ b/docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,10 @@ +# # RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 0000000..b7d8532 --- /dev/null +++ b/docs/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,10 @@ +# # RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of the redemption rollback. | [optional] +**date** | **\DateTime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRollbacksCreateRequestBody.md b/docs/Model/RedemptionsRollbacksCreateRequestBody.md new file mode 100644 index 0000000..5adac24 --- /dev/null +++ b/docs/Model/RedemptionsRollbacksCreateRequestBody.md @@ -0,0 +1,13 @@ +# # RedemptionsRollbacksCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reason** | **string** | Reason for the rollback. | [optional] +**trackingId** | **string** | Customer's `source_id`. | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to update **redemption** metadata. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedemptionsRollbacksCreateResponseBody.md b/docs/Model/RedemptionsRollbacksCreateResponseBody.md new file mode 100644 index 0000000..052fb5d --- /dev/null +++ b/docs/Model/RedemptionsRollbacksCreateResponseBody.md @@ -0,0 +1,11 @@ +# # RedemptionsRollbacksCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**\OpenAPI\Client\Model\RedemptionRollback[]**](RedemptionRollback.md) | Contains the rollback redemption objects of the particular incentives. | [optional] +**parentRollback** | [**\OpenAPI\Client\Model\RedemptionRollback**](RedemptionRollback.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.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/ReferralProgram.md b/docs/Model/ReferralProgram.md new file mode 100644 index 0000000..60dcd19 --- /dev/null +++ b/docs/Model/ReferralProgram.md @@ -0,0 +1,11 @@ +# # ReferralProgram + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversionEventType** | **string** | Define how a referral is triggered. | [optional] +**customEvent** | [**\OpenAPI\Client\Model\ReferralProgramCustomEvent**](ReferralProgramCustomEvent.md) | | [optional] +**refereeReward** | [**\OpenAPI\Client\Model\ReferralProgramRefereeReward**](ReferralProgramRefereeReward.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/ReferralProgramCustomEvent.md b/docs/Model/ReferralProgramCustomEvent.md new file mode 100644 index 0000000..c821bf0 --- /dev/null +++ b/docs/Model/ReferralProgramCustomEvent.md @@ -0,0 +1,10 @@ +# # ReferralProgramCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique custom event ID. | [optional] +**name** | **string** | Custom event name. | [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/ReferralProgramRefereeReward.md b/docs/Model/ReferralProgramRefereeReward.md new file mode 100644 index 0000000..5d9ea65 --- /dev/null +++ b/docs/Model/ReferralProgramRefereeReward.md @@ -0,0 +1,11 @@ +# # ReferralProgramRefereeReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**relatedObjectParent** | [**\OpenAPI\Client\Model\ReferralProgramRefereeRewardRelatedObjectParent**](ReferralProgramRefereeRewardRelatedObjectParent.md) | | [optional] +**type** | **string** | Type of reward. | [optional] +**amount** | **string** | Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ReferralProgramRefereeRewardRelatedObjectParent.md b/docs/Model/ReferralProgramRefereeRewardRelatedObjectParent.md new file mode 100644 index 0000000..a0ab66b --- /dev/null +++ b/docs/Model/ReferralProgramRefereeRewardRelatedObjectParent.md @@ -0,0 +1,11 @@ +# # ReferralProgramRefereeRewardRelatedObjectParent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique ID of the reward source. | [optional] +**name** | **string** | Name of the reward source. | [optional] +**object** | **string** | Type of resource represented by the source of the reward. | [optional] [default to 'CAMPAIGN'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Referrer.md b/docs/Model/Referrer.md new file mode 100644 index 0000000..d9c3b24 --- /dev/null +++ b/docs/Model/Referrer.md @@ -0,0 +1,18 @@ +# # Referrer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of an existing customer. | [optional] +**sourceId** | **string** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**description** | **string** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **string** | Customer's email address. | [optional] +**phone** | **string** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **\DateTime** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **\DateTime** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**\OpenAPI\Client\Model\ReferrerAddress**](ReferrerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ReferrerAddress.md b/docs/Model/ReferrerAddress.md new file mode 100644 index 0000000..df1e391 --- /dev/null +++ b/docs/Model/ReferrerAddress.md @@ -0,0 +1,14 @@ +# # ReferrerAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **string** | City | [optional] +**state** | **string** | State | [optional] +**line1** | **string** | First line of address. | [optional] +**line2** | **string** | Second line of address. | [optional] +**country** | **string** | Country. | [optional] +**postalCode** | **string** | Postal code. | [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/ReferrerId.md b/docs/Model/ReferrerId.md new file mode 100644 index 0000000..24c98da --- /dev/null +++ b/docs/Model/ReferrerId.md @@ -0,0 +1,10 @@ +# # ReferrerId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of an existing customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Reward.md b/docs/Model/Reward.md new file mode 100644 index 0000000..ce93934 --- /dev/null +++ b/docs/Model/Reward.md @@ -0,0 +1,19 @@ +# # Reward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID, assigned by Voucherify. | [optional] +**name** | **string** | Reward name. | [optional] +**stock** | **int** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] +**redeemed** | **int** | Defines the number of already invoked (successful) reward redemptions. | [optional] +**attributes** | [**\OpenAPI\Client\Model\RewardAttributes**](RewardAttributes.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. | [optional] +**type** | **string** | Reward type. | [optional] +**parameters** | [**\OpenAPI\Client\Model\RewardType**](RewardType.md) | | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardAssignment.md b/docs/Model/RewardAssignment.md new file mode 100644 index 0000000..67b1882 --- /dev/null +++ b/docs/Model/RewardAssignment.md @@ -0,0 +1,16 @@ +# # RewardAssignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**rewardId** | **string** | Associated reward ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**relatedObjectId** | **string** | Related object ID to which the reward was assigned. | [optional] +**relatedObjectType** | **string** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**\OpenAPI\Client\Model\RewardAssignmentParameters**](RewardAssignmentParameters.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/RewardAssignmentParameters.md b/docs/Model/RewardAssignmentParameters.md new file mode 100644 index 0000000..cd4def3 --- /dev/null +++ b/docs/Model/RewardAssignmentParameters.md @@ -0,0 +1,9 @@ +# # RewardAssignmentParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\RewardAssignmentParametersLoyalty**](RewardAssignmentParametersLoyalty.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/RewardAssignmentParametersLoyalty.md b/docs/Model/RewardAssignmentParametersLoyalty.md new file mode 100644 index 0000000..be5a448 --- /dev/null +++ b/docs/Model/RewardAssignmentParametersLoyalty.md @@ -0,0 +1,9 @@ +# # RewardAssignmentParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [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/RewardAttributes.md b/docs/Model/RewardAttributes.md new file mode 100644 index 0000000..1f955f7 --- /dev/null +++ b/docs/Model/RewardAttributes.md @@ -0,0 +1,10 @@ +# # RewardAttributes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file. | [optional] +**description** | **string** | An arbitrary string that you can attach to a material reward. | [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/RewardType.md b/docs/Model/RewardType.md new file mode 100644 index 0000000..c0d7e68 --- /dev/null +++ b/docs/Model/RewardType.md @@ -0,0 +1,11 @@ +# # RewardType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | [**\OpenAPI\Client\Model\RewardTypeCampaign**](RewardTypeCampaign.md) | | [optional] +**coin** | [**\OpenAPI\Client\Model\RewardTypeCoin**](RewardTypeCoin.md) | | [optional] +**product** | [**\OpenAPI\Client\Model\RewardTypeProduct**](RewardTypeProduct.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/RewardTypeCampaign.md b/docs/Model/RewardTypeCampaign.md new file mode 100644 index 0000000..2fbe9ca --- /dev/null +++ b/docs/Model/RewardTypeCampaign.md @@ -0,0 +1,11 @@ +# # RewardTypeCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique campaign ID, assigned by Voucherify. | [optional] +**balance** | **int** | The number of points to be added to a loyalty card or the amount to be added to the current balance on the gift card. For gift cards, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**type** | **string** | Campaign type. | [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/RewardTypeCoin.md b/docs/Model/RewardTypeCoin.md new file mode 100644 index 0000000..59e1536 --- /dev/null +++ b/docs/Model/RewardTypeCoin.md @@ -0,0 +1,10 @@ +# # RewardTypeCoin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchangeRatio** | **float** | The cash equivalent of the points defined in the points_ratio property. | [optional] +**pointsRatio** | **int** | The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardTypeProduct.md b/docs/Model/RewardTypeProduct.md new file mode 100644 index 0000000..c65170a --- /dev/null +++ b/docs/Model/RewardTypeProduct.md @@ -0,0 +1,10 @@ +# # RewardTypeProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID, assigned by Voucherify. | [optional] +**skuId** | **string** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [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/RewardsAssignmentsCreateRequestBody.md b/docs/Model/RewardsAssignmentsCreateRequestBody.md new file mode 100644 index 0000000..b9eaad5 --- /dev/null +++ b/docs/Model/RewardsAssignmentsCreateRequestBody.md @@ -0,0 +1,11 @@ +# # RewardsAssignmentsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | **string** | The campaign ID of the campaign to which the reward is to be assigned. | [optional] +**parameters** | [**\OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBodyParameters**](RewardsAssignmentsCreateRequestBodyParameters.md) | | [optional] +**validationRules** | **string[]** | | [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/RewardsAssignmentsCreateRequestBodyParameters.md b/docs/Model/RewardsAssignmentsCreateRequestBodyParameters.md new file mode 100644 index 0000000..d3a4fbc --- /dev/null +++ b/docs/Model/RewardsAssignmentsCreateRequestBodyParameters.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsCreateRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBodyParametersLoyalty**](RewardsAssignmentsCreateRequestBodyParametersLoyalty.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/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md b/docs/Model/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md new file mode 100644 index 0000000..708c5c2 --- /dev/null +++ b/docs/Model/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsCreateRequestBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. Must be positive integer. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardsAssignmentsCreateResponseBody.md b/docs/Model/RewardsAssignmentsCreateResponseBody.md new file mode 100644 index 0000000..90a0955 --- /dev/null +++ b/docs/Model/RewardsAssignmentsCreateResponseBody.md @@ -0,0 +1,16 @@ +# # RewardsAssignmentsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**rewardId** | **string** | Associated reward ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**relatedObjectId** | **string** | Related object ID to which the reward was assigned. | [optional] +**relatedObjectType** | **string** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBodyParameters**](RewardsAssignmentsCreateResponseBodyParameters.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/RewardsAssignmentsCreateResponseBodyParameters.md b/docs/Model/RewardsAssignmentsCreateResponseBodyParameters.md new file mode 100644 index 0000000..f608e9c --- /dev/null +++ b/docs/Model/RewardsAssignmentsCreateResponseBodyParameters.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsCreateResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBodyParametersLoyalty**](RewardsAssignmentsCreateResponseBodyParametersLoyalty.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/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md b/docs/Model/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md new file mode 100644 index 0000000..8ea989f --- /dev/null +++ b/docs/Model/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsCreateResponseBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [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/RewardsAssignmentsGetResponseBody.md b/docs/Model/RewardsAssignmentsGetResponseBody.md new file mode 100644 index 0000000..65af386 --- /dev/null +++ b/docs/Model/RewardsAssignmentsGetResponseBody.md @@ -0,0 +1,16 @@ +# # RewardsAssignmentsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**rewardId** | **string** | Associated reward ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**relatedObjectId** | **string** | Related object ID to which the reward was assigned. | [optional] +**relatedObjectType** | **string** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBodyParameters**](RewardsAssignmentsGetResponseBodyParameters.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/RewardsAssignmentsGetResponseBodyParameters.md b/docs/Model/RewardsAssignmentsGetResponseBodyParameters.md new file mode 100644 index 0000000..0153225 --- /dev/null +++ b/docs/Model/RewardsAssignmentsGetResponseBodyParameters.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsGetResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBodyParametersLoyalty**](RewardsAssignmentsGetResponseBodyParametersLoyalty.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/RewardsAssignmentsGetResponseBodyParametersLoyalty.md b/docs/Model/RewardsAssignmentsGetResponseBodyParametersLoyalty.md new file mode 100644 index 0000000..7f2fa57 --- /dev/null +++ b/docs/Model/RewardsAssignmentsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsGetResponseBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [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/RewardsAssignmentsListResponseBody.md b/docs/Model/RewardsAssignmentsListResponseBody.md new file mode 100644 index 0000000..615a324 --- /dev/null +++ b/docs/Model/RewardsAssignmentsListResponseBody.md @@ -0,0 +1,12 @@ +# # RewardsAssignmentsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about reward assignments in a dictionary. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of reward assignments. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\RewardAssignment[]**](RewardAssignment.md) | | [optional] +**total** | **int** | Total number of reward assignments. | [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/RewardsAssignmentsUpdateRequestBody.md b/docs/Model/RewardsAssignmentsUpdateRequestBody.md new file mode 100644 index 0000000..45fcc15 --- /dev/null +++ b/docs/Model/RewardsAssignmentsUpdateRequestBody.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**\OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBodyParameters**](RewardsAssignmentsUpdateRequestBodyParameters.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/RewardsAssignmentsUpdateRequestBodyParameters.md b/docs/Model/RewardsAssignmentsUpdateRequestBodyParameters.md new file mode 100644 index 0000000..ddd346b --- /dev/null +++ b/docs/Model/RewardsAssignmentsUpdateRequestBodyParameters.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsUpdateRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBodyParametersLoyalty**](RewardsAssignmentsUpdateRequestBodyParametersLoyalty.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/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md b/docs/Model/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md new file mode 100644 index 0000000..bff931c --- /dev/null +++ b/docs/Model/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsUpdateRequestBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Defines how many points are required to obtain the reward. | [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/RewardsAssignmentsUpdateResponseBody.md b/docs/Model/RewardsAssignmentsUpdateResponseBody.md new file mode 100644 index 0000000..9f533a5 --- /dev/null +++ b/docs/Model/RewardsAssignmentsUpdateResponseBody.md @@ -0,0 +1,16 @@ +# # RewardsAssignmentsUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**rewardId** | **string** | Associated reward ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**relatedObjectId** | **string** | Related object ID to which the reward was assigned. | [optional] +**relatedObjectType** | **string** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBodyParameters**](RewardsAssignmentsUpdateResponseBodyParameters.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/RewardsAssignmentsUpdateResponseBodyParameters.md b/docs/Model/RewardsAssignmentsUpdateResponseBodyParameters.md new file mode 100644 index 0000000..284ed03 --- /dev/null +++ b/docs/Model/RewardsAssignmentsUpdateResponseBodyParameters.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsUpdateResponseBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBodyParametersLoyalty**](RewardsAssignmentsUpdateResponseBodyParametersLoyalty.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/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md b/docs/Model/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md new file mode 100644 index 0000000..94802a0 --- /dev/null +++ b/docs/Model/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md @@ -0,0 +1,9 @@ +# # RewardsAssignmentsUpdateResponseBodyParametersLoyalty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [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/RewardsCreateRequestBody.md b/docs/Model/RewardsCreateRequestBody.md new file mode 100644 index 0000000..abcc27c --- /dev/null +++ b/docs/Model/RewardsCreateRequestBody.md @@ -0,0 +1,13 @@ +# # RewardsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Reward name. | [optional] +**parameters** | [**\OpenAPI\Client\Model\RewardsCreateRequestBodyParameters**](RewardsCreateRequestBodyParameters.md) | | [optional] +**metadata** | **object** | | [optional] +**stock** | **int** | The number of units of the product that you want to share as a reward. | [optional] +**attributes** | [**\OpenAPI\Client\Model\RewardsCreateRequestBodyAttributes**](RewardsCreateRequestBodyAttributes.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/RewardsCreateRequestBodyAttributes.md b/docs/Model/RewardsCreateRequestBodyAttributes.md new file mode 100644 index 0000000..3d6d9d4 --- /dev/null +++ b/docs/Model/RewardsCreateRequestBodyAttributes.md @@ -0,0 +1,10 @@ +# # RewardsCreateRequestBodyAttributes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**imageUrl** | **string** | HTTPS URL pointing to a .png or .jpg file. | [optional] +**description** | **string** | Description of a material reward. | [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/RewardsCreateRequestBodyParameters.md b/docs/Model/RewardsCreateRequestBodyParameters.md new file mode 100644 index 0000000..7dc8dd7 --- /dev/null +++ b/docs/Model/RewardsCreateRequestBodyParameters.md @@ -0,0 +1,11 @@ +# # RewardsCreateRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | [**\OpenAPI\Client\Model\RewardsCreateRequestBodyParametersCampaign**](RewardsCreateRequestBodyParametersCampaign.md) | | [optional] +**product** | [**\OpenAPI\Client\Model\RewardsCreateRequestBodyParametersProduct**](RewardsCreateRequestBodyParametersProduct.md) | | [optional] +**coin** | [**\OpenAPI\Client\Model\RewardsCreateRequestBodyParametersCoin**](RewardsCreateRequestBodyParametersCoin.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/RewardsCreateRequestBodyParametersCampaign.md b/docs/Model/RewardsCreateRequestBodyParametersCampaign.md new file mode 100644 index 0000000..167137d --- /dev/null +++ b/docs/Model/RewardsCreateRequestBodyParametersCampaign.md @@ -0,0 +1,10 @@ +# # RewardsCreateRequestBodyParametersCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**balance** | **int** | The incremental points to be added to the current balance on the loyalty card. and The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardsCreateRequestBodyParametersCoin.md b/docs/Model/RewardsCreateRequestBodyParametersCoin.md new file mode 100644 index 0000000..f8bcaed --- /dev/null +++ b/docs/Model/RewardsCreateRequestBodyParametersCoin.md @@ -0,0 +1,10 @@ +# # RewardsCreateRequestBodyParametersCoin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchangeRatio** | **string** | The cash equivalent of the points defined in the `points_ratio` property. | [optional] +**pointsRatio** | **string** | The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardsCreateRequestBodyParametersProduct.md b/docs/Model/RewardsCreateRequestBodyParametersProduct.md new file mode 100644 index 0000000..ab1a6ca --- /dev/null +++ b/docs/Model/RewardsCreateRequestBodyParametersProduct.md @@ -0,0 +1,10 @@ +# # RewardsCreateRequestBodyParametersProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID, assigned by Voucherify, given as a reward. | [optional] +**skuId** | **string** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [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/RewardsCreateResponseBody.md b/docs/Model/RewardsCreateResponseBody.md new file mode 100644 index 0000000..033724b --- /dev/null +++ b/docs/Model/RewardsCreateResponseBody.md @@ -0,0 +1,19 @@ +# # RewardsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID, assigned by Voucherify. | [optional] +**name** | **string** | Reward name. | [optional] +**stock** | **int** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] +**redeemed** | **int** | Defines the number of already invoked (successful) reward redemptions. | [optional] +**attributes** | [**\OpenAPI\Client\Model\RewardsCreateResponseBodyAttributes**](RewardsCreateResponseBodyAttributes.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. | [optional] +**type** | **string** | Reward type. | [optional] +**parameters** | [**\OpenAPI\Client\Model\RewardType**](RewardType.md) | | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardsCreateResponseBodyAttributes.md b/docs/Model/RewardsCreateResponseBodyAttributes.md new file mode 100644 index 0000000..154386f --- /dev/null +++ b/docs/Model/RewardsCreateResponseBodyAttributes.md @@ -0,0 +1,10 @@ +# # RewardsCreateResponseBodyAttributes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file. | [optional] +**description** | **string** | An arbitrary string that you can attach to a material reward. | [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/RewardsListResponseBody.md b/docs/Model/RewardsListResponseBody.md new file mode 100644 index 0000000..b2a34e6 --- /dev/null +++ b/docs/Model/RewardsListResponseBody.md @@ -0,0 +1,12 @@ +# # RewardsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of transaction objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\Reward[]**](Reward.md) | A dictionary that contains an array of rewards. Each entry in the array is a separate transaction object. | [optional] +**total** | **int** | Returns how many rewards in the project meet the limits defined by the query parameter definitions. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardsUpdateRequestBody.md b/docs/Model/RewardsUpdateRequestBody.md new file mode 100644 index 0000000..896c523 --- /dev/null +++ b/docs/Model/RewardsUpdateRequestBody.md @@ -0,0 +1,13 @@ +# # RewardsUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Reward name. | [optional] +**parameters** | [**\OpenAPI\Client\Model\RewardsUpdateRequestBodyParameters**](RewardsUpdateRequestBodyParameters.md) | | [optional] +**metadata** | **object** | | [optional] +**stock** | **int** | The number of units of the product that you want to share as a reward. | [optional] +**attributes** | [**\OpenAPI\Client\Model\RewardsUpdateRequestBodyAttributes**](RewardsUpdateRequestBodyAttributes.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/RewardsUpdateRequestBodyAttributes.md b/docs/Model/RewardsUpdateRequestBodyAttributes.md new file mode 100644 index 0000000..38c561c --- /dev/null +++ b/docs/Model/RewardsUpdateRequestBodyAttributes.md @@ -0,0 +1,10 @@ +# # RewardsUpdateRequestBodyAttributes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**imageUrl** | **string** | HTTPS URL pointing to a .png or .jpg file. | [optional] +**description** | **string** | Description of a material reward. | [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/RewardsUpdateRequestBodyParameters.md b/docs/Model/RewardsUpdateRequestBodyParameters.md new file mode 100644 index 0000000..4d0cfc9 --- /dev/null +++ b/docs/Model/RewardsUpdateRequestBodyParameters.md @@ -0,0 +1,11 @@ +# # RewardsUpdateRequestBodyParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | [**\OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersCampaign**](RewardsUpdateRequestBodyParametersCampaign.md) | | [optional] +**product** | [**\OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersProduct**](RewardsUpdateRequestBodyParametersProduct.md) | | [optional] +**coin** | [**\OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersCoin**](RewardsUpdateRequestBodyParametersCoin.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/RewardsUpdateRequestBodyParametersCampaign.md b/docs/Model/RewardsUpdateRequestBodyParametersCampaign.md new file mode 100644 index 0000000..939efbd --- /dev/null +++ b/docs/Model/RewardsUpdateRequestBodyParametersCampaign.md @@ -0,0 +1,10 @@ +# # RewardsUpdateRequestBodyParametersCampaign + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**balance** | **int** | The incremental points to be added to the current balance on the loyalty card. and The incremental amount to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardsUpdateRequestBodyParametersCoin.md b/docs/Model/RewardsUpdateRequestBodyParametersCoin.md new file mode 100644 index 0000000..ba86b24 --- /dev/null +++ b/docs/Model/RewardsUpdateRequestBodyParametersCoin.md @@ -0,0 +1,10 @@ +# # RewardsUpdateRequestBodyParametersCoin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchangeRatio** | **string** | The cash equivalent of the points defined in the `points_ratio` property. | [optional] +**pointsRatio** | **string** | The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardsUpdateRequestBodyParametersProduct.md b/docs/Model/RewardsUpdateRequestBodyParametersProduct.md new file mode 100644 index 0000000..986e92e --- /dev/null +++ b/docs/Model/RewardsUpdateRequestBodyParametersProduct.md @@ -0,0 +1,10 @@ +# # RewardsUpdateRequestBodyParametersProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID, assigned by Voucherify, given as a reward. | [optional] +**skuId** | **string** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [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/RewardsUpdateResponseBody.md b/docs/Model/RewardsUpdateResponseBody.md new file mode 100644 index 0000000..a4b34cc --- /dev/null +++ b/docs/Model/RewardsUpdateResponseBody.md @@ -0,0 +1,19 @@ +# # RewardsUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID, assigned by Voucherify. | [optional] +**name** | **string** | Reward name. | [optional] +**stock** | **int** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] +**redeemed** | **int** | Defines the number of already invoked (successful) reward redemptions. | [optional] +**attributes** | [**\OpenAPI\Client\Model\RewardsUpdateResponseBodyAttributes**](RewardsUpdateResponseBodyAttributes.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. | [optional] +**type** | **string** | Reward type. | [optional] +**parameters** | [**\OpenAPI\Client\Model\RewardType**](RewardType.md) | | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RewardsUpdateResponseBodyAttributes.md b/docs/Model/RewardsUpdateResponseBodyAttributes.md new file mode 100644 index 0000000..e456b65 --- /dev/null +++ b/docs/Model/RewardsUpdateResponseBodyAttributes.md @@ -0,0 +1,10 @@ +# # RewardsUpdateResponseBodyAttributes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file. | [optional] +**description** | **string** | An arbitrary string that you can attach to a material reward. | [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/SegmentsCreateRequestBody.md b/docs/Model/SegmentsCreateRequestBody.md new file mode 100644 index 0000000..c106756 --- /dev/null +++ b/docs/Model/SegmentsCreateRequestBody.md @@ -0,0 +1,12 @@ +# # SegmentsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Segment name. | [optional] +**type** | **string** | | [optional] +**customers** | **string[]** | Array of customer IDs. | [optional] +**filter** | **object** | Defines a set of criteria for an `auto-update` segment type. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SegmentsCreateResponseBody.md b/docs/Model/SegmentsCreateResponseBody.md new file mode 100644 index 0000000..1f290af --- /dev/null +++ b/docs/Model/SegmentsCreateResponseBody.md @@ -0,0 +1,15 @@ +# # SegmentsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique segment ID. | [optional] +**name** | **string** | Segment name. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. | [optional] +**type** | **string** | Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). | [optional] +**filter** | **object** | Defines a set of criteria for an `auto-update` segment type. | [optional] +**initialSyncStatus** | **string** | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the customer segment. | [optional] [default to 'segment'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SegmentsGetResponseBody.md b/docs/Model/SegmentsGetResponseBody.md new file mode 100644 index 0000000..4c48409 --- /dev/null +++ b/docs/Model/SegmentsGetResponseBody.md @@ -0,0 +1,15 @@ +# # SegmentsGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique segment ID. | [optional] +**name** | **string** | Segment name. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. | [optional] +**type** | **string** | Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). | [optional] +**filter** | **object** | Defines a set of criteria for an `auto-update` segment type. | [optional] +**initialSyncStatus** | **string** | | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the customer segment. | [optional] [default to 'segment'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Session.md b/docs/Model/Session.md new file mode 100644 index 0000000..491b37b --- /dev/null +++ b/docs/Model/Session.md @@ -0,0 +1,12 @@ +# # Session + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **string** | The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated. | [optional] +**type** | **string** | This parameter is required to establish a new session. | [optional] [default to 'LOCK'] +**ttl** | **float** | Value for the period of time that the session is active. Units for this parameter are defined by the session.ttl_unit parameter. | [optional] +**ttlUnit** | **string** | Defines the type of unit in which the session time is counted. | [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/SimpleCustomer.md b/docs/Model/SimpleCustomer.md new file mode 100644 index 0000000..7c95648 --- /dev/null +++ b/docs/Model/SimpleCustomer.md @@ -0,0 +1,14 @@ +# # SimpleCustomer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**email** | **string** | Customer's email address. | [optional] +**sourceId** | **string** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] +**metadata** | **object** | A set of custom key/value pairs that are attached to the customer. It stores all custom attributes assigned to the customer. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SimpleCustomerRequiredObjectType.md b/docs/Model/SimpleCustomerRequiredObjectType.md new file mode 100644 index 0000000..23585f5 --- /dev/null +++ b/docs/Model/SimpleCustomerRequiredObjectType.md @@ -0,0 +1,14 @@ +# # SimpleCustomerRequiredObjectType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique ID of a customer that is assigned by Voucherify. | [optional] +**sourceId** | **string** | The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. | [optional] +**name** | **string** | Customer's first and last name. | [optional] +**email** | **string** | Customer's email address. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] +**object** | **string** | The type of the object represented by the JSON. This object stores information about the customer. | [optional] [default to 'customer'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SimpleLoyaltyCard.md b/docs/Model/SimpleLoyaltyCard.md new file mode 100644 index 0000000..1e0e37c --- /dev/null +++ b/docs/Model/SimpleLoyaltyCard.md @@ -0,0 +1,12 @@ +# # SimpleLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **string** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/SimpleProductDiscountUnit.md b/docs/Model/SimpleProductDiscountUnit.md new file mode 100644 index 0000000..3a513d0 --- /dev/null +++ b/docs/Model/SimpleProductDiscountUnit.md @@ -0,0 +1,11 @@ +# # SimpleProductDiscountUnit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID, assigned by Voucherify. | [optional] +**sourceId** | **string** | Product's source ID. | [optional] +**name** | **string** | Product name. | [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/SimpleSegment.md b/docs/Model/SimpleSegment.md new file mode 100644 index 0000000..adc9834 --- /dev/null +++ b/docs/Model/SimpleSegment.md @@ -0,0 +1,11 @@ +# # SimpleSegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique segment ID. | [optional] +**name** | **string** | Segment name. | [optional] +**object** | **string** | The type of the object represented by the ID. | [optional] [default to 'segment'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SimpleSkuDiscountUnit.md b/docs/Model/SimpleSkuDiscountUnit.md new file mode 100644 index 0000000..f5afe21 --- /dev/null +++ b/docs/Model/SimpleSkuDiscountUnit.md @@ -0,0 +1,11 @@ +# # SimpleSkuDiscountUnit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique SKU ID, assigned by Voucherify. | [optional] +**sourceId** | **string** | Product variant's source ID. | [optional] +**name** | **string** | Sku name | [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/SimpleVoucher.md b/docs/Model/SimpleVoucher.md new file mode 100644 index 0000000..3800a48 --- /dev/null +++ b/docs/Model/SimpleVoucher.md @@ -0,0 +1,29 @@ +# # SimpleVoucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the voucher assigned by Voucherify. | [optional] +**code** | **string** | Voucher code. | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] +**type** | **string** | Type of the voucher. | [optional] +**campaign** | **string** | Campaign name. | [optional] +**campaignId** | **string** | Campaign unique ID. | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referrer assigned by Voucherify. | [optional] +**categoryId** | **string** | Unique identifier of the category that this voucher belongs to. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**active** | **bool** | Shows whether the voucher is on or off. `true` indicates an *active* voucher and `false` indicates an *inactive* voucher. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the order was created in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**redemption** | [**\OpenAPI\Client\Model\SimpleVoucherRedemption**](SimpleVoucherRedemption.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a voucher. The metadata object stores all custom attributes assigned to the voucher. | [optional] +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'voucher'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SimpleVoucherLoyaltyCard.md b/docs/Model/SimpleVoucherLoyaltyCard.md new file mode 100644 index 0000000..e7939a7 --- /dev/null +++ b/docs/Model/SimpleVoucherLoyaltyCard.md @@ -0,0 +1,12 @@ +# # SimpleVoucherLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **string** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SimpleVoucherRedemption.md b/docs/Model/SimpleVoucherRedemption.md new file mode 100644 index 0000000..d6e6c36 --- /dev/null +++ b/docs/Model/SimpleVoucherRedemption.md @@ -0,0 +1,10 @@ +# # SimpleVoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [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/Sku.md b/docs/Model/Sku.md new file mode 100644 index 0000000..a481a7e --- /dev/null +++ b/docs/Model/Sku.md @@ -0,0 +1,20 @@ +# # Sku + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**sourceId** | **string** | A unique SKU identifier from your inventory system. | [optional] +**productId** | **string** | The parent product's unique ID. | [optional] +**sku** | **string** | Unique user-defined SKU name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**currency** | **string** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional] [default to 'sku'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SkusGetResponseBody.md b/docs/Model/SkusGetResponseBody.md new file mode 100644 index 0000000..5630195 --- /dev/null +++ b/docs/Model/SkusGetResponseBody.md @@ -0,0 +1,20 @@ +# # SkusGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**sourceId** | **string** | A unique SKU identifier from your inventory system. | [optional] +**productId** | **string** | The parent product's unique ID. | [optional] +**sku** | **string** | Unique user-defined SKU name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**currency** | **string** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**imageUrl** | **string** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional] [default to 'sku'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SkusImportCsvCreateResponseBody.md b/docs/Model/SkusImportCsvCreateResponseBody.md new file mode 100644 index 0000000..0d8df76 --- /dev/null +++ b/docs/Model/SkusImportCsvCreateResponseBody.md @@ -0,0 +1,9 @@ +# # SkusImportCsvCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/SkusListForProduct.md b/docs/Model/SkusListForProduct.md new file mode 100644 index 0000000..96f074d --- /dev/null +++ b/docs/Model/SkusListForProduct.md @@ -0,0 +1,12 @@ +# # SkusListForProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about SKUs. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of SKUs. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\Sku[]**](Sku.md) | A dictionary that contains an array of SKUs. | [optional] +**total** | **int** | Total number of SKUs in the product. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StackingRules.md b/docs/Model/StackingRules.md new file mode 100644 index 0000000..88c1d4d --- /dev/null +++ b/docs/Model/StackingRules.md @@ -0,0 +1,19 @@ +# # StackingRules + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemablesLimit** | **int** | Defines how many redeemables can be sent in one stacking request (note: more redeemables means more processing time!). | [optional] [default to 30] +**applicableRedeemablesLimit** | **int** | Defines how many of the sent redeemables will be applied to the order. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be labelled as SKIPPED. | [optional] [default to 5] +**applicableRedeemablesPerCategoryLimit** | **int** | Defines how many redeemables per category can be applied in one request. | [optional] [default to 1] +**applicableExclusiveRedeemablesLimit** | **int** | Defines how many redeemables with an exclusive category can be applied in one request. | [optional] [default to 1] +**applicableExclusiveRedeemablesPerCategoryLimit** | **int** | Defines how many redeemables with an exclusive category per category in stacking rules can be applied in one request. | [optional] [default to 1] +**exclusiveCategories** | **string[]** | Lists all exclusive categories. A redeemable from a campaign with an exclusive category is the only redeemable to be redeemed when applied with redeemables from other campaigns unless these campaigns are exclusive or joint. | [optional] +**jointCategories** | **string[]** | Lists all joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns. | [optional] +**redeemablesApplicationMode** | **string** | Defines redeemables application mode. | [optional] +**redeemablesSortingRule** | **string** | Defines redeemables sorting rule. | [optional] [default to 'REQUESTED_ORDER'] +**redeemablesProductsApplicationMode** | **string** | Defines redeemables products application mode. | [optional] +**redeemablesNoEffectRule** | **string** | Defines redeemables no effect rule. | [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/ValidationRule.md b/docs/Model/ValidationRule.md new file mode 100644 index 0000000..bdca942 --- /dev/null +++ b/docs/Model/ValidationRule.md @@ -0,0 +1,19 @@ +# # ValidationRule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**\OpenAPI\Client\Model\ValidationRuleError**](ValidationRuleError.md) | | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ValidationRuleApplicableTo**](ValidationRuleApplicableTo.md) | | [optional] +**type** | **string** | Type of validation rule. | [optional] [default to 'expression'] +**contextType** | **string** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] +**id** | **string** | Unique validation rule ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] +**assignmentsCount** | **int** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional] [default to 'validation_rules'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRuleApplicableTo.md b/docs/Model/ValidationRuleApplicableTo.md new file mode 100644 index 0000000..8f01def --- /dev/null +++ b/docs/Model/ValidationRuleApplicableTo.md @@ -0,0 +1,11 @@ +# # ValidationRuleApplicableTo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**includedAll** | **bool** | Indicates whether all items are included in the discount. | [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/ValidationRuleAssignment.md b/docs/Model/ValidationRuleAssignment.md new file mode 100644 index 0000000..f70ea2f --- /dev/null +++ b/docs/Model/ValidationRuleAssignment.md @@ -0,0 +1,14 @@ +# # ValidationRuleAssignment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Validation rule assignment ID. | [optional] +**ruleId** | **string** | Validation rule ID. | [optional] +**relatedObjectId** | **string** | The resource ID to which the validation rule was assigned. | [optional] +**relatedObjectType** | **string** | The type of resource to which the validation rule was assigned. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the ID. | [optional] [default to 'validation_rules_assignment'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRuleAssignmentsList.md b/docs/Model/ValidationRuleAssignmentsList.md new file mode 100644 index 0000000..308d9bd --- /dev/null +++ b/docs/Model/ValidationRuleAssignmentsList.md @@ -0,0 +1,12 @@ +# # ValidationRuleAssignmentsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about validation rule assignments. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of validation rule assignments. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\ValidationRuleAssignment[]**](ValidationRuleAssignment.md) | A dictionary that contains an array of validation rule assignments. | [optional] +**total** | **int** | Total number of validation rule assignments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRuleError.md b/docs/Model/ValidationRuleError.md new file mode 100644 index 0000000..8338ae9 --- /dev/null +++ b/docs/Model/ValidationRuleError.md @@ -0,0 +1,9 @@ +# # ValidationRuleError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [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/ValidationRulesAssignmentsCreateRequestBody.md b/docs/Model/ValidationRulesAssignmentsCreateRequestBody.md new file mode 100644 index 0000000..930e9c8 --- /dev/null +++ b/docs/Model/ValidationRulesAssignmentsCreateRequestBody.md @@ -0,0 +1,10 @@ +# # ValidationRulesAssignmentsCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**relatedObjectType** | **string** | Defines the related object, e.g. `voucher`. | [optional] [default to 'voucher'] +**relatedObjectId** | **string** | Unique related object ID assigned by Voucherify, e.g. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [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/ValidationRulesAssignmentsCreateResponseBody.md b/docs/Model/ValidationRulesAssignmentsCreateResponseBody.md new file mode 100644 index 0000000..8a37b55 --- /dev/null +++ b/docs/Model/ValidationRulesAssignmentsCreateResponseBody.md @@ -0,0 +1,14 @@ +# # ValidationRulesAssignmentsCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Validation rule assignment ID. | [optional] +**ruleId** | **string** | Validation rule ID. | [optional] +**relatedObjectId** | **string** | The resource ID to which the validation rule was assigned. | [optional] +**relatedObjectType** | **string** | The type of resource to which the validation rule was assigned. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **string** | The type of the object represented by the ID. | [optional] [default to 'validation_rules_assignment'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesAssignmentsList.md b/docs/Model/ValidationRulesAssignmentsList.md new file mode 100644 index 0000000..cbab107 --- /dev/null +++ b/docs/Model/ValidationRulesAssignmentsList.md @@ -0,0 +1,12 @@ +# # ValidationRulesAssignmentsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about validation rules assignments. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of validation rules assignments. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\BusValRuleAssignment[]**](BusValRuleAssignment.md) | Contains array of validation rules assignments. | [optional] +**total** | **int** | Total number of validation rules assignments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesAssignmentsListResponseBody.md b/docs/Model/ValidationRulesAssignmentsListResponseBody.md new file mode 100644 index 0000000..b36551a --- /dev/null +++ b/docs/Model/ValidationRulesAssignmentsListResponseBody.md @@ -0,0 +1,12 @@ +# # ValidationRulesAssignmentsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about validation rule assignments. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the JSON property that contains the array of validation rule assignments. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\ValidationRuleAssignment[]**](ValidationRuleAssignment.md) | A dictionary that contains an array of validation rule assignments. | [optional] +**total** | **int** | Total number of validation rule assignments. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesCreateRequestBody.md b/docs/Model/ValidationRulesCreateRequestBody.md new file mode 100644 index 0000000..431c594 --- /dev/null +++ b/docs/Model/ValidationRulesCreateRequestBody.md @@ -0,0 +1,14 @@ +# # ValidationRulesCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**\OpenAPI\Client\Model\ValidationRulesCreateRequestBodyError**](ValidationRulesCreateRequestBodyError.md) | | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ValidationRulesCreateRequestBodyApplicableTo**](ValidationRulesCreateRequestBodyApplicableTo.md) | | [optional] +**type** | **string** | Type of validation rule. | [optional] [default to 'expression'] +**contextType** | **string** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesCreateRequestBodyApplicableTo.md b/docs/Model/ValidationRulesCreateRequestBodyApplicableTo.md new file mode 100644 index 0000000..6713b5a --- /dev/null +++ b/docs/Model/ValidationRulesCreateRequestBodyApplicableTo.md @@ -0,0 +1,11 @@ +# # ValidationRulesCreateRequestBodyApplicableTo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**includedAll** | **bool** | Indicates whether all items are included in the discount. | [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/ValidationRulesCreateRequestBodyError.md b/docs/Model/ValidationRulesCreateRequestBodyError.md new file mode 100644 index 0000000..a5853d2 --- /dev/null +++ b/docs/Model/ValidationRulesCreateRequestBodyError.md @@ -0,0 +1,9 @@ +# # ValidationRulesCreateRequestBodyError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [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/ValidationRulesCreateResponseBody.md b/docs/Model/ValidationRulesCreateResponseBody.md new file mode 100644 index 0000000..4982a90 --- /dev/null +++ b/docs/Model/ValidationRulesCreateResponseBody.md @@ -0,0 +1,19 @@ +# # ValidationRulesCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**\OpenAPI\Client\Model\ValidationRulesCreateResponseBodyError**](ValidationRulesCreateResponseBodyError.md) | | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ValidationRulesCreateResponseBodyApplicableTo**](ValidationRulesCreateResponseBodyApplicableTo.md) | | [optional] +**type** | **string** | Type of validation rule. | [optional] [default to 'expression'] +**contextType** | **string** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] +**id** | **string** | Unique validation rule ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] +**assignmentsCount** | **int** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional] [default to 'validation_rules'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesCreateResponseBodyApplicableTo.md b/docs/Model/ValidationRulesCreateResponseBodyApplicableTo.md new file mode 100644 index 0000000..b7eb6e3 --- /dev/null +++ b/docs/Model/ValidationRulesCreateResponseBodyApplicableTo.md @@ -0,0 +1,11 @@ +# # ValidationRulesCreateResponseBodyApplicableTo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**includedAll** | **bool** | Indicates whether all items are included in the discount. | [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/ValidationRulesCreateResponseBodyError.md b/docs/Model/ValidationRulesCreateResponseBodyError.md new file mode 100644 index 0000000..00729e8 --- /dev/null +++ b/docs/Model/ValidationRulesCreateResponseBodyError.md @@ -0,0 +1,9 @@ +# # ValidationRulesCreateResponseBodyError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [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/ValidationRulesGetResponseBody.md b/docs/Model/ValidationRulesGetResponseBody.md new file mode 100644 index 0000000..a5134b5 --- /dev/null +++ b/docs/Model/ValidationRulesGetResponseBody.md @@ -0,0 +1,19 @@ +# # ValidationRulesGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**\OpenAPI\Client\Model\ValidationRulesGetResponseBodyError**](ValidationRulesGetResponseBodyError.md) | | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ValidationRulesGetResponseBodyApplicableTo**](ValidationRulesGetResponseBodyApplicableTo.md) | | [optional] +**type** | **string** | Type of validation rule. | [optional] [default to 'expression'] +**contextType** | **string** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] +**id** | **string** | Unique validation rule ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] +**assignmentsCount** | **int** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional] [default to 'validation_rules'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesGetResponseBodyApplicableTo.md b/docs/Model/ValidationRulesGetResponseBodyApplicableTo.md new file mode 100644 index 0000000..bb78402 --- /dev/null +++ b/docs/Model/ValidationRulesGetResponseBodyApplicableTo.md @@ -0,0 +1,11 @@ +# # ValidationRulesGetResponseBodyApplicableTo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**includedAll** | **bool** | Indicates whether all items are included in the discount. | [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/ValidationRulesGetResponseBodyError.md b/docs/Model/ValidationRulesGetResponseBodyError.md new file mode 100644 index 0000000..9c74c2e --- /dev/null +++ b/docs/Model/ValidationRulesGetResponseBodyError.md @@ -0,0 +1,9 @@ +# # ValidationRulesGetResponseBodyError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [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/ValidationRulesListResponseBody.md b/docs/Model/ValidationRulesListResponseBody.md new file mode 100644 index 0000000..d842118 --- /dev/null +++ b/docs/Model/ValidationRulesListResponseBody.md @@ -0,0 +1,12 @@ +# # ValidationRulesListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. This object stores information about validation rules. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of validation rules. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\ValidationRule[]**](ValidationRule.md) | An array of validation rules. | [optional] +**total** | **int** | Total number of validation rules in the project. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesUpdateRequestBody.md b/docs/Model/ValidationRulesUpdateRequestBody.md new file mode 100644 index 0000000..a2e153d --- /dev/null +++ b/docs/Model/ValidationRulesUpdateRequestBody.md @@ -0,0 +1,14 @@ +# # ValidationRulesUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**\OpenAPI\Client\Model\ValidationRulesUpdateRequestBodyError**](ValidationRulesUpdateRequestBodyError.md) | | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ValidationRulesUpdateRequestBodyApplicableTo**](ValidationRulesUpdateRequestBodyApplicableTo.md) | | [optional] +**type** | **string** | Type of validation rule. | [optional] [default to 'expression'] +**contextType** | **string** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesUpdateRequestBodyApplicableTo.md b/docs/Model/ValidationRulesUpdateRequestBodyApplicableTo.md new file mode 100644 index 0000000..278123d --- /dev/null +++ b/docs/Model/ValidationRulesUpdateRequestBodyApplicableTo.md @@ -0,0 +1,11 @@ +# # ValidationRulesUpdateRequestBodyApplicableTo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**includedAll** | **bool** | Indicates whether all items are included in the discount. | [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/ValidationRulesUpdateRequestBodyError.md b/docs/Model/ValidationRulesUpdateRequestBodyError.md new file mode 100644 index 0000000..9b51b40 --- /dev/null +++ b/docs/Model/ValidationRulesUpdateRequestBodyError.md @@ -0,0 +1,9 @@ +# # ValidationRulesUpdateRequestBodyError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [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/ValidationRulesUpdateResponseBody.md b/docs/Model/ValidationRulesUpdateResponseBody.md new file mode 100644 index 0000000..3b2b1ec --- /dev/null +++ b/docs/Model/ValidationRulesUpdateResponseBody.md @@ -0,0 +1,19 @@ +# # ValidationRulesUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**\OpenAPI\Client\Model\ValidationRulesUpdateResponseBodyError**](ValidationRulesUpdateResponseBodyError.md) | | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ValidationRulesUpdateResponseBodyApplicableTo**](ValidationRulesUpdateResponseBodyApplicableTo.md) | | [optional] +**type** | **string** | Type of validation rule. | [optional] [default to 'expression'] +**contextType** | **string** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] +**id** | **string** | Unique validation rule ID. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] +**assignmentsCount** | **int** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional] [default to 'validation_rules'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationRulesUpdateResponseBodyApplicableTo.md b/docs/Model/ValidationRulesUpdateResponseBodyApplicableTo.md new file mode 100644 index 0000000..cd58a68 --- /dev/null +++ b/docs/Model/ValidationRulesUpdateResponseBodyApplicableTo.md @@ -0,0 +1,11 @@ +# # ValidationRulesUpdateResponseBodyApplicableTo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**\OpenAPI\Client\Model\ApplicableTo[]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**includedAll** | **bool** | Indicates whether all items are included in the discount. | [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/ValidationRulesUpdateResponseBodyError.md b/docs/Model/ValidationRulesUpdateResponseBodyError.md new file mode 100644 index 0000000..898a1f7 --- /dev/null +++ b/docs/Model/ValidationRulesUpdateResponseBodyError.md @@ -0,0 +1,9 @@ +# # ValidationRulesUpdateResponseBodyError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [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/ValidationsRedeemableInapplicable.md b/docs/Model/ValidationsRedeemableInapplicable.md new file mode 100644 index 0000000..c008a69 --- /dev/null +++ b/docs/Model/ValidationsRedeemableInapplicable.md @@ -0,0 +1,14 @@ +# # ValidationsRedeemableInapplicable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | Indicates whether the redeemable can be applied or not applied based on the validation rules. | [optional] [default to 'INAPPLICABLE'] +**id** | **string** | Redeemable ID, i.e. the voucher code. | [optional] +**object** | **string** | Redeemable's object type. | [optional] +**result** | [**\OpenAPI\Client\Model\ValidationsRedeemableInapplicableResult**](ValidationsRedeemableInapplicableResult.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/ValidationsRedeemableInapplicableResult.md b/docs/Model/ValidationsRedeemableInapplicableResult.md new file mode 100644 index 0000000..2bf2cfe --- /dev/null +++ b/docs/Model/ValidationsRedeemableInapplicableResult.md @@ -0,0 +1,10 @@ +# # ValidationsRedeemableInapplicableResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | [**\OpenAPI\Client\Model\Error**](Error.md) | | [optional] +**details** | [**\OpenAPI\Client\Model\ValidationsRedeemableInapplicableResultDetails**](ValidationsRedeemableInapplicableResultDetails.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/ValidationsRedeemableInapplicableResultDetails.md b/docs/Model/ValidationsRedeemableInapplicableResultDetails.md new file mode 100644 index 0000000..d7765ec --- /dev/null +++ b/docs/Model/ValidationsRedeemableInapplicableResultDetails.md @@ -0,0 +1,10 @@ +# # ValidationsRedeemableInapplicableResultDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | Generic message from the `message` string shown in the `error` object or the message configured in a validation rule. | [optional] +**key** | **string** | Generic message from the `key` string shown in the `error` object. | [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/ValidationsRedeemableSkipped.md b/docs/Model/ValidationsRedeemableSkipped.md new file mode 100644 index 0000000..5ae2d8c --- /dev/null +++ b/docs/Model/ValidationsRedeemableSkipped.md @@ -0,0 +1,14 @@ +# # ValidationsRedeemableSkipped + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | Indicates whether the redeemable can be applied or not applied based on the validation rules. | [optional] [default to 'SKIPPED'] +**id** | **string** | Redeemable ID, i.e. the voucher code. | [optional] +**object** | **string** | Redeemable's object type. | [optional] +**result** | [**\OpenAPI\Client\Model\ValidationsRedeemableSkippedResult**](ValidationsRedeemableSkippedResult.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/ValidationsRedeemableSkippedResult.md b/docs/Model/ValidationsRedeemableSkippedResult.md new file mode 100644 index 0000000..df93e25 --- /dev/null +++ b/docs/Model/ValidationsRedeemableSkippedResult.md @@ -0,0 +1,9 @@ +# # ValidationsRedeemableSkippedResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**details** | [**\OpenAPI\Client\Model\ValidationsRedeemableSkippedResultDetails**](ValidationsRedeemableSkippedResultDetails.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/ValidationsRedeemableSkippedResultDetails.md b/docs/Model/ValidationsRedeemableSkippedResultDetails.md new file mode 100644 index 0000000..60d53f0 --- /dev/null +++ b/docs/Model/ValidationsRedeemableSkippedResultDetails.md @@ -0,0 +1,10 @@ +# # ValidationsRedeemableSkippedResultDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **string** | | [optional] +**message** | **string** | | [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/ValidationsValidateRequestBody.md b/docs/Model/ValidationsValidateRequestBody.md new file mode 100644 index 0000000..afc1a23 --- /dev/null +++ b/docs/Model/ValidationsValidateRequestBody.md @@ -0,0 +1,15 @@ +# # ValidationsValidateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**options** | [**\OpenAPI\Client\Model\ValidationsValidateRequestBodyOptions**](ValidationsValidateRequestBodyOptions.md) | | [optional] +**redeemables** | [**\OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItem[]**](ValidationsValidateRequestBodyRedeemablesItem.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\Order**](Order.md) | | [optional] +**customer** | [**\OpenAPI\Client\Model\Customer**](Customer.md) | | [optional] +**session** | [**\OpenAPI\Client\Model\Session**](Session.md) | | [optional] +**trackingId** | **string** | Is correspondent to Customer's source_id | [optional] +**metadata** | **object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationsValidateRequestBodyOptions.md b/docs/Model/ValidationsValidateRequestBodyOptions.md new file mode 100644 index 0000000..3a40dd8 --- /dev/null +++ b/docs/Model/ValidationsValidateRequestBodyOptions.md @@ -0,0 +1,9 @@ +# # ValidationsValidateRequestBodyOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expand** | **string[]** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationsValidateRequestBodyRedeemablesItem.md b/docs/Model/ValidationsValidateRequestBodyRedeemablesItem.md new file mode 100644 index 0000000..7fc8886 --- /dev/null +++ b/docs/Model/ValidationsValidateRequestBodyRedeemablesItem.md @@ -0,0 +1,12 @@ +# # ValidationsValidateRequestBodyRedeemablesItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | | [optional] +**id** | **string** | | [optional] +**gift** | [**\OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItemGift**](ValidationsValidateRequestBodyRedeemablesItemGift.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItemReward**](ValidationsValidateRequestBodyRedeemablesItemReward.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/ValidationsValidateRequestBodyRedeemablesItemGift.md b/docs/Model/ValidationsValidateRequestBodyRedeemablesItemGift.md new file mode 100644 index 0000000..8432f5b --- /dev/null +++ b/docs/Model/ValidationsValidateRequestBodyRedeemablesItemGift.md @@ -0,0 +1,9 @@ +# # ValidationsValidateRequestBodyRedeemablesItemGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationsValidateRequestBodyRedeemablesItemReward.md b/docs/Model/ValidationsValidateRequestBodyRedeemablesItemReward.md new file mode 100644 index 0000000..c9995e3 --- /dev/null +++ b/docs/Model/ValidationsValidateRequestBodyRedeemablesItemReward.md @@ -0,0 +1,10 @@ +# # ValidationsValidateRequestBodyRedeemablesItemReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[Back to Model list]](../../README.md#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 new file mode 100644 index 0000000..1afca14 --- /dev/null +++ b/docs/Model/ValidationsValidateResponseBody.md @@ -0,0 +1,16 @@ +# # ValidationsValidateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**valid** | **bool** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | [optional] +**redeemables** | [**\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItem[]**](ValidationsValidateResponseBodyRedeemablesItem.md) | | [optional] +**skippedRedeemables** | [**\OpenAPI\Client\Model\ValidationsRedeemableSkipped[]**](ValidationsRedeemableSkipped.md) | Lists validation results of each skipped redeemable. | [optional] +**inapplicableRedeemables** | [**\OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**trackingId** | **string** | Hashed customer source ID. | [optional] +**session** | [**\OpenAPI\Client\Model\Session**](Session.md) | | [optional] +**stackingRules** | [**\OpenAPI\Client\Model\StackingRules**](StackingRules.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationsValidateResponseBodyRedeemablesItem.md b/docs/Model/ValidationsValidateResponseBodyRedeemablesItem.md new file mode 100644 index 0000000..20e4d98 --- /dev/null +++ b/docs/Model/ValidationsValidateResponseBodyRedeemablesItem.md @@ -0,0 +1,17 @@ +# # ValidationsValidateResponseBodyRedeemablesItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **string** | | [optional] +**id** | **string** | Redeemable ID, i.e. the voucher code. | [optional] +**object** | **string** | Redeemable's object type. | [optional] +**order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] +**applicableTo** | [**\OpenAPI\Client\Model\ApplicableToResultList**](ApplicableToResultList.md) | | [optional] +**inapplicableTo** | [**\OpenAPI\Client\Model\InapplicableToResultList**](InapplicableToResultList.md) | | [optional] +**result** | [**\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResult**](ValidationsValidateResponseBodyRedeemablesItemResult.md) | | [optional] +**metadata** | **object** | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.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/ValidationsValidateResponseBodyRedeemablesItemResult.md b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResult.md new file mode 100644 index 0000000..4c50977 --- /dev/null +++ b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResult.md @@ -0,0 +1,13 @@ +# # ValidationsValidateResponseBodyRedeemablesItemResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDiscount**](ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultGift**](ValidationsValidateResponseBodyRedeemablesItemResultGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard**](ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) | | [optional] +**error** | [**\OpenAPI\Client\Model\Error**](Error.md) | | [optional] +**details** | [**\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDetails**](ValidationsValidateResponseBodyRedeemablesItemResultDetails.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/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md new file mode 100644 index 0000000..9e15acb --- /dev/null +++ b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md @@ -0,0 +1,10 @@ +# # ValidationsValidateResponseBodyRedeemablesItemResultDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **string** | | [optional] +**message** | **string** | | [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/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md new file mode 100644 index 0000000..1c74bd9 --- /dev/null +++ b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md @@ -0,0 +1,25 @@ +# # ValidationsValidateResponseBodyRedeemablesItemResultDiscount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**amountOff** | **float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] +**amountOffFormula** | **string** | | [optional] +**aggregatedAmountLimit** | **int** | Maximum discount amount per order. | [optional] +**effect** | **string** | | [optional] +**isDynamic** | **bool** | Flag indicating whether the discount was calculated using a formula. | [optional] +**unitOff** | **int** | Number of units to be granted a full value discount. | [optional] +**unitOffFormula** | **string** | | [optional] +**unitType** | **string** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] +**product** | [**\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct**](ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) | | [optional] +**sku** | [**\OpenAPI\Client\Model\SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] +**units** | [**\OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]**](DiscountUnitMultipleOneUnit.md) | | [optional] +**percentOff** | **float** | The percent discount that the customer will receive. | [optional] +**percentOffFormula** | **string** | | [optional] +**amountLimit** | **float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**fixedAmount** | **float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] +**fixedAmountFormula** | **string** | | [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/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md new file mode 100644 index 0000000..a7b26a3 --- /dev/null +++ b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md @@ -0,0 +1,11 @@ +# # ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique product ID, assigned by Voucherify. | [optional] +**sourceId** | **string** | Product's source ID. | [optional] +**name** | **string** | Product name. | [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/ValidationsValidateResponseBodyRedeemablesItemResultGift.md b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultGift.md new file mode 100644 index 0000000..af83508 --- /dev/null +++ b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultGift.md @@ -0,0 +1,9 @@ +# # ValidationsValidateResponseBodyRedeemablesItemResultGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md new file mode 100644 index 0000000..adab4cd --- /dev/null +++ b/docs/Model/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md @@ -0,0 +1,9 @@ +# # ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total number of loyalty points to be applied in the redemption. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidityHours.md b/docs/Model/ValidityHours.md new file mode 100644 index 0000000..3583865 --- /dev/null +++ b/docs/Model/ValidityHours.md @@ -0,0 +1,9 @@ +# # ValidityHours + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**daily** | [**\OpenAPI\Client\Model\ValidityHoursDailyItem[]**](ValidityHoursDailyItem.md) | Defines the reccuring period(s) when the resource is active. The periods should not overlap. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidityHoursDailyItem.md b/docs/Model/ValidityHoursDailyItem.md new file mode 100644 index 0000000..a166d6e --- /dev/null +++ b/docs/Model/ValidityHoursDailyItem.md @@ -0,0 +1,11 @@ +# # ValidityHoursDailyItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**startTime** | **string** | Defines the starting hour of validity in the HH:mm format. The resource is *inactive before* this time. | [optional] +**daysOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the resource is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**expirationTime** | **string** | Defines the ending hour of validity in the HH:mm format. The resource is *inactive after* this time. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidityTimeframe.md b/docs/Model/ValidityTimeframe.md new file mode 100644 index 0000000..efb0857 --- /dev/null +++ b/docs/Model/ValidityTimeframe.md @@ -0,0 +1,10 @@ +# # ValidityTimeframe + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**duration** | **string** | Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour. | [optional] +**interval** | **string** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Voucher.md b/docs/Model/Voucher.md new file mode 100644 index 0000000..ffcaa16 --- /dev/null +++ b/docs/Model/Voucher.md @@ -0,0 +1,37 @@ +# # Voucher + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\VoucherGift**](VoucherGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\VoucherLoyaltyCard**](VoucherLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\VoucherPublish**](VoucherPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\VoucherRedemption**](VoucherRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.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/VoucherAssets.md b/docs/Model/VoucherAssets.md new file mode 100644 index 0000000..3c466be --- /dev/null +++ b/docs/Model/VoucherAssets.md @@ -0,0 +1,10 @@ +# # VoucherAssets + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**qr** | [**\OpenAPI\Client\Model\VoucherAssetsQr**](VoucherAssetsQr.md) | | [optional] +**barcode** | [**\OpenAPI\Client\Model\VoucherAssetsBarcode**](VoucherAssetsBarcode.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/VoucherAssetsBarcode.md b/docs/Model/VoucherAssetsBarcode.md new file mode 100644 index 0000000..4175585 --- /dev/null +++ b/docs/Model/VoucherAssetsBarcode.md @@ -0,0 +1,10 @@ +# # VoucherAssetsBarcode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Encrypted voucher code ID. | [optional] +**url** | **string** | URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherAssetsQr.md b/docs/Model/VoucherAssetsQr.md new file mode 100644 index 0000000..74d3d09 --- /dev/null +++ b/docs/Model/VoucherAssetsQr.md @@ -0,0 +1,10 @@ +# # VoucherAssetsQr + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Encrypted voucher code ID. | [optional] +**url** | **string** | URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherGift.md b/docs/Model/VoucherGift.md new file mode 100644 index 0000000..4047f27 --- /dev/null +++ b/docs/Model/VoucherGift.md @@ -0,0 +1,11 @@ +# # VoucherGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/VoucherLoyaltyCard.md b/docs/Model/VoucherLoyaltyCard.md new file mode 100644 index 0000000..82bdd70 --- /dev/null +++ b/docs/Model/VoucherLoyaltyCard.md @@ -0,0 +1,12 @@ +# # VoucherLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/VoucherPublish.md b/docs/Model/VoucherPublish.md new file mode 100644 index 0000000..c7cace2 --- /dev/null +++ b/docs/Model/VoucherPublish.md @@ -0,0 +1,11 @@ +# # VoucherPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherRedemption.md b/docs/Model/VoucherRedemption.md new file mode 100644 index 0000000..d94cca3 --- /dev/null +++ b/docs/Model/VoucherRedemption.md @@ -0,0 +1,13 @@ +# # VoucherRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherTransaction.md b/docs/Model/VoucherTransaction.md new file mode 100644 index 0000000..b5af836 --- /dev/null +++ b/docs/Model/VoucherTransaction.md @@ -0,0 +1,18 @@ +# # VoucherTransaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique transaction ID. | [optional] +**sourceId** | **string** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. | [optional] +**voucherId** | **string** | Unique voucher ID. | [optional] +**campaignId** | **string** | Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. | [optional] +**source** | **string** | The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. | [optional] +**reason** | **string** | Reason why the transaction occurred. In case of a redemption, this value is null. | [optional] +**type** | **string** | | [optional] +**details** | [**\OpenAPI\Client\Model\VoucherTransactionDetails**](VoucherTransactionDetails.md) | | [optional] +**relatedTransactionId** | **string** | The related transaction ID on the receiving card. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherTransactionDetails.md b/docs/Model/VoucherTransactionDetails.md new file mode 100644 index 0000000..d870a49 --- /dev/null +++ b/docs/Model/VoucherTransactionDetails.md @@ -0,0 +1,21 @@ +# # VoucherTransactionDetails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balance** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsBalance**](VoucherTransactionDetailsBalance.md) | | [optional] +**order** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsOrder**](VoucherTransactionDetailsOrder.md) | | [optional] +**event** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsEvent**](VoucherTransactionDetailsEvent.md) | | [optional] +**earningRule** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsEarningRule**](VoucherTransactionDetailsEarningRule.md) | | [optional] +**segment** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsSegment**](VoucherTransactionDetailsSegment.md) | | [optional] +**loyaltyTier** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsLoyaltyTier**](VoucherTransactionDetailsLoyaltyTier.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsRedemption**](VoucherTransactionDetailsRedemption.md) | | [optional] +**rollback** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsRollback**](VoucherTransactionDetailsRollback.md) | | [optional] +**customEvent** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsCustomEvent**](VoucherTransactionDetailsCustomEvent.md) | | [optional] +**eventSchema** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsEventSchema**](VoucherTransactionDetailsEventSchema.md) | | [optional] +**reward** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsReward**](VoucherTransactionDetailsReward.md) | | [optional] +**sourceVoucher** | [**\OpenAPI\Client\Model\SimpleVoucher**](SimpleVoucher.md) | | [optional] +**destinationVoucher** | [**\OpenAPI\Client\Model\SimpleVoucher**](SimpleVoucher.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/VoucherTransactionDetailsBalance.md b/docs/Model/VoucherTransactionDetailsBalance.md new file mode 100644 index 0000000..369e605 --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsBalance.md @@ -0,0 +1,14 @@ +# # VoucherTransactionDetailsBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | The type of voucher whose balance is being adjusted due to the transaction. | [optional] [default to 'loyalty_card'] +**total** | **int** | The number of all points accumulated on the card as affected by add or subtract operations. | [optional] +**object** | **string** | The type of the object represented by the JSON. | [optional] [default to 'balance'] +**points** | **int** | Points added or subtracted in the transaction. | [optional] +**balance** | **int** | The available points on the card after the transaction as affected by redemption or rollback. | [optional] +**relatedObject** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsBalanceRelatedObject**](VoucherTransactionDetailsBalanceRelatedObject.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/VoucherTransactionDetailsBalanceRelatedObject.md b/docs/Model/VoucherTransactionDetailsBalanceRelatedObject.md new file mode 100644 index 0000000..d39ab5a --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsBalanceRelatedObject.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsBalanceRelatedObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] +**type** | **string** | The object being modified, i.e. voucher. | [optional] [default to 'voucher'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherTransactionDetailsCustomEvent.md b/docs/Model/VoucherTransactionDetailsCustomEvent.md new file mode 100644 index 0000000..9d0f2d0 --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsCustomEvent.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsCustomEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique event ID. | [optional] +**type** | **string** | Type of custom event. | [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/VoucherTransactionDetailsEarningRule.md b/docs/Model/VoucherTransactionDetailsEarningRule.md new file mode 100644 index 0000000..c9c4e5d --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsEarningRule.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsEarningRule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique earning rule ID. | [optional] +**source** | [**\OpenAPI\Client\Model\VoucherTransactionDetailsEarningRuleSource**](VoucherTransactionDetailsEarningRuleSource.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/VoucherTransactionDetailsEarningRuleSource.md b/docs/Model/VoucherTransactionDetailsEarningRuleSource.md new file mode 100644 index 0000000..20601de --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsEarningRuleSource.md @@ -0,0 +1,9 @@ +# # VoucherTransactionDetailsEarningRuleSource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **string** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherTransactionDetailsEvent.md b/docs/Model/VoucherTransactionDetailsEvent.md new file mode 100644 index 0000000..bd8a6ad --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsEvent.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique event ID. | [optional] +**type** | **string** | Type of event. | [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/VoucherTransactionDetailsEventSchema.md b/docs/Model/VoucherTransactionDetailsEventSchema.md new file mode 100644 index 0000000..eb4451f --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsEventSchema.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsEventSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique metadata schema ID. | [optional] +**name** | **string** | Type of custom event. | [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/VoucherTransactionDetailsLoyaltyTier.md b/docs/Model/VoucherTransactionDetailsLoyaltyTier.md new file mode 100644 index 0000000..ba6c6a5 --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsLoyaltyTier.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsLoyaltyTier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**name** | **string** | | [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/VoucherTransactionDetailsOrder.md b/docs/Model/VoucherTransactionDetailsOrder.md new file mode 100644 index 0000000..25e2ffa --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsOrder.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique order ID. | [optional] +**sourceId** | **string** | The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherTransactionDetailsRedemption.md b/docs/Model/VoucherTransactionDetailsRedemption.md new file mode 100644 index 0000000..bb53e31 --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsRedemption.md @@ -0,0 +1,9 @@ +# # VoucherTransactionDetailsRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption ID. | [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/VoucherTransactionDetailsReward.md b/docs/Model/VoucherTransactionDetailsReward.md new file mode 100644 index 0000000..5bf7a80 --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsReward.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsReward + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique reward ID. | [optional] +**name** | **string** | Reward name. | [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/VoucherTransactionDetailsRollback.md b/docs/Model/VoucherTransactionDetailsRollback.md new file mode 100644 index 0000000..fd92599 --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsRollback.md @@ -0,0 +1,9 @@ +# # VoucherTransactionDetailsRollback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique redemption rollback ID. | [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/VoucherTransactionDetailsSegment.md b/docs/Model/VoucherTransactionDetailsSegment.md new file mode 100644 index 0000000..51a3fcb --- /dev/null +++ b/docs/Model/VoucherTransactionDetailsSegment.md @@ -0,0 +1,10 @@ +# # VoucherTransactionDetailsSegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**name** | **string** | | [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/VoucherTransactionsExportFilterConditions.md b/docs/Model/VoucherTransactionsExportFilterConditions.md new file mode 100644 index 0000000..b30b9bc --- /dev/null +++ b/docs/Model/VoucherTransactionsExportFilterConditions.md @@ -0,0 +1,9 @@ +# # VoucherTransactionsExportFilterConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**voucherId** | [**\OpenAPI\Client\Model\VoucherTransactionsExportFilterConditionsVoucherId**](VoucherTransactionsExportFilterConditionsVoucherId.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/VoucherTransactionsExportFilterConditionsVoucherId.md b/docs/Model/VoucherTransactionsExportFilterConditionsVoucherId.md new file mode 100644 index 0000000..8ede8ba --- /dev/null +++ b/docs/Model/VoucherTransactionsExportFilterConditionsVoucherId.md @@ -0,0 +1,9 @@ +# # VoucherTransactionsExportFilterConditionsVoucherId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\VoucherTransactionsExportFilterConditionsVoucherIdConditions**](VoucherTransactionsExportFilterConditionsVoucherIdConditions.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/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md b/docs/Model/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md new file mode 100644 index 0000000..502d202 --- /dev/null +++ b/docs/Model/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md @@ -0,0 +1,9 @@ +# # VoucherTransactionsExportFilterConditionsVoucherIdConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in** | **string[]** | | [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/VoucherTransactionsExportParameters.md b/docs/Model/VoucherTransactionsExportParameters.md new file mode 100644 index 0000000..bb88723 --- /dev/null +++ b/docs/Model/VoucherTransactionsExportParameters.md @@ -0,0 +1,10 @@ +# # VoucherTransactionsExportParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL` <br> - `CREDITS_ADDITION` <br> - `CREDITS_REFUND` <br> - `CREDITS_REDEMPTION` <br> - `POINTS_ACCRUAL` <br> - `POINTS_REDEMPTION`<br> - `POINTS_REFUND`<br> - `POINTS_ADDITION`<br> - `POINTS_REMOVAL`<br> - `POINTS_EXPIRATION`<br> - `POINTS_TRANSFER_IN`<br> - `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherTransactionsFilters.md b/docs/Model/VoucherTransactionsFilters.md new file mode 100644 index 0000000..f62cda0 --- /dev/null +++ b/docs/Model/VoucherTransactionsFilters.md @@ -0,0 +1,11 @@ +# # VoucherTransactionsFilters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **string** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] +**fields** | **string[]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL` <br> - `CREDITS_ADDITION` <br> - `CREDITS_REFUND` <br> - `CREDITS_REDEMPTION` <br> - `POINTS_ACCRUAL`<br> - `POINTS_REDEMPTION`<br> - `POINTS_REFUND`<br> - `POINTS_ADDITION`<br> - `POINTS_REMOVAL`<br> - `POINTS_EXPIRATION`<br> - `POINTS_TRANSFER_IN`<br> - `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | | [optional] +**filters** | [**\OpenAPI\Client\Model\VoucherTransactionsExportFilterConditions**](VoucherTransactionsExportFilterConditions.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherWithCategories.md b/docs/Model/VoucherWithCategories.md new file mode 100644 index 0000000..90e2642 --- /dev/null +++ b/docs/Model/VoucherWithCategories.md @@ -0,0 +1,36 @@ +# # VoucherWithCategories + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\VoucherWithCategoriesGift**](VoucherWithCategoriesGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\VoucherWithCategoriesLoyaltyCard**](VoucherWithCategoriesLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\VoucherWithCategoriesPublish**](VoucherWithCategoriesPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\VoucherWithCategoriesRedemption**](VoucherWithCategoriesRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [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/VoucherWithCategoriesGift.md b/docs/Model/VoucherWithCategoriesGift.md new file mode 100644 index 0000000..c4e2b71 --- /dev/null +++ b/docs/Model/VoucherWithCategoriesGift.md @@ -0,0 +1,11 @@ +# # VoucherWithCategoriesGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/VoucherWithCategoriesLoyaltyCard.md b/docs/Model/VoucherWithCategoriesLoyaltyCard.md new file mode 100644 index 0000000..431fa83 --- /dev/null +++ b/docs/Model/VoucherWithCategoriesLoyaltyCard.md @@ -0,0 +1,12 @@ +# # VoucherWithCategoriesLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/VoucherWithCategoriesPublish.md b/docs/Model/VoucherWithCategoriesPublish.md new file mode 100644 index 0000000..7168bfc --- /dev/null +++ b/docs/Model/VoucherWithCategoriesPublish.md @@ -0,0 +1,11 @@ +# # VoucherWithCategoriesPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoucherWithCategoriesRedemption.md b/docs/Model/VoucherWithCategoriesRedemption.md new file mode 100644 index 0000000..6905c91 --- /dev/null +++ b/docs/Model/VoucherWithCategoriesRedemption.md @@ -0,0 +1,13 @@ +# # VoucherWithCategoriesRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersBalanceUpdateRequestBody.md b/docs/Model/VouchersBalanceUpdateRequestBody.md new file mode 100644 index 0000000..19d2919 --- /dev/null +++ b/docs/Model/VouchersBalanceUpdateRequestBody.md @@ -0,0 +1,11 @@ +# # VouchersBalanceUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | The incremental amount to be added to or removed from the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. To remove balance, simply add a minus sign before the value, i.e. to remove $20, use -2000. | [optional] +**sourceId** | **string** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] +**reason** | **string** | Reason why the transaction occurred. | [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/VouchersBalanceUpdateResponseBody.md b/docs/Model/VouchersBalanceUpdateResponseBody.md new file mode 100644 index 0000000..2610697 --- /dev/null +++ b/docs/Model/VouchersBalanceUpdateResponseBody.md @@ -0,0 +1,15 @@ +# # VouchersBalanceUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | The incremental amount added (positive integer) or subtracted (negative integer) to the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**total** | **int** | Total income incurred over the lifespan of the gift card or loyalty card. | [optional] +**balance** | **int** | The balance after adding or subtracting a specified amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**type** | **string** | The type of voucher being modified. | [optional] +**operationType** | **string** | | [optional] [default to 'MANUAL'] +**object** | **string** | The type of the object represented by JSON. Default is `balance`. | [optional] [default to 'balance'] +**relatedObject** | [**\OpenAPI\Client\Model\VouchersBalanceUpdateResponseBodyRelatedObject**](VouchersBalanceUpdateResponseBodyRelatedObject.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/VouchersBalanceUpdateResponseBodyRelatedObject.md b/docs/Model/VouchersBalanceUpdateResponseBodyRelatedObject.md new file mode 100644 index 0000000..d741da3 --- /dev/null +++ b/docs/Model/VouchersBalanceUpdateResponseBodyRelatedObject.md @@ -0,0 +1,10 @@ +# # VouchersBalanceUpdateResponseBodyRelatedObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | The object being modified, i.e. `voucher`. | [optional] [default to 'voucher'] +**id** | **string** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersCreateResponseBody.md b/docs/Model/VouchersCreateResponseBody.md new file mode 100644 index 0000000..d6aff0b --- /dev/null +++ b/docs/Model/VouchersCreateResponseBody.md @@ -0,0 +1,37 @@ +# # VouchersCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\VouchersCreateResponseBodyGift**](VouchersCreateResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\VouchersCreateResponseBodyLoyaltyCard**](VouchersCreateResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\VouchersCreateResponseBodyPublish**](VouchersCreateResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\VouchersCreateResponseBodyRedemption**](VouchersCreateResponseBodyRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.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/VouchersCreateResponseBodyGift.md b/docs/Model/VouchersCreateResponseBodyGift.md new file mode 100644 index 0000000..65406a3 --- /dev/null +++ b/docs/Model/VouchersCreateResponseBodyGift.md @@ -0,0 +1,11 @@ +# # VouchersCreateResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/VouchersCreateResponseBodyLoyaltyCard.md b/docs/Model/VouchersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..df6de8a --- /dev/null +++ b/docs/Model/VouchersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # VouchersCreateResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/VouchersCreateResponseBodyPublish.md b/docs/Model/VouchersCreateResponseBodyPublish.md new file mode 100644 index 0000000..40c6700 --- /dev/null +++ b/docs/Model/VouchersCreateResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # VouchersCreateResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersCreateResponseBodyRedemption.md b/docs/Model/VouchersCreateResponseBodyRedemption.md new file mode 100644 index 0000000..73c7177 --- /dev/null +++ b/docs/Model/VouchersCreateResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # VouchersCreateResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersCreateWithSpecificCodeRequestBody.md b/docs/Model/VouchersCreateWithSpecificCodeRequestBody.md new file mode 100644 index 0000000..5d6b15f --- /dev/null +++ b/docs/Model/VouchersCreateWithSpecificCodeRequestBody.md @@ -0,0 +1,26 @@ +# # VouchersCreateWithSpecificCodeRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | **string** | Identifies the voucher's parent campaign using a unique campaign name. | [optional] +**campaignId** | **string** | Identifies the voucher's parent campaign using a unique campaign ID assigned by the Voucherify API. | [optional] +**category** | **string** | The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**categoryId** | **string** | Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**startDate** | **\DateTime** | Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**validationRules** | **string[]** | Array containing the ID of the validation rule associated with the voucher. | [optional] +**redemption** | [**\OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBodyRedemption**](VouchersCreateWithSpecificCodeRequestBodyRedemption.md) | | [optional] +**type** | **string** | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/VouchersCreateWithSpecificCodeRequestBodyRedemption.md b/docs/Model/VouchersCreateWithSpecificCodeRequestBodyRedemption.md new file mode 100644 index 0000000..09100b1 --- /dev/null +++ b/docs/Model/VouchersCreateWithSpecificCodeRequestBodyRedemption.md @@ -0,0 +1,9 @@ +# # VouchersCreateWithSpecificCodeRequestBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersDisableResponseBody.md b/docs/Model/VouchersDisableResponseBody.md new file mode 100644 index 0000000..48f18fe --- /dev/null +++ b/docs/Model/VouchersDisableResponseBody.md @@ -0,0 +1,37 @@ +# # VouchersDisableResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\VouchersDisableResponseBodyGift**](VouchersDisableResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\VouchersDisableResponseBodyLoyaltyCard**](VouchersDisableResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\VouchersDisableResponseBodyPublish**](VouchersDisableResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\VouchersDisableResponseBodyRedemption**](VouchersDisableResponseBodyRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.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/VouchersDisableResponseBodyGift.md b/docs/Model/VouchersDisableResponseBodyGift.md new file mode 100644 index 0000000..a28ca20 --- /dev/null +++ b/docs/Model/VouchersDisableResponseBodyGift.md @@ -0,0 +1,11 @@ +# # VouchersDisableResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/VouchersDisableResponseBodyLoyaltyCard.md b/docs/Model/VouchersDisableResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..1b2935a --- /dev/null +++ b/docs/Model/VouchersDisableResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # VouchersDisableResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/VouchersDisableResponseBodyPublish.md b/docs/Model/VouchersDisableResponseBodyPublish.md new file mode 100644 index 0000000..afd1e8c --- /dev/null +++ b/docs/Model/VouchersDisableResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # VouchersDisableResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersDisableResponseBodyRedemption.md b/docs/Model/VouchersDisableResponseBodyRedemption.md new file mode 100644 index 0000000..663f8b5 --- /dev/null +++ b/docs/Model/VouchersDisableResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # VouchersDisableResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersEnableResponseBody.md b/docs/Model/VouchersEnableResponseBody.md new file mode 100644 index 0000000..ccdfd58 --- /dev/null +++ b/docs/Model/VouchersEnableResponseBody.md @@ -0,0 +1,37 @@ +# # VouchersEnableResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\VouchersEnableResponseBodyGift**](VouchersEnableResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\VouchersEnableResponseBodyLoyaltyCard**](VouchersEnableResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\VouchersEnableResponseBodyPublish**](VouchersEnableResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\VouchersEnableResponseBodyRedemption**](VouchersEnableResponseBodyRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.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/VouchersEnableResponseBodyGift.md b/docs/Model/VouchersEnableResponseBodyGift.md new file mode 100644 index 0000000..57730e3 --- /dev/null +++ b/docs/Model/VouchersEnableResponseBodyGift.md @@ -0,0 +1,11 @@ +# # VouchersEnableResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/VouchersEnableResponseBodyLoyaltyCard.md b/docs/Model/VouchersEnableResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..eb2c807 --- /dev/null +++ b/docs/Model/VouchersEnableResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # VouchersEnableResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/VouchersEnableResponseBodyPublish.md b/docs/Model/VouchersEnableResponseBodyPublish.md new file mode 100644 index 0000000..ef06762 --- /dev/null +++ b/docs/Model/VouchersEnableResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # VouchersEnableResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersEnableResponseBodyRedemption.md b/docs/Model/VouchersEnableResponseBodyRedemption.md new file mode 100644 index 0000000..f3b9f2c --- /dev/null +++ b/docs/Model/VouchersEnableResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # VouchersEnableResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersGetResponseBody.md b/docs/Model/VouchersGetResponseBody.md new file mode 100644 index 0000000..1cb9b55 --- /dev/null +++ b/docs/Model/VouchersGetResponseBody.md @@ -0,0 +1,37 @@ +# # VouchersGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\VouchersGetResponseBodyGift**](VouchersGetResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\VouchersGetResponseBodyLoyaltyCard**](VouchersGetResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\VouchersGetResponseBodyPublish**](VouchersGetResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\VouchersGetResponseBodyRedemption**](VouchersGetResponseBodyRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.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/VouchersGetResponseBodyGift.md b/docs/Model/VouchersGetResponseBodyGift.md new file mode 100644 index 0000000..4891e6d --- /dev/null +++ b/docs/Model/VouchersGetResponseBodyGift.md @@ -0,0 +1,11 @@ +# # VouchersGetResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/VouchersGetResponseBodyLoyaltyCard.md b/docs/Model/VouchersGetResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..6c5a213 --- /dev/null +++ b/docs/Model/VouchersGetResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # VouchersGetResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/VouchersGetResponseBodyPublish.md b/docs/Model/VouchersGetResponseBodyPublish.md new file mode 100644 index 0000000..03df5ce --- /dev/null +++ b/docs/Model/VouchersGetResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # VouchersGetResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersGetResponseBodyRedemption.md b/docs/Model/VouchersGetResponseBodyRedemption.md new file mode 100644 index 0000000..ff74e62 --- /dev/null +++ b/docs/Model/VouchersGetResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # VouchersGetResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersImportCreateItemRequestBody.md b/docs/Model/VouchersImportCreateItemRequestBody.md new file mode 100644 index 0000000..3fe878a --- /dev/null +++ b/docs/Model/VouchersImportCreateItemRequestBody.md @@ -0,0 +1,21 @@ +# # VouchersImportCreateItemRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Value representing the imported code. | [optional] +**redemption** | [**\OpenAPI\Client\Model\VouchersImportCreateItemRequestBodyRedemption**](VouchersImportCreateItemRequestBodyRedemption.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**metadata** | **object** | | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**startDate** | **\DateTime** | Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] +**expirationDate** | **\DateTime** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**type** | **string** | | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/VouchersImportCreateItemRequestBodyRedemption.md b/docs/Model/VouchersImportCreateItemRequestBodyRedemption.md new file mode 100644 index 0000000..b821b38 --- /dev/null +++ b/docs/Model/VouchersImportCreateItemRequestBodyRedemption.md @@ -0,0 +1,9 @@ +# # VouchersImportCreateItemRequestBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersImportCreateResponseBody.md b/docs/Model/VouchersImportCreateResponseBody.md new file mode 100644 index 0000000..6109e0e --- /dev/null +++ b/docs/Model/VouchersImportCreateResponseBody.md @@ -0,0 +1,9 @@ +# # VouchersImportCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/VouchersImportCsvCreateResponseBody.md b/docs/Model/VouchersImportCsvCreateResponseBody.md new file mode 100644 index 0000000..0f0e803 --- /dev/null +++ b/docs/Model/VouchersImportCsvCreateResponseBody.md @@ -0,0 +1,9 @@ +# # VouchersImportCsvCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/VouchersListResponseBody.md b/docs/Model/VouchersListResponseBody.md new file mode 100644 index 0000000..72de943 --- /dev/null +++ b/docs/Model/VouchersListResponseBody.md @@ -0,0 +1,12 @@ +# # VouchersListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of voucher objects. | [optional] [default to 'vouchers'] +**vouchers** | [**\OpenAPI\Client\Model\VoucherWithCategories[]**](VoucherWithCategories.md) | A dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. | [optional] +**total** | **int** | Returns how many vouchers in the project meet the limits defined by the query parameter definitions. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersMetadataUpdateInBulkRequestBody.md b/docs/Model/VouchersMetadataUpdateInBulkRequestBody.md new file mode 100644 index 0000000..e9a0899 --- /dev/null +++ b/docs/Model/VouchersMetadataUpdateInBulkRequestBody.md @@ -0,0 +1,10 @@ +# # VouchersMetadataUpdateInBulkRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**codes** | **string[]** | An array of voucher codes. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersMetadataUpdateInBulkResponseBody.md b/docs/Model/VouchersMetadataUpdateInBulkResponseBody.md new file mode 100644 index 0000000..690558d --- /dev/null +++ b/docs/Model/VouchersMetadataUpdateInBulkResponseBody.md @@ -0,0 +1,9 @@ +# # VouchersMetadataUpdateInBulkResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/VouchersRedemptionGetResponseBody.md b/docs/Model/VouchersRedemptionGetResponseBody.md new file mode 100644 index 0000000..ed59506 --- /dev/null +++ b/docs/Model/VouchersRedemptionGetResponseBody.md @@ -0,0 +1,15 @@ +# # VouchersRedemptionGetResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | The maximum number of times a voucher can be redeemed. | [optional] +**redeemedQuantity** | **int** | The number of times the voucher was redeemed successfully. | [optional] +**object** | **string** | The type of the object represented by JSON. This object stores information about redemptions in a dictionary. | [optional] [default to 'list'] +**url** | **string** | URL | [optional] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of `redemption_entries`. | [optional] [default to 'redemption_entries'] +**total** | **int** | Total number of redemption objects. | [optional] +**redemptionEntries** | [**\OpenAPI\Client\Model\RedemptionEntry[]**](RedemptionEntry.md) | Contains the array of successful and failed redemption objects. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersTransactionsExportCreateRequestBody.md b/docs/Model/VouchersTransactionsExportCreateRequestBody.md new file mode 100644 index 0000000..80b99e3 --- /dev/null +++ b/docs/Model/VouchersTransactionsExportCreateRequestBody.md @@ -0,0 +1,9 @@ +# # VouchersTransactionsExportCreateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**\OpenAPI\Client\Model\VoucherTransactionsExportParameters**](VoucherTransactionsExportParameters.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/VouchersTransactionsExportCreateResponseBody.md b/docs/Model/VouchersTransactionsExportCreateResponseBody.md new file mode 100644 index 0000000..3f9eaca --- /dev/null +++ b/docs/Model/VouchersTransactionsExportCreateResponseBody.md @@ -0,0 +1,17 @@ +# # VouchersTransactionsExportCreateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Unique export ID. | [optional] +**object** | **string** | The type of object being represented. This object stores information about the `export`. | [optional] [default to 'export'] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **string** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] [default to 'SCHEDULED'] +**channel** | **string** | The channel through which the export was triggered. | [optional] [default to 'API'] +**exportedObject** | **string** | The type of exported object. | [optional] [default to 'voucher_transactions'] +**parameters** | [**\OpenAPI\Client\Model\VoucherTransactionsFilters**](VoucherTransactionsFilters.md) | | +**result** | [**\OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBodyResult**](VouchersTransactionsExportCreateResponseBodyResult.md) | | [optional] +**userId** | **string** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersTransactionsExportCreateResponseBodyResult.md b/docs/Model/VouchersTransactionsExportCreateResponseBodyResult.md new file mode 100644 index 0000000..205d28f --- /dev/null +++ b/docs/Model/VouchersTransactionsExportCreateResponseBodyResult.md @@ -0,0 +1,9 @@ +# # VouchersTransactionsExportCreateResponseBodyResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | URL of the CSV file location. It contains the `token` used for authorization in the <!-- [Download export](OpenAPI.json/paths/~1exports~1{export_Id}/get) -->[Download export](ref:download-export) method. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersTransactionsListResponseBody.md b/docs/Model/VouchersTransactionsListResponseBody.md new file mode 100644 index 0000000..50583f5 --- /dev/null +++ b/docs/Model/VouchersTransactionsListResponseBody.md @@ -0,0 +1,12 @@ +# # VouchersTransactionsListResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented by JSON. | [optional] [default to 'list'] +**dataRef** | **string** | Identifies the name of the attribute that contains the array of transaction objects. | [optional] [default to 'data'] +**data** | [**\OpenAPI\Client\Model\VoucherTransaction[]**](VoucherTransaction.md) | A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. | [optional] +**hasMore** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. | [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/VouchersUpdateInBulkItemRequestBody.md b/docs/Model/VouchersUpdateInBulkItemRequestBody.md new file mode 100644 index 0000000..04c65a2 --- /dev/null +++ b/docs/Model/VouchersUpdateInBulkItemRequestBody.md @@ -0,0 +1,10 @@ +# # VouchersUpdateInBulkItemRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Unique voucher code. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersUpdateInBulkResponseBody.md b/docs/Model/VouchersUpdateInBulkResponseBody.md new file mode 100644 index 0000000..e9abca7 --- /dev/null +++ b/docs/Model/VouchersUpdateInBulkResponseBody.md @@ -0,0 +1,9 @@ +# # VouchersUpdateInBulkResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asyncActionId** | **string** | The ID of the scheduled asynchronous action. | [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/VouchersUpdateRequestBody.md b/docs/Model/VouchersUpdateRequestBody.md new file mode 100644 index 0000000..8ca27b8 --- /dev/null +++ b/docs/Model/VouchersUpdateRequestBody.md @@ -0,0 +1,22 @@ +# # VouchersUpdateRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **string** | The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**categoryId** | **string** | Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**startDate** | **\DateTime** | Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**type** | **string** | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\Gift**](Gift.md) | | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.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/VouchersUpdateResponseBody.md b/docs/Model/VouchersUpdateResponseBody.md new file mode 100644 index 0000000..039c140 --- /dev/null +++ b/docs/Model/VouchersUpdateResponseBody.md @@ -0,0 +1,37 @@ +# # VouchersUpdateResponseBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **string** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **string** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaignId** | **string** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **string** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**categoryId** | **string** | Unique category ID assigned by Voucherify. | [optional] +**type** | **string** | Defines the type of the voucher. | [optional] +**discount** | [**\OpenAPI\Client\Model\Discount**](Discount.md) | | [optional] +**gift** | [**\OpenAPI\Client\Model\VouchersUpdateResponseBodyGift**](VouchersUpdateResponseBodyGift.md) | | [optional] +**loyaltyCard** | [**\OpenAPI\Client\Model\VouchersUpdateResponseBodyLoyaltyCard**](VouchersUpdateResponseBodyLoyaltyCard.md) | | [optional] +**startDate** | **\DateTime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expirationDate** | **\DateTime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validityTimeframe** | [**\OpenAPI\Client\Model\ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validityDayOfWeek** | **int[]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validityHours** | [**\OpenAPI\Client\Model\ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additionalInfo** | **string** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**\OpenAPI\Client\Model\VoucherAssets**](VoucherAssets.md) | | [optional] +**isReferralCode** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**createdAt** | **\DateTime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updatedAt** | **\DateTime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holderId** | **string** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrerId** | **string** | Unique identifier of the referring person. | [optional] +**object** | **string** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**\OpenAPI\Client\Model\VouchersUpdateResponseBodyPublish**](VouchersUpdateResponseBodyPublish.md) | | [optional] +**redemption** | [**\OpenAPI\Client\Model\VouchersUpdateResponseBodyRedemption**](VouchersUpdateResponseBodyRedemption.md) | | [optional] +**categories** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | Contains details about the category. | [optional] +**validationRulesAssignments** | [**\OpenAPI\Client\Model\ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.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/VouchersUpdateResponseBodyGift.md b/docs/Model/VouchersUpdateResponseBodyGift.md new file mode 100644 index 0000000..c919e17 --- /dev/null +++ b/docs/Model/VouchersUpdateResponseBodyGift.md @@ -0,0 +1,11 @@ +# # VouchersUpdateResponseBodyGift + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **string** | Defines how the credits are applied to the customer's order. | [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/VouchersUpdateResponseBodyLoyaltyCard.md b/docs/Model/VouchersUpdateResponseBodyLoyaltyCard.md new file mode 100644 index 0000000..fbd2579 --- /dev/null +++ b/docs/Model/VouchersUpdateResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# # VouchersUpdateResponseBodyLoyaltyCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**nextExpirationDate** | **\DateTime** | The next closest date when the next set of points are due to expire. | [optional] +**nextExpirationPoints** | **int** | The amount of points that are set to expire next. | [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/VouchersUpdateResponseBodyPublish.md b/docs/Model/VouchersUpdateResponseBodyPublish.md new file mode 100644 index 0000000..25bf09b --- /dev/null +++ b/docs/Model/VouchersUpdateResponseBodyPublish.md @@ -0,0 +1,11 @@ +# # VouchersUpdateResponseBodyPublish + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **string** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VouchersUpdateResponseBodyRedemption.md b/docs/Model/VouchersUpdateResponseBodyRedemption.md new file mode 100644 index 0000000..53e995f --- /dev/null +++ b/docs/Model/VouchersUpdateResponseBodyRedemption.md @@ -0,0 +1,13 @@ +# # VouchersUpdateResponseBodyRedemption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemedQuantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemedPoints** | **int** | Total loyalty points redeemed. | [optional] +**object** | **string** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **string** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 85e8f63..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - ./test/ - - - \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..1135449 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./src/Api + ./src/Model + + + + + ./tests/Api + ./tests/Model + + + + + + diff --git a/src/Api/AsyncActionsApi.php b/src/Api/AsyncActionsApi.php new file mode 100644 index 0000000..f030fbe --- /dev/null +++ b/src/Api/AsyncActionsApi.php @@ -0,0 +1,749 @@ + [ + 'application/json', + ], + 'listAsyncActions' => [ + '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 getAsyncAction + * + * Get Async Action + * + * @param string $asyncActionId Unique ID of the asynchronous operation. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncAction'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\AsyncActionGetResponseBody + */ + public function getAsyncAction($asyncActionId, string $contentType = self::contentTypes['getAsyncAction'][0]) + { + list($response) = $this->getAsyncActionWithHttpInfo($asyncActionId, $contentType); + return $response; + } + + /** + * Operation getAsyncActionWithHttpInfo + * + * Get Async Action + * + * @param string $asyncActionId Unique ID of the asynchronous operation. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncAction'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\AsyncActionGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getAsyncActionWithHttpInfo($asyncActionId, string $contentType = self::contentTypes['getAsyncAction'][0]) + { + $request = $this->getAsyncActionRequest($asyncActionId, $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\AsyncActionGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AsyncActionGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AsyncActionGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AsyncActionGetResponseBody'; + 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\AsyncActionGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAsyncActionAsync + * + * Get Async Action + * + * @param string $asyncActionId Unique ID of the asynchronous operation. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncAction'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAsyncActionAsync($asyncActionId, string $contentType = self::contentTypes['getAsyncAction'][0]) + { + return $this->getAsyncActionAsyncWithHttpInfo($asyncActionId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAsyncActionAsyncWithHttpInfo + * + * Get Async Action + * + * @param string $asyncActionId Unique ID of the asynchronous operation. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncAction'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAsyncActionAsyncWithHttpInfo($asyncActionId, string $contentType = self::contentTypes['getAsyncAction'][0]) + { + $returnType = '\OpenAPI\Client\Model\AsyncActionGetResponseBody'; + $request = $this->getAsyncActionRequest($asyncActionId, $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 'getAsyncAction' + * + * @param string $asyncActionId Unique ID of the asynchronous operation. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncAction'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAsyncActionRequest($asyncActionId, string $contentType = self::contentTypes['getAsyncAction'][0]) + { + + // verify the required parameter 'asyncActionId' is set + if ($asyncActionId === null || (is_array($asyncActionId) && count($asyncActionId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $asyncActionId when calling getAsyncAction' + ); + } + + + $resourcePath = '/v1/async-actions/{asyncActionId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($asyncActionId !== null) { + $resourcePath = str_replace( + '{' . 'asyncActionId' . '}', + ObjectSerializer::toPathValue($asyncActionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listAsyncActions + * + * List Async Actions + * + * @param int $limit Limit the number of asynchronous actions that the API returns in the response. (optional) + * @param \DateTime $endDate Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAsyncActions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\AsyncActionsListResponseBody + */ + public function listAsyncActions($limit = null, $endDate = null, string $contentType = self::contentTypes['listAsyncActions'][0]) + { + list($response) = $this->listAsyncActionsWithHttpInfo($limit, $endDate, $contentType); + return $response; + } + + /** + * Operation listAsyncActionsWithHttpInfo + * + * List Async Actions + * + * @param int $limit Limit the number of asynchronous actions that the API returns in the response. (optional) + * @param \DateTime $endDate Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAsyncActions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\AsyncActionsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listAsyncActionsWithHttpInfo($limit = null, $endDate = null, string $contentType = self::contentTypes['listAsyncActions'][0]) + { + $request = $this->listAsyncActionsRequest($limit, $endDate, $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\AsyncActionsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\AsyncActionsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\AsyncActionsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\AsyncActionsListResponseBody'; + 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\AsyncActionsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listAsyncActionsAsync + * + * List Async Actions + * + * @param int $limit Limit the number of asynchronous actions that the API returns in the response. (optional) + * @param \DateTime $endDate Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAsyncActions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listAsyncActionsAsync($limit = null, $endDate = null, string $contentType = self::contentTypes['listAsyncActions'][0]) + { + return $this->listAsyncActionsAsyncWithHttpInfo($limit, $endDate, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listAsyncActionsAsyncWithHttpInfo + * + * List Async Actions + * + * @param int $limit Limit the number of asynchronous actions that the API returns in the response. (optional) + * @param \DateTime $endDate Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAsyncActions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listAsyncActionsAsyncWithHttpInfo($limit = null, $endDate = null, string $contentType = self::contentTypes['listAsyncActions'][0]) + { + $returnType = '\OpenAPI\Client\Model\AsyncActionsListResponseBody'; + $request = $this->listAsyncActionsRequest($limit, $endDate, $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 'listAsyncActions' + * + * @param int $limit Limit the number of asynchronous actions that the API returns in the response. (optional) + * @param \DateTime $endDate Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAsyncActions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listAsyncActionsRequest($limit = null, $endDate = null, string $contentType = self::contentTypes['listAsyncActions'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling AsyncActionsApi.listAsyncActions, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling AsyncActionsApi.listAsyncActions, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/async-actions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $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/Api/CampaignsApi.php b/src/Api/CampaignsApi.php new file mode 100644 index 0000000..b8deb59 --- /dev/null +++ b/src/Api/CampaignsApi.php @@ -0,0 +1,3577 @@ + [ + 'application/json', + ], + 'addVouchersToCampaign' => [ + 'application/json', + ], + 'createCampaign' => [ + 'application/json', + ], + 'deleteCampaign' => [ + 'application/json', + ], + 'disableCampaign' => [ + 'application/json', + ], + 'enableCampaign' => [ + 'application/json', + ], + 'getCampaign' => [ + 'application/json', + ], + 'importVouchersToCampaign' => [ + 'application/json', + ], + 'importVouchersToCampaignUsingCsv' => [ + 'multipart/form-data', + ], + 'listCampaigns' => [ + 'application/json', + ], + 'updateCampaign' => [ + '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 addVoucherWithSpecificCodeToCampaign + * + * Add Voucher with Specific Code to Campaign + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $code A custom **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateRequestBody $campaignsVouchersCreateRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVoucherWithSpecificCodeToCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBody + */ + public function addVoucherWithSpecificCodeToCampaign($campaignId, $code, $campaignsVouchersCreateRequestBody = null, string $contentType = self::contentTypes['addVoucherWithSpecificCodeToCampaign'][0]) + { + list($response) = $this->addVoucherWithSpecificCodeToCampaignWithHttpInfo($campaignId, $code, $campaignsVouchersCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation addVoucherWithSpecificCodeToCampaignWithHttpInfo + * + * Add Voucher with Specific Code to Campaign + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $code A custom **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateRequestBody $campaignsVouchersCreateRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVoucherWithSpecificCodeToCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function addVoucherWithSpecificCodeToCampaignWithHttpInfo($campaignId, $code, $campaignsVouchersCreateRequestBody = null, string $contentType = self::contentTypes['addVoucherWithSpecificCodeToCampaign'][0]) + { + $request = $this->addVoucherWithSpecificCodeToCampaignRequest($campaignId, $code, $campaignsVouchersCreateRequestBody, $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\CampaignsVouchersCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBody'; + 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\CampaignsVouchersCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addVoucherWithSpecificCodeToCampaignAsync + * + * Add Voucher with Specific Code to Campaign + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $code A custom **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateRequestBody $campaignsVouchersCreateRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVoucherWithSpecificCodeToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addVoucherWithSpecificCodeToCampaignAsync($campaignId, $code, $campaignsVouchersCreateRequestBody = null, string $contentType = self::contentTypes['addVoucherWithSpecificCodeToCampaign'][0]) + { + return $this->addVoucherWithSpecificCodeToCampaignAsyncWithHttpInfo($campaignId, $code, $campaignsVouchersCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addVoucherWithSpecificCodeToCampaignAsyncWithHttpInfo + * + * Add Voucher with Specific Code to Campaign + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $code A custom **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateRequestBody $campaignsVouchersCreateRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVoucherWithSpecificCodeToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addVoucherWithSpecificCodeToCampaignAsyncWithHttpInfo($campaignId, $code, $campaignsVouchersCreateRequestBody = null, string $contentType = self::contentTypes['addVoucherWithSpecificCodeToCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBody'; + $request = $this->addVoucherWithSpecificCodeToCampaignRequest($campaignId, $code, $campaignsVouchersCreateRequestBody, $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 'addVoucherWithSpecificCodeToCampaign' + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $code A custom **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateRequestBody $campaignsVouchersCreateRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVoucherWithSpecificCodeToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addVoucherWithSpecificCodeToCampaignRequest($campaignId, $code, $campaignsVouchersCreateRequestBody = null, string $contentType = self::contentTypes['addVoucherWithSpecificCodeToCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling addVoucherWithSpecificCodeToCampaign' + ); + } + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling addVoucherWithSpecificCodeToCampaign' + ); + } + + + + $resourcePath = '/v1/campaigns/{campaignId}/vouchers/{code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($campaignsVouchersCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($campaignsVouchersCreateRequestBody)); + } else { + $httpBody = $campaignsVouchersCreateRequestBody; + } + } 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 addVouchersToCampaign + * + * Add Vouchers to Campaign + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param int $vouchersCount Number of vouchers that should be added. (optional) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBody $campaignsVouchersCreateInBulkRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVouchersToCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBody + */ + public function addVouchersToCampaign($campaignId, $vouchersCount = null, $campaignsVouchersCreateInBulkRequestBody = null, string $contentType = self::contentTypes['addVouchersToCampaign'][0]) + { + list($response) = $this->addVouchersToCampaignWithHttpInfo($campaignId, $vouchersCount, $campaignsVouchersCreateInBulkRequestBody, $contentType); + return $response; + } + + /** + * Operation addVouchersToCampaignWithHttpInfo + * + * Add Vouchers to Campaign + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param int $vouchersCount Number of vouchers that should be added. (optional) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBody $campaignsVouchersCreateInBulkRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVouchersToCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function addVouchersToCampaignWithHttpInfo($campaignId, $vouchersCount = null, $campaignsVouchersCreateInBulkRequestBody = null, string $contentType = self::contentTypes['addVouchersToCampaign'][0]) + { + $request = $this->addVouchersToCampaignRequest($campaignId, $vouchersCount, $campaignsVouchersCreateInBulkRequestBody, $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\CampaignsVouchersCreateCombinedResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBody'; + 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\CampaignsVouchersCreateCombinedResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addVouchersToCampaignAsync + * + * Add Vouchers to Campaign + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param int $vouchersCount Number of vouchers that should be added. (optional) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBody $campaignsVouchersCreateInBulkRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVouchersToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addVouchersToCampaignAsync($campaignId, $vouchersCount = null, $campaignsVouchersCreateInBulkRequestBody = null, string $contentType = self::contentTypes['addVouchersToCampaign'][0]) + { + return $this->addVouchersToCampaignAsyncWithHttpInfo($campaignId, $vouchersCount, $campaignsVouchersCreateInBulkRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addVouchersToCampaignAsyncWithHttpInfo + * + * Add Vouchers to Campaign + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param int $vouchersCount Number of vouchers that should be added. (optional) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBody $campaignsVouchersCreateInBulkRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVouchersToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addVouchersToCampaignAsyncWithHttpInfo($campaignId, $vouchersCount = null, $campaignsVouchersCreateInBulkRequestBody = null, string $contentType = self::contentTypes['addVouchersToCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBody'; + $request = $this->addVouchersToCampaignRequest($campaignId, $vouchersCount, $campaignsVouchersCreateInBulkRequestBody, $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 'addVouchersToCampaign' + * + * @param string $campaignId The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param int $vouchersCount Number of vouchers that should be added. (optional) + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBody $campaignsVouchersCreateInBulkRequestBody Specify the voucher parameters that you would like to overwrite. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addVouchersToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addVouchersToCampaignRequest($campaignId, $vouchersCount = null, $campaignsVouchersCreateInBulkRequestBody = null, string $contentType = self::contentTypes['addVouchersToCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling addVouchersToCampaign' + ); + } + + + + + $resourcePath = '/v1/campaigns/{campaignId}/vouchers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $vouchersCount, + 'vouchers_count', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($campaignsVouchersCreateInBulkRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($campaignsVouchersCreateInBulkRequestBody)); + } else { + $httpBody = $campaignsVouchersCreateInBulkRequestBody; + } + } 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 createCampaign + * + * Create Campaign + * + * @param \OpenAPI\Client\Model\CampaignsCreateRequestBody $campaignsCreateRequestBody Specify the details of the campaign that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsCreateResponseBody + */ + public function createCampaign($campaignsCreateRequestBody = null, string $contentType = self::contentTypes['createCampaign'][0]) + { + list($response) = $this->createCampaignWithHttpInfo($campaignsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createCampaignWithHttpInfo + * + * Create Campaign + * + * @param \OpenAPI\Client\Model\CampaignsCreateRequestBody $campaignsCreateRequestBody Specify the details of the campaign that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createCampaignWithHttpInfo($campaignsCreateRequestBody = null, string $contentType = self::contentTypes['createCampaign'][0]) + { + $request = $this->createCampaignRequest($campaignsCreateRequestBody, $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\CampaignsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsCreateResponseBody'; + 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\CampaignsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createCampaignAsync + * + * Create Campaign + * + * @param \OpenAPI\Client\Model\CampaignsCreateRequestBody $campaignsCreateRequestBody Specify the details of the campaign that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createCampaignAsync($campaignsCreateRequestBody = null, string $contentType = self::contentTypes['createCampaign'][0]) + { + return $this->createCampaignAsyncWithHttpInfo($campaignsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createCampaignAsyncWithHttpInfo + * + * Create Campaign + * + * @param \OpenAPI\Client\Model\CampaignsCreateRequestBody $campaignsCreateRequestBody Specify the details of the campaign that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createCampaignAsyncWithHttpInfo($campaignsCreateRequestBody = null, string $contentType = self::contentTypes['createCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsCreateResponseBody'; + $request = $this->createCampaignRequest($campaignsCreateRequestBody, $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 'createCampaign' + * + * @param \OpenAPI\Client\Model\CampaignsCreateRequestBody $campaignsCreateRequestBody Specify the details of the campaign that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createCampaignRequest($campaignsCreateRequestBody = null, string $contentType = self::contentTypes['createCampaign'][0]) + { + + + + $resourcePath = '/v1/campaigns'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($campaignsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($campaignsCreateRequestBody)); + } else { + $httpBody = $campaignsCreateRequestBody; + } + } 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 deleteCampaign + * + * Delete Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsDeleteResponseBody + */ + public function deleteCampaign($campaignId, $force = null, string $contentType = self::contentTypes['deleteCampaign'][0]) + { + list($response) = $this->deleteCampaignWithHttpInfo($campaignId, $force, $contentType); + return $response; + } + + /** + * Operation deleteCampaignWithHttpInfo + * + * Delete Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsDeleteResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteCampaignWithHttpInfo($campaignId, $force = null, string $contentType = self::contentTypes['deleteCampaign'][0]) + { + $request = $this->deleteCampaignRequest($campaignId, $force, $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 202: + if ('\OpenAPI\Client\Model\CampaignsDeleteResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsDeleteResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsDeleteResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsDeleteResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\CampaignsDeleteResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteCampaignAsync + * + * Delete Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteCampaignAsync($campaignId, $force = null, string $contentType = self::contentTypes['deleteCampaign'][0]) + { + return $this->deleteCampaignAsyncWithHttpInfo($campaignId, $force, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteCampaignAsyncWithHttpInfo + * + * Delete Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteCampaignAsyncWithHttpInfo($campaignId, $force = null, string $contentType = self::contentTypes['deleteCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsDeleteResponseBody'; + $request = $this->deleteCampaignRequest($campaignId, $force, $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 'deleteCampaign' + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteCampaignRequest($campaignId, $force = null, string $contentType = self::contentTypes['deleteCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling deleteCampaign' + ); + } + + + + $resourcePath = '/v1/campaigns/{campaignId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $force, + 'force', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation disableCampaign + * + * Disable Campaign + * + * @param string $campaignId The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return object + */ + public function disableCampaign($campaignId, string $contentType = self::contentTypes['disableCampaign'][0]) + { + list($response) = $this->disableCampaignWithHttpInfo($campaignId, $contentType); + return $response; + } + + /** + * Operation disableCampaignWithHttpInfo + * + * Disable Campaign + * + * @param string $campaignId The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of object, HTTP status code, HTTP response headers (array of strings) + */ + public function disableCampaignWithHttpInfo($campaignId, string $contentType = self::contentTypes['disableCampaign'][0]) + { + $request = $this->disableCampaignRequest($campaignId, $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 ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; + 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(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation disableCampaignAsync + * + * Disable Campaign + * + * @param string $campaignId The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disableCampaignAsync($campaignId, string $contentType = self::contentTypes['disableCampaign'][0]) + { + return $this->disableCampaignAsyncWithHttpInfo($campaignId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation disableCampaignAsyncWithHttpInfo + * + * Disable Campaign + * + * @param string $campaignId The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disableCampaignAsyncWithHttpInfo($campaignId, string $contentType = self::contentTypes['disableCampaign'][0]) + { + $returnType = 'object'; + $request = $this->disableCampaignRequest($campaignId, $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 'disableCampaign' + * + * @param string $campaignId The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function disableCampaignRequest($campaignId, string $contentType = self::contentTypes['disableCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling disableCampaign' + ); + } + + + $resourcePath = '/v1/campaigns/{campaignId}/disable'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 enableCampaign + * + * Enable Campaign + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return object + */ + public function enableCampaign($campaignId, string $contentType = self::contentTypes['enableCampaign'][0]) + { + list($response) = $this->enableCampaignWithHttpInfo($campaignId, $contentType); + return $response; + } + + /** + * Operation enableCampaignWithHttpInfo + * + * Enable Campaign + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of object, HTTP status code, HTTP response headers (array of strings) + */ + public function enableCampaignWithHttpInfo($campaignId, string $contentType = self::contentTypes['enableCampaign'][0]) + { + $request = $this->enableCampaignRequest($campaignId, $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 ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; + 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(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation enableCampaignAsync + * + * Enable Campaign + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enableCampaignAsync($campaignId, string $contentType = self::contentTypes['enableCampaign'][0]) + { + return $this->enableCampaignAsyncWithHttpInfo($campaignId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation enableCampaignAsyncWithHttpInfo + * + * Enable Campaign + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enableCampaignAsyncWithHttpInfo($campaignId, string $contentType = self::contentTypes['enableCampaign'][0]) + { + $returnType = 'object'; + $request = $this->enableCampaignRequest($campaignId, $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 'enableCampaign' + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function enableCampaignRequest($campaignId, string $contentType = self::contentTypes['enableCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling enableCampaign' + ); + } + + + $resourcePath = '/v1/campaigns/{campaignId}/enable'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 getCampaign + * + * Get Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsGetResponseBody + */ + public function getCampaign($campaignId, string $contentType = self::contentTypes['getCampaign'][0]) + { + list($response) = $this->getCampaignWithHttpInfo($campaignId, $contentType); + return $response; + } + + /** + * Operation getCampaignWithHttpInfo + * + * Get Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getCampaignWithHttpInfo($campaignId, string $contentType = self::contentTypes['getCampaign'][0]) + { + $request = $this->getCampaignRequest($campaignId, $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\CampaignsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsGetResponseBody'; + 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\CampaignsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getCampaignAsync + * + * Get Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCampaignAsync($campaignId, string $contentType = self::contentTypes['getCampaign'][0]) + { + return $this->getCampaignAsyncWithHttpInfo($campaignId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCampaignAsyncWithHttpInfo + * + * Get Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCampaignAsyncWithHttpInfo($campaignId, string $contentType = self::contentTypes['getCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsGetResponseBody'; + $request = $this->getCampaignRequest($campaignId, $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 'getCampaign' + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getCampaignRequest($campaignId, string $contentType = self::contentTypes['getCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getCampaign' + ); + } + + + $resourcePath = '/v1/campaigns/{campaignId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation importVouchersToCampaign + * + * Import Vouchers to Campaign + * + * @param string $campaignId The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsImportVoucherItem[] $campaignsImportVoucherItem Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsImportCreateResponseBody + */ + public function importVouchersToCampaign($campaignId, $campaignsImportVoucherItem = null, string $contentType = self::contentTypes['importVouchersToCampaign'][0]) + { + list($response) = $this->importVouchersToCampaignWithHttpInfo($campaignId, $campaignsImportVoucherItem, $contentType); + return $response; + } + + /** + * Operation importVouchersToCampaignWithHttpInfo + * + * Import Vouchers to Campaign + * + * @param string $campaignId The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsImportVoucherItem[] $campaignsImportVoucherItem Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsImportCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function importVouchersToCampaignWithHttpInfo($campaignId, $campaignsImportVoucherItem = null, string $contentType = self::contentTypes['importVouchersToCampaign'][0]) + { + $request = $this->importVouchersToCampaignRequest($campaignId, $campaignsImportVoucherItem, $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 202: + if ('\OpenAPI\Client\Model\CampaignsImportCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsImportCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsImportCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsImportCreateResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\CampaignsImportCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation importVouchersToCampaignAsync + * + * Import Vouchers to Campaign + * + * @param string $campaignId The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsImportVoucherItem[] $campaignsImportVoucherItem Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importVouchersToCampaignAsync($campaignId, $campaignsImportVoucherItem = null, string $contentType = self::contentTypes['importVouchersToCampaign'][0]) + { + return $this->importVouchersToCampaignAsyncWithHttpInfo($campaignId, $campaignsImportVoucherItem, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importVouchersToCampaignAsyncWithHttpInfo + * + * Import Vouchers to Campaign + * + * @param string $campaignId The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsImportVoucherItem[] $campaignsImportVoucherItem Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importVouchersToCampaignAsyncWithHttpInfo($campaignId, $campaignsImportVoucherItem = null, string $contentType = self::contentTypes['importVouchersToCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsImportCreateResponseBody'; + $request = $this->importVouchersToCampaignRequest($campaignId, $campaignsImportVoucherItem, $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 'importVouchersToCampaign' + * + * @param string $campaignId The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsImportVoucherItem[] $campaignsImportVoucherItem Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importVouchersToCampaignRequest($campaignId, $campaignsImportVoucherItem = null, string $contentType = self::contentTypes['importVouchersToCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling importVouchersToCampaign' + ); + } + + + + $resourcePath = '/v1/campaigns/{campaignId}/import'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($campaignsImportVoucherItem)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($campaignsImportVoucherItem)); + } else { + $httpBody = $campaignsImportVoucherItem; + } + } 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 importVouchersToCampaignUsingCsv + * + * Import Vouchers to Campaign by CSV + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaignUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsImportCsvCreateResponseBody + */ + public function importVouchersToCampaignUsingCsv($campaignId, $file = null, string $contentType = self::contentTypes['importVouchersToCampaignUsingCsv'][0]) + { + list($response) = $this->importVouchersToCampaignUsingCsvWithHttpInfo($campaignId, $file, $contentType); + return $response; + } + + /** + * Operation importVouchersToCampaignUsingCsvWithHttpInfo + * + * Import Vouchers to Campaign by CSV + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaignUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsImportCsvCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function importVouchersToCampaignUsingCsvWithHttpInfo($campaignId, $file = null, string $contentType = self::contentTypes['importVouchersToCampaignUsingCsv'][0]) + { + $request = $this->importVouchersToCampaignUsingCsvRequest($campaignId, $file, $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\CampaignsImportCsvCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsImportCsvCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsImportCsvCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsImportCsvCreateResponseBody'; + 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\CampaignsImportCsvCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation importVouchersToCampaignUsingCsvAsync + * + * Import Vouchers to Campaign by CSV + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaignUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importVouchersToCampaignUsingCsvAsync($campaignId, $file = null, string $contentType = self::contentTypes['importVouchersToCampaignUsingCsv'][0]) + { + return $this->importVouchersToCampaignUsingCsvAsyncWithHttpInfo($campaignId, $file, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importVouchersToCampaignUsingCsvAsyncWithHttpInfo + * + * Import Vouchers to Campaign by CSV + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaignUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importVouchersToCampaignUsingCsvAsyncWithHttpInfo($campaignId, $file = null, string $contentType = self::contentTypes['importVouchersToCampaignUsingCsv'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsImportCsvCreateResponseBody'; + $request = $this->importVouchersToCampaignUsingCsvRequest($campaignId, $file, $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 'importVouchersToCampaignUsingCsv' + * + * @param string $campaignId The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersToCampaignUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importVouchersToCampaignUsingCsvRequest($campaignId, $file = null, string $contentType = self::contentTypes['importVouchersToCampaignUsingCsv'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling importVouchersToCampaignUsingCsv' + ); + } + + + + $resourcePath = '/v1/campaigns/{campaignId}/importCSV'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + // form params + if ($file !== null) { + $multipart = true; + $formParams['file'] = []; + $paramFiles = is_array($file) ? $file : [$file]; + foreach ($paramFiles as $paramFile) { + $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 listCampaigns + * + * List Campaigns + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterCampaignType $campaignType This attribute allows filtering by campaign type. (optional) + * @param ParameterExpandListCampaigns $expand Include an expanded categories object in the response. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCampaigns'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsListResponseBody + */ + public function listCampaigns($limit = null, $page = null, $campaignType = null, $expand = null, $order = null, string $contentType = self::contentTypes['listCampaigns'][0]) + { + list($response) = $this->listCampaignsWithHttpInfo($limit, $page, $campaignType, $expand, $order, $contentType); + return $response; + } + + /** + * Operation listCampaignsWithHttpInfo + * + * List Campaigns + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterCampaignType $campaignType This attribute allows filtering by campaign type. (optional) + * @param ParameterExpandListCampaigns $expand Include an expanded categories object in the response. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCampaigns'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listCampaignsWithHttpInfo($limit = null, $page = null, $campaignType = null, $expand = null, $order = null, string $contentType = self::contentTypes['listCampaigns'][0]) + { + $request = $this->listCampaignsRequest($limit, $page, $campaignType, $expand, $order, $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\CampaignsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsListResponseBody'; + 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\CampaignsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listCampaignsAsync + * + * List Campaigns + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterCampaignType $campaignType This attribute allows filtering by campaign type. (optional) + * @param ParameterExpandListCampaigns $expand Include an expanded categories object in the response. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCampaigns'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCampaignsAsync($limit = null, $page = null, $campaignType = null, $expand = null, $order = null, string $contentType = self::contentTypes['listCampaigns'][0]) + { + return $this->listCampaignsAsyncWithHttpInfo($limit, $page, $campaignType, $expand, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCampaignsAsyncWithHttpInfo + * + * List Campaigns + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterCampaignType $campaignType This attribute allows filtering by campaign type. (optional) + * @param ParameterExpandListCampaigns $expand Include an expanded categories object in the response. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCampaigns'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCampaignsAsyncWithHttpInfo($limit = null, $page = null, $campaignType = null, $expand = null, $order = null, string $contentType = self::contentTypes['listCampaigns'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsListResponseBody'; + $request = $this->listCampaignsRequest($limit, $page, $campaignType, $expand, $order, $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 'listCampaigns' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterCampaignType $campaignType This attribute allows filtering by campaign type. (optional) + * @param ParameterExpandListCampaigns $expand Include an expanded categories object in the response. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCampaigns'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCampaignsRequest($limit = null, $page = null, $campaignType = null, $expand = null, $order = null, string $contentType = self::contentTypes['listCampaigns'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling CampaignsApi.listCampaigns, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling CampaignsApi.listCampaigns, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling CampaignsApi.listCampaigns, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling CampaignsApi.listCampaigns, must be bigger than or equal to 1.'); + } + + + + + + $resourcePath = '/v1/campaigns'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaignType, + 'campaign_type', // param base name + 'ParameterCampaignType', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $expand, + 'expand', // param base name + 'ParameterExpandListCampaigns', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListCampaigns', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateCampaign + * + * Update Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsUpdateRequestBody $campaignsUpdateRequestBody Specify the campaign parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CampaignsUpdateResponseBody + */ + public function updateCampaign($campaignId, $campaignsUpdateRequestBody = null, string $contentType = self::contentTypes['updateCampaign'][0]) + { + list($response) = $this->updateCampaignWithHttpInfo($campaignId, $campaignsUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateCampaignWithHttpInfo + * + * Update Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsUpdateRequestBody $campaignsUpdateRequestBody Specify the campaign parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CampaignsUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateCampaignWithHttpInfo($campaignId, $campaignsUpdateRequestBody = null, string $contentType = self::contentTypes['updateCampaign'][0]) + { + $request = $this->updateCampaignRequest($campaignId, $campaignsUpdateRequestBody, $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\CampaignsUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CampaignsUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CampaignsUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CampaignsUpdateResponseBody'; + 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\CampaignsUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateCampaignAsync + * + * Update Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsUpdateRequestBody $campaignsUpdateRequestBody Specify the campaign parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCampaignAsync($campaignId, $campaignsUpdateRequestBody = null, string $contentType = self::contentTypes['updateCampaign'][0]) + { + return $this->updateCampaignAsyncWithHttpInfo($campaignId, $campaignsUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCampaignAsyncWithHttpInfo + * + * Update Campaign + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsUpdateRequestBody $campaignsUpdateRequestBody Specify the campaign parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCampaignAsyncWithHttpInfo($campaignId, $campaignsUpdateRequestBody = null, string $contentType = self::contentTypes['updateCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\CampaignsUpdateResponseBody'; + $request = $this->updateCampaignRequest($campaignId, $campaignsUpdateRequestBody, $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 'updateCampaign' + * + * @param string $campaignId You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + * @param \OpenAPI\Client\Model\CampaignsUpdateRequestBody $campaignsUpdateRequestBody Specify the campaign parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateCampaignRequest($campaignId, $campaignsUpdateRequestBody = null, string $contentType = self::contentTypes['updateCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateCampaign' + ); + } + + + + $resourcePath = '/v1/campaigns/{campaignId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($campaignsUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($campaignsUpdateRequestBody)); + } else { + $httpBody = $campaignsUpdateRequestBody; + } + } 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( + 'PUT', + $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/Api/CategoriesApi.php b/src/Api/CategoriesApi.php new file mode 100644 index 0000000..deeb227 --- /dev/null +++ b/src/Api/CategoriesApi.php @@ -0,0 +1,1553 @@ + [ + 'application/json', + ], + 'deleteCategory' => [ + 'application/json', + ], + 'getCategory' => [ + 'application/json', + ], + 'listCategories' => [ + 'application/json', + ], + 'updateCategory' => [ + '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 createCategory + * + * Create Category + * + * @param \OpenAPI\Client\Model\CategoriesCreateRequestBody $categoriesCreateRequestBody Specify the details of the category that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCategory'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CategoriesCreateResponseBody + */ + public function createCategory($categoriesCreateRequestBody = null, string $contentType = self::contentTypes['createCategory'][0]) + { + list($response) = $this->createCategoryWithHttpInfo($categoriesCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createCategoryWithHttpInfo + * + * Create Category + * + * @param \OpenAPI\Client\Model\CategoriesCreateRequestBody $categoriesCreateRequestBody Specify the details of the category that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCategory'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CategoriesCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createCategoryWithHttpInfo($categoriesCreateRequestBody = null, string $contentType = self::contentTypes['createCategory'][0]) + { + $request = $this->createCategoryRequest($categoriesCreateRequestBody, $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\CategoriesCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CategoriesCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CategoriesCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CategoriesCreateResponseBody'; + 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\CategoriesCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createCategoryAsync + * + * Create Category + * + * @param \OpenAPI\Client\Model\CategoriesCreateRequestBody $categoriesCreateRequestBody Specify the details of the category that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createCategoryAsync($categoriesCreateRequestBody = null, string $contentType = self::contentTypes['createCategory'][0]) + { + return $this->createCategoryAsyncWithHttpInfo($categoriesCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createCategoryAsyncWithHttpInfo + * + * Create Category + * + * @param \OpenAPI\Client\Model\CategoriesCreateRequestBody $categoriesCreateRequestBody Specify the details of the category that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createCategoryAsyncWithHttpInfo($categoriesCreateRequestBody = null, string $contentType = self::contentTypes['createCategory'][0]) + { + $returnType = '\OpenAPI\Client\Model\CategoriesCreateResponseBody'; + $request = $this->createCategoryRequest($categoriesCreateRequestBody, $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 'createCategory' + * + * @param \OpenAPI\Client\Model\CategoriesCreateRequestBody $categoriesCreateRequestBody Specify the details of the category that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createCategoryRequest($categoriesCreateRequestBody = null, string $contentType = self::contentTypes['createCategory'][0]) + { + + + + $resourcePath = '/v1/categories'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($categoriesCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($categoriesCreateRequestBody)); + } else { + $httpBody = $categoriesCreateRequestBody; + } + } 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 deleteCategory + * + * Delete Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCategory'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteCategory($categoryId, string $contentType = self::contentTypes['deleteCategory'][0]) + { + $this->deleteCategoryWithHttpInfo($categoryId, $contentType); + } + + /** + * Operation deleteCategoryWithHttpInfo + * + * Delete Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCategory'] 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 deleteCategoryWithHttpInfo($categoryId, string $contentType = self::contentTypes['deleteCategory'][0]) + { + $request = $this->deleteCategoryRequest($categoryId, $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 deleteCategoryAsync + * + * Delete Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteCategoryAsync($categoryId, string $contentType = self::contentTypes['deleteCategory'][0]) + { + return $this->deleteCategoryAsyncWithHttpInfo($categoryId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteCategoryAsyncWithHttpInfo + * + * Delete Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteCategoryAsyncWithHttpInfo($categoryId, string $contentType = self::contentTypes['deleteCategory'][0]) + { + $returnType = ''; + $request = $this->deleteCategoryRequest($categoryId, $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 'deleteCategory' + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteCategoryRequest($categoryId, string $contentType = self::contentTypes['deleteCategory'][0]) + { + + // verify the required parameter 'categoryId' is set + if ($categoryId === null || (is_array($categoryId) && count($categoryId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $categoryId when calling deleteCategory' + ); + } + + + $resourcePath = '/v1/categories/{categoryId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($categoryId !== null) { + $resourcePath = str_replace( + '{' . 'categoryId' . '}', + ObjectSerializer::toPathValue($categoryId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getCategory + * + * Get Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategory'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CategoriesGetResponseBody + */ + public function getCategory($categoryId, string $contentType = self::contentTypes['getCategory'][0]) + { + list($response) = $this->getCategoryWithHttpInfo($categoryId, $contentType); + return $response; + } + + /** + * Operation getCategoryWithHttpInfo + * + * Get Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategory'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CategoriesGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getCategoryWithHttpInfo($categoryId, string $contentType = self::contentTypes['getCategory'][0]) + { + $request = $this->getCategoryRequest($categoryId, $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\CategoriesGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CategoriesGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CategoriesGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CategoriesGetResponseBody'; + 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\CategoriesGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getCategoryAsync + * + * Get Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCategoryAsync($categoryId, string $contentType = self::contentTypes['getCategory'][0]) + { + return $this->getCategoryAsyncWithHttpInfo($categoryId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCategoryAsyncWithHttpInfo + * + * Get Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCategoryAsyncWithHttpInfo($categoryId, string $contentType = self::contentTypes['getCategory'][0]) + { + $returnType = '\OpenAPI\Client\Model\CategoriesGetResponseBody'; + $request = $this->getCategoryRequest($categoryId, $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 'getCategory' + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getCategoryRequest($categoryId, string $contentType = self::contentTypes['getCategory'][0]) + { + + // verify the required parameter 'categoryId' is set + if ($categoryId === null || (is_array($categoryId) && count($categoryId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $categoryId when calling getCategory' + ); + } + + + $resourcePath = '/v1/categories/{categoryId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($categoryId !== null) { + $resourcePath = str_replace( + '{' . 'categoryId' . '}', + ObjectSerializer::toPathValue($categoryId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCategories + * + * List Categories + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCategories'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CategoriesListResponseBody + */ + public function listCategories(string $contentType = self::contentTypes['listCategories'][0]) + { + list($response) = $this->listCategoriesWithHttpInfo($contentType); + return $response; + } + + /** + * Operation listCategoriesWithHttpInfo + * + * List Categories + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCategories'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CategoriesListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listCategoriesWithHttpInfo(string $contentType = self::contentTypes['listCategories'][0]) + { + $request = $this->listCategoriesRequest($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\CategoriesListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CategoriesListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CategoriesListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CategoriesListResponseBody'; + 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\CategoriesListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listCategoriesAsync + * + * List Categories + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCategories'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCategoriesAsync(string $contentType = self::contentTypes['listCategories'][0]) + { + return $this->listCategoriesAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCategoriesAsyncWithHttpInfo + * + * List Categories + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCategories'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCategoriesAsyncWithHttpInfo(string $contentType = self::contentTypes['listCategories'][0]) + { + $returnType = '\OpenAPI\Client\Model\CategoriesListResponseBody'; + $request = $this->listCategoriesRequest($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 'listCategories' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCategories'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCategoriesRequest(string $contentType = self::contentTypes['listCategories'][0]) + { + + + $resourcePath = '/v1/categories'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateCategory + * + * Update Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\CategoriesUpdateRequestBody $categoriesUpdateRequestBody Specify the details of the category that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCategory'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CategoriesUpdateResponseBody + */ + public function updateCategory($categoryId, $categoriesUpdateRequestBody = null, string $contentType = self::contentTypes['updateCategory'][0]) + { + list($response) = $this->updateCategoryWithHttpInfo($categoryId, $categoriesUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateCategoryWithHttpInfo + * + * Update Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\CategoriesUpdateRequestBody $categoriesUpdateRequestBody Specify the details of the category that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCategory'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CategoriesUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateCategoryWithHttpInfo($categoryId, $categoriesUpdateRequestBody = null, string $contentType = self::contentTypes['updateCategory'][0]) + { + $request = $this->updateCategoryRequest($categoryId, $categoriesUpdateRequestBody, $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\CategoriesUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CategoriesUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CategoriesUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CategoriesUpdateResponseBody'; + 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\CategoriesUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateCategoryAsync + * + * Update Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\CategoriesUpdateRequestBody $categoriesUpdateRequestBody Specify the details of the category that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCategoryAsync($categoryId, $categoriesUpdateRequestBody = null, string $contentType = self::contentTypes['updateCategory'][0]) + { + return $this->updateCategoryAsyncWithHttpInfo($categoryId, $categoriesUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCategoryAsyncWithHttpInfo + * + * Update Category + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\CategoriesUpdateRequestBody $categoriesUpdateRequestBody Specify the details of the category that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCategoryAsyncWithHttpInfo($categoryId, $categoriesUpdateRequestBody = null, string $contentType = self::contentTypes['updateCategory'][0]) + { + $returnType = '\OpenAPI\Client\Model\CategoriesUpdateResponseBody'; + $request = $this->updateCategoryRequest($categoryId, $categoriesUpdateRequestBody, $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 'updateCategory' + * + * @param string $categoryId Unique category ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\CategoriesUpdateRequestBody $categoriesUpdateRequestBody Specify the details of the category that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCategory'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateCategoryRequest($categoryId, $categoriesUpdateRequestBody = null, string $contentType = self::contentTypes['updateCategory'][0]) + { + + // verify the required parameter 'categoryId' is set + if ($categoryId === null || (is_array($categoryId) && count($categoryId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $categoryId when calling updateCategory' + ); + } + + + + $resourcePath = '/v1/categories/{categoryId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($categoryId !== null) { + $resourcePath = str_replace( + '{' . 'categoryId' . '}', + ObjectSerializer::toPathValue($categoryId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($categoriesUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($categoriesUpdateRequestBody)); + } else { + $httpBody = $categoriesUpdateRequestBody; + } + } 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( + 'PUT', + $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/Api/ClientSideApi.php b/src/Api/ClientSideApi.php new file mode 100644 index 0000000..7aed550 --- /dev/null +++ b/src/Api/ClientSideApi.php @@ -0,0 +1,1703 @@ + [ + 'application/json', + ], + 'listPromotionTiersClientSide' => [ + 'application/json', + ], + 'redeemStackedDiscountsClientSide' => [ + 'application/json', + ], + 'trackCustomEventClientSide' => [ + 'application/json', + ], + 'validateStackedDiscountsClientSide' => [ + '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 checkEligibilityClientSide + * + * Check Eligibility (client-side) + * + * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $clientQualificationsCheckEligibilityRequestBody 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($clientQualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) + { + list($response) = $this->checkEligibilityClientSideWithHttpInfo($clientQualificationsCheckEligibilityRequestBody, $contentType); + return $response; + } + + /** + * Operation checkEligibilityClientSideWithHttpInfo + * + * Check Eligibility (client-side) + * + * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $clientQualificationsCheckEligibilityRequestBody 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($clientQualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) + { + $request = $this->checkEligibilityClientSideRequest($clientQualificationsCheckEligibilityRequestBody, $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 $clientQualificationsCheckEligibilityRequestBody 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($clientQualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) + { + return $this->checkEligibilityClientSideAsyncWithHttpInfo($clientQualificationsCheckEligibilityRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation checkEligibilityClientSideAsyncWithHttpInfo + * + * Check Eligibility (client-side) + * + * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $clientQualificationsCheckEligibilityRequestBody 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($clientQualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) + { + $returnType = '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody'; + $request = $this->checkEligibilityClientSideRequest($clientQualificationsCheckEligibilityRequestBody, $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 $clientQualificationsCheckEligibilityRequestBody 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($clientQualificationsCheckEligibilityRequestBody = 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($clientQualificationsCheckEligibilityRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($clientQualificationsCheckEligibilityRequestBody)); + } else { + $httpBody = $clientQualificationsCheckEligibilityRequestBody; + } + } 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 + ); + } + + /** + * Operation listPromotionTiersClientSide + * + * List Promotion Tiers (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiersClientSide $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersClientSide'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ClientPromotionsTiersListResponseBody + */ + public function listPromotionTiersClientSide($origin, $isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiersClientSide'][0]) + { + list($response) = $this->listPromotionTiersClientSideWithHttpInfo($origin, $isAvailable, $limit, $page, $order, $contentType); + return $response; + } + + /** + * Operation listPromotionTiersClientSideWithHttpInfo + * + * List Promotion Tiers (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiersClientSide $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersClientSide'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ClientPromotionsTiersListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listPromotionTiersClientSideWithHttpInfo($origin, $isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiersClientSide'][0]) + { + $request = $this->listPromotionTiersClientSideRequest($origin, $isAvailable, $limit, $page, $order, $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\ClientPromotionsTiersListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ClientPromotionsTiersListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ClientPromotionsTiersListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ClientPromotionsTiersListResponseBody'; + 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\ClientPromotionsTiersListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listPromotionTiersClientSideAsync + * + * List Promotion Tiers (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiersClientSide $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPromotionTiersClientSideAsync($origin, $isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiersClientSide'][0]) + { + return $this->listPromotionTiersClientSideAsyncWithHttpInfo($origin, $isAvailable, $limit, $page, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listPromotionTiersClientSideAsyncWithHttpInfo + * + * List Promotion Tiers (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiersClientSide $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPromotionTiersClientSideAsyncWithHttpInfo($origin, $isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiersClientSide'][0]) + { + $returnType = '\OpenAPI\Client\Model\ClientPromotionsTiersListResponseBody'; + $request = $this->listPromotionTiersClientSideRequest($origin, $isAvailable, $limit, $page, $order, $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 'listPromotionTiersClientSide' + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiersClientSide $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listPromotionTiersClientSideRequest($origin, $isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiersClientSide'][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 listPromotionTiersClientSide' + ); + } + + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ClientSideApi.listPromotionTiersClientSide, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ClientSideApi.listPromotionTiersClientSide, must be bigger than or equal to 1.'); + } + + + + + $resourcePath = '/client/v1/promotions/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $isAvailable, + 'is_available', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListPromotionTiersClientSide', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + // header params + if ($origin !== null) { + $headerParams['origin'] = ObjectSerializer::toHeaderValue($origin); + } + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation redeemStackedDiscountsClientSide + * + * Redeem Stackable Discounts (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBody $clientRedemptionsRedeemRequestBody clientRedemptionsRedeemRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ClientRedemptionsRedeemResponseBody + */ + public function redeemStackedDiscountsClientSide($origin, $clientRedemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscountsClientSide'][0]) + { + list($response) = $this->redeemStackedDiscountsClientSideWithHttpInfo($origin, $clientRedemptionsRedeemRequestBody, $contentType); + return $response; + } + + /** + * Operation redeemStackedDiscountsClientSideWithHttpInfo + * + * Redeem Stackable Discounts (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBody $clientRedemptionsRedeemRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ClientRedemptionsRedeemResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function redeemStackedDiscountsClientSideWithHttpInfo($origin, $clientRedemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscountsClientSide'][0]) + { + $request = $this->redeemStackedDiscountsClientSideRequest($origin, $clientRedemptionsRedeemRequestBody, $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\ClientRedemptionsRedeemResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ClientRedemptionsRedeemResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ClientRedemptionsRedeemResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ClientRedemptionsRedeemResponseBody'; + 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\ClientRedemptionsRedeemResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation redeemStackedDiscountsClientSideAsync + * + * Redeem Stackable Discounts (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBody $clientRedemptionsRedeemRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redeemStackedDiscountsClientSideAsync($origin, $clientRedemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscountsClientSide'][0]) + { + return $this->redeemStackedDiscountsClientSideAsyncWithHttpInfo($origin, $clientRedemptionsRedeemRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation redeemStackedDiscountsClientSideAsyncWithHttpInfo + * + * Redeem Stackable Discounts (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBody $clientRedemptionsRedeemRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redeemStackedDiscountsClientSideAsyncWithHttpInfo($origin, $clientRedemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscountsClientSide'][0]) + { + $returnType = '\OpenAPI\Client\Model\ClientRedemptionsRedeemResponseBody'; + $request = $this->redeemStackedDiscountsClientSideRequest($origin, $clientRedemptionsRedeemRequestBody, $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 'redeemStackedDiscountsClientSide' + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBody $clientRedemptionsRedeemRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function redeemStackedDiscountsClientSideRequest($origin, $clientRedemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscountsClientSide'][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 redeemStackedDiscountsClientSide' + ); + } + + + + $resourcePath = '/client/v1/redemptions'; + $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($clientRedemptionsRedeemRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($clientRedemptionsRedeemRequestBody)); + } else { + $httpBody = $clientRedemptionsRedeemRequestBody; + } + } 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 + ); + } + + /** + * Operation trackCustomEventClientSide + * + * Track Custom Event (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $clientEventsCreateRequestBody 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, $clientEventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) + { + list($response) = $this->trackCustomEventClientSideWithHttpInfo($origin, $clientEventsCreateRequestBody, $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 $clientEventsCreateRequestBody 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, $clientEventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) + { + $request = $this->trackCustomEventClientSideRequest($origin, $clientEventsCreateRequestBody, $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 $clientEventsCreateRequestBody 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, $clientEventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) + { + return $this->trackCustomEventClientSideAsyncWithHttpInfo($origin, $clientEventsCreateRequestBody, $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 $clientEventsCreateRequestBody 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, $clientEventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) + { + $returnType = '\OpenAPI\Client\Model\ClientEventsCreateResponseBody'; + $request = $this->trackCustomEventClientSideRequest($origin, $clientEventsCreateRequestBody, $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 $clientEventsCreateRequestBody 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, $clientEventsCreateRequestBody = 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($clientEventsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($clientEventsCreateRequestBody)); + } else { + $httpBody = $clientEventsCreateRequestBody; + } + } 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 + ); + } + + /** + * Operation validateStackedDiscountsClientSide + * + * Validate Stackable Discounts (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBody $clientValidationsValidateRequestBody clientValidationsValidateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ClientValidationsValidateResponseBody + */ + public function validateStackedDiscountsClientSide($origin, $clientValidationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscountsClientSide'][0]) + { + list($response) = $this->validateStackedDiscountsClientSideWithHttpInfo($origin, $clientValidationsValidateRequestBody, $contentType); + return $response; + } + + /** + * Operation validateStackedDiscountsClientSideWithHttpInfo + * + * Validate Stackable Discounts (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBody $clientValidationsValidateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ClientValidationsValidateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function validateStackedDiscountsClientSideWithHttpInfo($origin, $clientValidationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscountsClientSide'][0]) + { + $request = $this->validateStackedDiscountsClientSideRequest($origin, $clientValidationsValidateRequestBody, $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\ClientValidationsValidateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ClientValidationsValidateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ClientValidationsValidateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ClientValidationsValidateResponseBody'; + 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\ClientValidationsValidateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation validateStackedDiscountsClientSideAsync + * + * Validate Stackable Discounts (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBody $clientValidationsValidateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function validateStackedDiscountsClientSideAsync($origin, $clientValidationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscountsClientSide'][0]) + { + return $this->validateStackedDiscountsClientSideAsyncWithHttpInfo($origin, $clientValidationsValidateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation validateStackedDiscountsClientSideAsyncWithHttpInfo + * + * Validate Stackable Discounts (client-side) + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBody $clientValidationsValidateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function validateStackedDiscountsClientSideAsyncWithHttpInfo($origin, $clientValidationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscountsClientSide'][0]) + { + $returnType = '\OpenAPI\Client\Model\ClientValidationsValidateResponseBody'; + $request = $this->validateStackedDiscountsClientSideRequest($origin, $clientValidationsValidateRequestBody, $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 'validateStackedDiscountsClientSide' + * + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBody $clientValidationsValidateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscountsClientSide'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function validateStackedDiscountsClientSideRequest($origin, $clientValidationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscountsClientSide'][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 validateStackedDiscountsClientSide' + ); + } + + + + $resourcePath = '/client/v1/validations'; + $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($clientValidationsValidateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($clientValidationsValidateRequestBody)); + } else { + $httpBody = $clientValidationsValidateRequestBody; + } + } 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 + * + * @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/Api/CustomersApi.php b/src/Api/CustomersApi.php new file mode 100644 index 0000000..c045255 --- /dev/null +++ b/src/Api/CustomersApi.php @@ -0,0 +1,4268 @@ + [ + 'application/json', + ], + 'customerPermanentlyDeletion' => [ + 'application/json', + ], + 'deleteCustomer' => [ + 'application/json', + ], + 'getCustomer' => [ + 'application/json', + ], + 'importCustomersUsingCsv' => [ + 'multipart/form-data', + ], + 'listCustomerActivity' => [ + 'application/json', + ], + 'listCustomerRedeemables' => [ + 'application/json', + ], + 'listCustomerSegments' => [ + 'application/json', + ], + 'listCustomers' => [ + 'application/json', + ], + 'updateCustomer' => [ + 'application/json', + ], + 'updateCustomersConsents' => [ + 'application/json', + ], + 'updateCustomersInBulk' => [ + 'application/json', + ], + 'updateCustomersMetadataInBulk' => [ + '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 createCustomer + * + * Create Customer + * + * @param \OpenAPI\Client\Model\CustomersCreateRequestBody $customersCreateRequestBody Create a customer with specified parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCustomer'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersCreateResponseBody + */ + public function createCustomer($customersCreateRequestBody = null, string $contentType = self::contentTypes['createCustomer'][0]) + { + list($response) = $this->createCustomerWithHttpInfo($customersCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createCustomerWithHttpInfo + * + * Create Customer + * + * @param \OpenAPI\Client\Model\CustomersCreateRequestBody $customersCreateRequestBody Create a customer with specified parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCustomer'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createCustomerWithHttpInfo($customersCreateRequestBody = null, string $contentType = self::contentTypes['createCustomer'][0]) + { + $request = $this->createCustomerRequest($customersCreateRequestBody, $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\CustomersCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersCreateResponseBody'; + 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\CustomersCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createCustomerAsync + * + * Create Customer + * + * @param \OpenAPI\Client\Model\CustomersCreateRequestBody $customersCreateRequestBody Create a customer with specified parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createCustomerAsync($customersCreateRequestBody = null, string $contentType = self::contentTypes['createCustomer'][0]) + { + return $this->createCustomerAsyncWithHttpInfo($customersCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createCustomerAsyncWithHttpInfo + * + * Create Customer + * + * @param \OpenAPI\Client\Model\CustomersCreateRequestBody $customersCreateRequestBody Create a customer with specified parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createCustomerAsyncWithHttpInfo($customersCreateRequestBody = null, string $contentType = self::contentTypes['createCustomer'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersCreateResponseBody'; + $request = $this->createCustomerRequest($customersCreateRequestBody, $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 'createCustomer' + * + * @param \OpenAPI\Client\Model\CustomersCreateRequestBody $customersCreateRequestBody Create a customer with specified parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createCustomerRequest($customersCreateRequestBody = null, string $contentType = self::contentTypes['createCustomer'][0]) + { + + + + $resourcePath = '/v1/customers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($customersCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($customersCreateRequestBody)); + } else { + $httpBody = $customersCreateRequestBody; + } + } 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 customerPermanentlyDeletion + * + * Delete Customer Permanently + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customerPermanentlyDeletion'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBody + */ + public function customerPermanentlyDeletion($customerId, string $contentType = self::contentTypes['customerPermanentlyDeletion'][0]) + { + list($response) = $this->customerPermanentlyDeletionWithHttpInfo($customerId, $contentType); + return $response; + } + + /** + * Operation customerPermanentlyDeletionWithHttpInfo + * + * Delete Customer Permanently + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customerPermanentlyDeletion'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function customerPermanentlyDeletionWithHttpInfo($customerId, string $contentType = self::contentTypes['customerPermanentlyDeletion'][0]) + { + $request = $this->customerPermanentlyDeletionRequest($customerId, $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\CustomersPermanentDeletionCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBody'; + 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\CustomersPermanentDeletionCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation customerPermanentlyDeletionAsync + * + * Delete Customer Permanently + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customerPermanentlyDeletion'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function customerPermanentlyDeletionAsync($customerId, string $contentType = self::contentTypes['customerPermanentlyDeletion'][0]) + { + return $this->customerPermanentlyDeletionAsyncWithHttpInfo($customerId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation customerPermanentlyDeletionAsyncWithHttpInfo + * + * Delete Customer Permanently + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customerPermanentlyDeletion'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function customerPermanentlyDeletionAsyncWithHttpInfo($customerId, string $contentType = self::contentTypes['customerPermanentlyDeletion'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBody'; + $request = $this->customerPermanentlyDeletionRequest($customerId, $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 'customerPermanentlyDeletion' + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['customerPermanentlyDeletion'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function customerPermanentlyDeletionRequest($customerId, string $contentType = self::contentTypes['customerPermanentlyDeletion'][0]) + { + + // verify the required parameter 'customerId' is set + if ($customerId === null || (is_array($customerId) && count($customerId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customerId when calling customerPermanentlyDeletion' + ); + } + + + $resourcePath = '/v1/customers/{customerId}/permanent-deletion'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($customerId !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customerId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 deleteCustomer + * + * Delete Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCustomer'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteCustomer($customerId, string $contentType = self::contentTypes['deleteCustomer'][0]) + { + $this->deleteCustomerWithHttpInfo($customerId, $contentType); + } + + /** + * Operation deleteCustomerWithHttpInfo + * + * Delete Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCustomer'] 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 deleteCustomerWithHttpInfo($customerId, string $contentType = self::contentTypes['deleteCustomer'][0]) + { + $request = $this->deleteCustomerRequest($customerId, $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 deleteCustomerAsync + * + * Delete Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteCustomerAsync($customerId, string $contentType = self::contentTypes['deleteCustomer'][0]) + { + return $this->deleteCustomerAsyncWithHttpInfo($customerId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteCustomerAsyncWithHttpInfo + * + * Delete Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteCustomerAsyncWithHttpInfo($customerId, string $contentType = self::contentTypes['deleteCustomer'][0]) + { + $returnType = ''; + $request = $this->deleteCustomerRequest($customerId, $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 'deleteCustomer' + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteCustomerRequest($customerId, string $contentType = self::contentTypes['deleteCustomer'][0]) + { + + // verify the required parameter 'customerId' is set + if ($customerId === null || (is_array($customerId) && count($customerId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customerId when calling deleteCustomer' + ); + } + + + $resourcePath = '/v1/customers/{customerId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($customerId !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customerId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getCustomer + * + * Get Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCustomer'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersGetResponseBody + */ + public function getCustomer($customerId, string $contentType = self::contentTypes['getCustomer'][0]) + { + list($response) = $this->getCustomerWithHttpInfo($customerId, $contentType); + return $response; + } + + /** + * Operation getCustomerWithHttpInfo + * + * Get Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCustomer'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getCustomerWithHttpInfo($customerId, string $contentType = self::contentTypes['getCustomer'][0]) + { + $request = $this->getCustomerRequest($customerId, $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\CustomersGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersGetResponseBody'; + 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\CustomersGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getCustomerAsync + * + * Get Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCustomerAsync($customerId, string $contentType = self::contentTypes['getCustomer'][0]) + { + return $this->getCustomerAsyncWithHttpInfo($customerId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCustomerAsyncWithHttpInfo + * + * Get Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getCustomerAsyncWithHttpInfo($customerId, string $contentType = self::contentTypes['getCustomer'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersGetResponseBody'; + $request = $this->getCustomerRequest($customerId, $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 'getCustomer' + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getCustomerRequest($customerId, string $contentType = self::contentTypes['getCustomer'][0]) + { + + // verify the required parameter 'customerId' is set + if ($customerId === null || (is_array($customerId) && count($customerId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customerId when calling getCustomer' + ); + } + + + $resourcePath = '/v1/customers/{customerId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($customerId !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customerId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation importCustomersUsingCsv + * + * Import and Update Customers using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importCustomersUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody + */ + public function importCustomersUsingCsv($file = null, string $contentType = self::contentTypes['importCustomersUsingCsv'][0]) + { + list($response) = $this->importCustomersUsingCsvWithHttpInfo($file, $contentType); + return $response; + } + + /** + * Operation importCustomersUsingCsvWithHttpInfo + * + * Import and Update Customers using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importCustomersUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function importCustomersUsingCsvWithHttpInfo($file = null, string $contentType = self::contentTypes['importCustomersUsingCsv'][0]) + { + $request = $this->importCustomersUsingCsvRequest($file, $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 202: + if ('\OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation importCustomersUsingCsvAsync + * + * Import and Update Customers using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importCustomersUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importCustomersUsingCsvAsync($file = null, string $contentType = self::contentTypes['importCustomersUsingCsv'][0]) + { + return $this->importCustomersUsingCsvAsyncWithHttpInfo($file, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importCustomersUsingCsvAsyncWithHttpInfo + * + * Import and Update Customers using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importCustomersUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importCustomersUsingCsvAsyncWithHttpInfo($file = null, string $contentType = self::contentTypes['importCustomersUsingCsv'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersImportCsvCreateResponseBody'; + $request = $this->importCustomersUsingCsvRequest($file, $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 'importCustomersUsingCsv' + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importCustomersUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importCustomersUsingCsvRequest($file = null, string $contentType = self::contentTypes['importCustomersUsingCsv'][0]) + { + + + + $resourcePath = '/v1/customers/importCSV'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // form params + if ($file !== null) { + $multipart = true; + $formParams['file'] = []; + $paramFiles = is_array($file) ? $file : [$file]; + foreach ($paramFiles as $paramFile) { + $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 listCustomerActivity + * + * List Customer Activity + * + * @param string $customerId A Voucherify customers id or source ID of the customer who performed the activities. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $campaignId Requests only events related to specific campaign identified by its ID. (optional) + * @param ParameterCampaignType $campaignType Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. (optional) + * @param ParameterActivityCategory $category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. (optional) + * @param string $type Event name of the customer event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivity'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersActivityListResponseBody + */ + public function listCustomerActivity($customerId, $limit = null, $order = null, $startingAfterId = null, $startDate = null, $endDate = null, $campaignId = null, $campaignType = null, $category = null, $type = null, string $contentType = self::contentTypes['listCustomerActivity'][0]) + { + list($response) = $this->listCustomerActivityWithHttpInfo($customerId, $limit, $order, $startingAfterId, $startDate, $endDate, $campaignId, $campaignType, $category, $type, $contentType); + return $response; + } + + /** + * Operation listCustomerActivityWithHttpInfo + * + * List Customer Activity + * + * @param string $customerId A Voucherify customers id or source ID of the customer who performed the activities. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $campaignId Requests only events related to specific campaign identified by its ID. (optional) + * @param ParameterCampaignType $campaignType Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. (optional) + * @param ParameterActivityCategory $category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. (optional) + * @param string $type Event name of the customer event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivity'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersActivityListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listCustomerActivityWithHttpInfo($customerId, $limit = null, $order = null, $startingAfterId = null, $startDate = null, $endDate = null, $campaignId = null, $campaignType = null, $category = null, $type = null, string $contentType = self::contentTypes['listCustomerActivity'][0]) + { + $request = $this->listCustomerActivityRequest($customerId, $limit, $order, $startingAfterId, $startDate, $endDate, $campaignId, $campaignType, $category, $type, $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\CustomersActivityListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersActivityListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersActivityListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersActivityListResponseBody'; + 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\CustomersActivityListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listCustomerActivityAsync + * + * List Customer Activity + * + * @param string $customerId A Voucherify customers id or source ID of the customer who performed the activities. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $campaignId Requests only events related to specific campaign identified by its ID. (optional) + * @param ParameterCampaignType $campaignType Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. (optional) + * @param ParameterActivityCategory $category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. (optional) + * @param string $type Event name of the customer event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivity'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCustomerActivityAsync($customerId, $limit = null, $order = null, $startingAfterId = null, $startDate = null, $endDate = null, $campaignId = null, $campaignType = null, $category = null, $type = null, string $contentType = self::contentTypes['listCustomerActivity'][0]) + { + return $this->listCustomerActivityAsyncWithHttpInfo($customerId, $limit, $order, $startingAfterId, $startDate, $endDate, $campaignId, $campaignType, $category, $type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCustomerActivityAsyncWithHttpInfo + * + * List Customer Activity + * + * @param string $customerId A Voucherify customers id or source ID of the customer who performed the activities. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $campaignId Requests only events related to specific campaign identified by its ID. (optional) + * @param ParameterCampaignType $campaignType Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. (optional) + * @param ParameterActivityCategory $category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. (optional) + * @param string $type Event name of the customer event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivity'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCustomerActivityAsyncWithHttpInfo($customerId, $limit = null, $order = null, $startingAfterId = null, $startDate = null, $endDate = null, $campaignId = null, $campaignType = null, $category = null, $type = null, string $contentType = self::contentTypes['listCustomerActivity'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersActivityListResponseBody'; + $request = $this->listCustomerActivityRequest($customerId, $limit, $order, $startingAfterId, $startDate, $endDate, $campaignId, $campaignType, $category, $type, $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 'listCustomerActivity' + * + * @param string $customerId A Voucherify customers id or source ID of the customer who performed the activities. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $campaignId Requests only events related to specific campaign identified by its ID. (optional) + * @param ParameterCampaignType $campaignType Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. (optional) + * @param ParameterActivityCategory $category Filters activities for actions or effects. Allowed values: ACTION, EFFECT. (optional) + * @param string $type Event name of the customer event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivity'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCustomerActivityRequest($customerId, $limit = null, $order = null, $startingAfterId = null, $startDate = null, $endDate = null, $campaignId = null, $campaignType = null, $category = null, $type = null, string $contentType = self::contentTypes['listCustomerActivity'][0]) + { + + // verify the required parameter 'customerId' is set + if ($customerId === null || (is_array($customerId) && count($customerId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customerId when calling listCustomerActivity' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling CustomersApi.listCustomerActivity, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling CustomersApi.listCustomerActivity, must be bigger than or equal to 1.'); + } + + + + + + + + + + + $resourcePath = '/v1/customers/{customerId}/activity'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderCreatedAt', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startingAfterId, + 'starting_after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaignId, + 'campaign_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaignType, + 'campaign_type', // param base name + 'ParameterCampaignType', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $category, + 'category', // param base name + 'ParameterActivityCategory', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($customerId !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customerId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCustomerRedeemables + * + * List Customer's Redeemables + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListRedeemables $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param ParameterFiltersListCustomerRedeemables $filters Filters for listing customer redeemables. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerRedeemables'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersRedeemablesListResponseBody + */ + public function listCustomerRedeemables($customerId, $limit = null, $order = null, $startingAfterId = null, $filters = null, string $contentType = self::contentTypes['listCustomerRedeemables'][0]) + { + list($response) = $this->listCustomerRedeemablesWithHttpInfo($customerId, $limit, $order, $startingAfterId, $filters, $contentType); + return $response; + } + + /** + * Operation listCustomerRedeemablesWithHttpInfo + * + * List Customer's Redeemables + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListRedeemables $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param ParameterFiltersListCustomerRedeemables $filters Filters for listing customer redeemables. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerRedeemables'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersRedeemablesListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listCustomerRedeemablesWithHttpInfo($customerId, $limit = null, $order = null, $startingAfterId = null, $filters = null, string $contentType = self::contentTypes['listCustomerRedeemables'][0]) + { + $request = $this->listCustomerRedeemablesRequest($customerId, $limit, $order, $startingAfterId, $filters, $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\CustomersRedeemablesListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersRedeemablesListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersRedeemablesListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersRedeemablesListResponseBody'; + 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\CustomersRedeemablesListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listCustomerRedeemablesAsync + * + * List Customer's Redeemables + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListRedeemables $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param ParameterFiltersListCustomerRedeemables $filters Filters for listing customer redeemables. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerRedeemables'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCustomerRedeemablesAsync($customerId, $limit = null, $order = null, $startingAfterId = null, $filters = null, string $contentType = self::contentTypes['listCustomerRedeemables'][0]) + { + return $this->listCustomerRedeemablesAsyncWithHttpInfo($customerId, $limit, $order, $startingAfterId, $filters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCustomerRedeemablesAsyncWithHttpInfo + * + * List Customer's Redeemables + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListRedeemables $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param ParameterFiltersListCustomerRedeemables $filters Filters for listing customer redeemables. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerRedeemables'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCustomerRedeemablesAsyncWithHttpInfo($customerId, $limit = null, $order = null, $startingAfterId = null, $filters = null, string $contentType = self::contentTypes['listCustomerRedeemables'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersRedeemablesListResponseBody'; + $request = $this->listCustomerRedeemablesRequest($customerId, $limit, $order, $startingAfterId, $filters, $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 'listCustomerRedeemables' + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListRedeemables $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param ParameterFiltersListCustomerRedeemables $filters Filters for listing customer redeemables. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerRedeemables'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCustomerRedeemablesRequest($customerId, $limit = null, $order = null, $startingAfterId = null, $filters = null, string $contentType = self::contentTypes['listCustomerRedeemables'][0]) + { + + // verify the required parameter 'customerId' is set + if ($customerId === null || (is_array($customerId) && count($customerId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customerId when calling listCustomerRedeemables' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling CustomersApi.listCustomerRedeemables, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling CustomersApi.listCustomerRedeemables, must be bigger than or equal to 1.'); + } + + + + + + $resourcePath = '/v1/customers/{customerId}/redeemables'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListRedeemables', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startingAfterId, + 'starting_after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filters, + 'filters', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($customerId !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customerId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCustomerSegments + * + * List Customer's Segments + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerSegments'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersSegmentsListResponseBody + */ + public function listCustomerSegments($customerId, string $contentType = self::contentTypes['listCustomerSegments'][0]) + { + list($response) = $this->listCustomerSegmentsWithHttpInfo($customerId, $contentType); + return $response; + } + + /** + * Operation listCustomerSegmentsWithHttpInfo + * + * List Customer's Segments + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerSegments'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersSegmentsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listCustomerSegmentsWithHttpInfo($customerId, string $contentType = self::contentTypes['listCustomerSegments'][0]) + { + $request = $this->listCustomerSegmentsRequest($customerId, $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\CustomersSegmentsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersSegmentsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersSegmentsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersSegmentsListResponseBody'; + 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\CustomersSegmentsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listCustomerSegmentsAsync + * + * List Customer's Segments + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerSegments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCustomerSegmentsAsync($customerId, string $contentType = self::contentTypes['listCustomerSegments'][0]) + { + return $this->listCustomerSegmentsAsyncWithHttpInfo($customerId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCustomerSegmentsAsyncWithHttpInfo + * + * List Customer's Segments + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerSegments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCustomerSegmentsAsyncWithHttpInfo($customerId, string $contentType = self::contentTypes['listCustomerSegments'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersSegmentsListResponseBody'; + $request = $this->listCustomerSegmentsRequest($customerId, $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 'listCustomerSegments' + * + * @param string $customerId Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerSegments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCustomerSegmentsRequest($customerId, string $contentType = self::contentTypes['listCustomerSegments'][0]) + { + + // verify the required parameter 'customerId' is set + if ($customerId === null || (is_array($customerId) && count($customerId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customerId when calling listCustomerSegments' + ); + } + + + $resourcePath = '/v1/customers/{customerId}/segments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($customerId !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customerId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listCustomers + * + * List Customers + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $email Limit the customers to the ones that have this specific email address. (optional) + * @param string $city Limit the customers to the ones that are located in the specified city. (optional) + * @param string $name Filter customers by the name property. (optional) + * @param string $segmentId Filter customers by the segment id. (optional) + * @param \DateTime $createdAtBefore Filter customers by date customer was created. (optional) + * @param \DateTime $createdAtAfter Filter customers by date customer was created. (optional) + * @param \DateTime $updatedAtBefore Filter customers by date customer was updated last time. (optional) + * @param \DateTime $updatedAtAfter Filter customers by date customer was updated last time. (optional) + * @param ParameterOrderListCustomers $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersListResponseBody + */ + public function listCustomers($limit = null, $page = null, $email = null, $city = null, $name = null, $segmentId = null, $createdAtBefore = null, $createdAtAfter = null, $updatedAtBefore = null, $updatedAtAfter = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listCustomers'][0]) + { + list($response) = $this->listCustomersWithHttpInfo($limit, $page, $email, $city, $name, $segmentId, $createdAtBefore, $createdAtAfter, $updatedAtBefore, $updatedAtAfter, $order, $startingAfter, $contentType); + return $response; + } + + /** + * Operation listCustomersWithHttpInfo + * + * List Customers + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $email Limit the customers to the ones that have this specific email address. (optional) + * @param string $city Limit the customers to the ones that are located in the specified city. (optional) + * @param string $name Filter customers by the name property. (optional) + * @param string $segmentId Filter customers by the segment id. (optional) + * @param \DateTime $createdAtBefore Filter customers by date customer was created. (optional) + * @param \DateTime $createdAtAfter Filter customers by date customer was created. (optional) + * @param \DateTime $updatedAtBefore Filter customers by date customer was updated last time. (optional) + * @param \DateTime $updatedAtAfter Filter customers by date customer was updated last time. (optional) + * @param ParameterOrderListCustomers $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listCustomersWithHttpInfo($limit = null, $page = null, $email = null, $city = null, $name = null, $segmentId = null, $createdAtBefore = null, $createdAtAfter = null, $updatedAtBefore = null, $updatedAtAfter = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listCustomers'][0]) + { + $request = $this->listCustomersRequest($limit, $page, $email, $city, $name, $segmentId, $createdAtBefore, $createdAtAfter, $updatedAtBefore, $updatedAtAfter, $order, $startingAfter, $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\CustomersListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersListResponseBody'; + 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\CustomersListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listCustomersAsync + * + * List Customers + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $email Limit the customers to the ones that have this specific email address. (optional) + * @param string $city Limit the customers to the ones that are located in the specified city. (optional) + * @param string $name Filter customers by the name property. (optional) + * @param string $segmentId Filter customers by the segment id. (optional) + * @param \DateTime $createdAtBefore Filter customers by date customer was created. (optional) + * @param \DateTime $createdAtAfter Filter customers by date customer was created. (optional) + * @param \DateTime $updatedAtBefore Filter customers by date customer was updated last time. (optional) + * @param \DateTime $updatedAtAfter Filter customers by date customer was updated last time. (optional) + * @param ParameterOrderListCustomers $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCustomersAsync($limit = null, $page = null, $email = null, $city = null, $name = null, $segmentId = null, $createdAtBefore = null, $createdAtAfter = null, $updatedAtBefore = null, $updatedAtAfter = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listCustomers'][0]) + { + return $this->listCustomersAsyncWithHttpInfo($limit, $page, $email, $city, $name, $segmentId, $createdAtBefore, $createdAtAfter, $updatedAtBefore, $updatedAtAfter, $order, $startingAfter, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCustomersAsyncWithHttpInfo + * + * List Customers + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $email Limit the customers to the ones that have this specific email address. (optional) + * @param string $city Limit the customers to the ones that are located in the specified city. (optional) + * @param string $name Filter customers by the name property. (optional) + * @param string $segmentId Filter customers by the segment id. (optional) + * @param \DateTime $createdAtBefore Filter customers by date customer was created. (optional) + * @param \DateTime $createdAtAfter Filter customers by date customer was created. (optional) + * @param \DateTime $updatedAtBefore Filter customers by date customer was updated last time. (optional) + * @param \DateTime $updatedAtAfter Filter customers by date customer was updated last time. (optional) + * @param ParameterOrderListCustomers $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listCustomersAsyncWithHttpInfo($limit = null, $page = null, $email = null, $city = null, $name = null, $segmentId = null, $createdAtBefore = null, $createdAtAfter = null, $updatedAtBefore = null, $updatedAtAfter = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listCustomers'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersListResponseBody'; + $request = $this->listCustomersRequest($limit, $page, $email, $city, $name, $segmentId, $createdAtBefore, $createdAtAfter, $updatedAtBefore, $updatedAtAfter, $order, $startingAfter, $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 'listCustomers' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $email Limit the customers to the ones that have this specific email address. (optional) + * @param string $city Limit the customers to the ones that are located in the specified city. (optional) + * @param string $name Filter customers by the name property. (optional) + * @param string $segmentId Filter customers by the segment id. (optional) + * @param \DateTime $createdAtBefore Filter customers by date customer was created. (optional) + * @param \DateTime $createdAtAfter Filter customers by date customer was created. (optional) + * @param \DateTime $updatedAtBefore Filter customers by date customer was updated last time. (optional) + * @param \DateTime $updatedAtAfter Filter customers by date customer was updated last time. (optional) + * @param ParameterOrderListCustomers $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCustomersRequest($limit = null, $page = null, $email = null, $city = null, $name = null, $segmentId = null, $createdAtBefore = null, $createdAtAfter = null, $updatedAtBefore = null, $updatedAtAfter = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listCustomers'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling CustomersApi.listCustomers, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling CustomersApi.listCustomers, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling CustomersApi.listCustomers, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling CustomersApi.listCustomers, must be bigger than or equal to 1.'); + } + + + + + + + + + + + + + $resourcePath = '/v1/customers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email, + 'email', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $city, + 'city', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $segmentId, + 'segment_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdAtBefore, + 'created_at[before]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdAtAfter, + 'created_at[after]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updatedAtBefore, + 'updated_at[before]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updatedAtAfter, + 'updated_at[after]', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListCustomers', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startingAfter, + 'starting_after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateCustomer + * + * Update Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param \OpenAPI\Client\Model\CustomersUpdateRequestBody $customersUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomer'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersUpdateResponseBody + */ + public function updateCustomer($customerId, $customersUpdateRequestBody = null, string $contentType = self::contentTypes['updateCustomer'][0]) + { + list($response) = $this->updateCustomerWithHttpInfo($customerId, $customersUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateCustomerWithHttpInfo + * + * Update Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param \OpenAPI\Client\Model\CustomersUpdateRequestBody $customersUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomer'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateCustomerWithHttpInfo($customerId, $customersUpdateRequestBody = null, string $contentType = self::contentTypes['updateCustomer'][0]) + { + $request = $this->updateCustomerRequest($customerId, $customersUpdateRequestBody, $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\CustomersUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersUpdateResponseBody'; + 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\CustomersUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateCustomerAsync + * + * Update Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param \OpenAPI\Client\Model\CustomersUpdateRequestBody $customersUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCustomerAsync($customerId, $customersUpdateRequestBody = null, string $contentType = self::contentTypes['updateCustomer'][0]) + { + return $this->updateCustomerAsyncWithHttpInfo($customerId, $customersUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCustomerAsyncWithHttpInfo + * + * Update Customer + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param \OpenAPI\Client\Model\CustomersUpdateRequestBody $customersUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCustomerAsyncWithHttpInfo($customerId, $customersUpdateRequestBody = null, string $contentType = self::contentTypes['updateCustomer'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersUpdateResponseBody'; + $request = $this->updateCustomerRequest($customerId, $customersUpdateRequestBody, $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 'updateCustomer' + * + * @param string $customerId A Voucherify customers id or source_id. (required) + * @param \OpenAPI\Client\Model\CustomersUpdateRequestBody $customersUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomer'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateCustomerRequest($customerId, $customersUpdateRequestBody = null, string $contentType = self::contentTypes['updateCustomer'][0]) + { + + // verify the required parameter 'customerId' is set + if ($customerId === null || (is_array($customerId) && count($customerId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customerId when calling updateCustomer' + ); + } + + + + $resourcePath = '/v1/customers/{customerId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($customerId !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customerId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($customersUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($customersUpdateRequestBody)); + } else { + $httpBody = $customersUpdateRequestBody; + } + } 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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateCustomersConsents + * + * Update Customer's consents [Deprecated] + * + * @param string $customerId A Voucherify unique 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 Opt-out from all communication: (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsents'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + * @deprecated + */ + public function updateCustomersConsents($customerId, $body = null, string $contentType = self::contentTypes['updateCustomersConsents'][0]) + { + $this->updateCustomersConsentsWithHttpInfo($customerId, $body, $contentType); + } + + /** + * Operation updateCustomersConsentsWithHttpInfo + * + * Update Customer's consents [Deprecated] + * + * @param string $customerId A Voucherify unique 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 Opt-out from all communication: (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsents'] 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) + * @deprecated + */ + public function updateCustomersConsentsWithHttpInfo($customerId, $body = null, string $contentType = self::contentTypes['updateCustomersConsents'][0]) + { + $request = $this->updateCustomersConsentsRequest($customerId, $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 updateCustomersConsentsAsync + * + * Update Customer's consents [Deprecated] + * + * @param string $customerId A Voucherify unique 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 Opt-out from all communication: (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated + */ + public function updateCustomersConsentsAsync($customerId, $body = null, string $contentType = self::contentTypes['updateCustomersConsents'][0]) + { + return $this->updateCustomersConsentsAsyncWithHttpInfo($customerId, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCustomersConsentsAsyncWithHttpInfo + * + * Update Customer's consents [Deprecated] + * + * @param string $customerId A Voucherify unique 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 Opt-out from all communication: (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated + */ + public function updateCustomersConsentsAsyncWithHttpInfo($customerId, $body = null, string $contentType = self::contentTypes['updateCustomersConsents'][0]) + { + $returnType = ''; + $request = $this->updateCustomersConsentsRequest($customerId, $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 'updateCustomersConsents' + * + * @param string $customerId A Voucherify unique 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 Opt-out from all communication: (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsents'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + * @deprecated + */ + public function updateCustomersConsentsRequest($customerId, $body = null, string $contentType = self::contentTypes['updateCustomersConsents'][0]) + { + + // verify the required parameter 'customerId' is set + if ($customerId === null || (is_array($customerId) && count($customerId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customerId when calling updateCustomersConsents' + ); + } + + + + $resourcePath = '/v1/customers/{customerId}/consents'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($customerId !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customerId), + $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-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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateCustomersInBulk + * + * Update Customers in Bulk + * + * @param \OpenAPI\Client\Model\CustomersUpdateInBulkRequestBody[] $customersUpdateInBulkRequestBody List the customer fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody + */ + public function updateCustomersInBulk($customersUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersInBulk'][0]) + { + list($response) = $this->updateCustomersInBulkWithHttpInfo($customersUpdateInBulkRequestBody, $contentType); + return $response; + } + + /** + * Operation updateCustomersInBulkWithHttpInfo + * + * Update Customers in Bulk + * + * @param \OpenAPI\Client\Model\CustomersUpdateInBulkRequestBody[] $customersUpdateInBulkRequestBody List the customer fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateCustomersInBulkWithHttpInfo($customersUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersInBulk'][0]) + { + $request = $this->updateCustomersInBulkRequest($customersUpdateInBulkRequestBody, $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 202: + if ('\OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateCustomersInBulkAsync + * + * Update Customers in Bulk + * + * @param \OpenAPI\Client\Model\CustomersUpdateInBulkRequestBody[] $customersUpdateInBulkRequestBody List the customer fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCustomersInBulkAsync($customersUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersInBulk'][0]) + { + return $this->updateCustomersInBulkAsyncWithHttpInfo($customersUpdateInBulkRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCustomersInBulkAsyncWithHttpInfo + * + * Update Customers in Bulk + * + * @param \OpenAPI\Client\Model\CustomersUpdateInBulkRequestBody[] $customersUpdateInBulkRequestBody List the customer fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCustomersInBulkAsyncWithHttpInfo($customersUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersInBulk'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersUpdateInBulkResponseBody'; + $request = $this->updateCustomersInBulkRequest($customersUpdateInBulkRequestBody, $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 'updateCustomersInBulk' + * + * @param \OpenAPI\Client\Model\CustomersUpdateInBulkRequestBody[] $customersUpdateInBulkRequestBody List the customer fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateCustomersInBulkRequest($customersUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersInBulk'][0]) + { + + + + $resourcePath = '/v1/customers/bulk/async'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($customersUpdateInBulkRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($customersUpdateInBulkRequestBody)); + } else { + $httpBody = $customersUpdateInBulkRequestBody; + } + } 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 updateCustomersMetadataInBulk + * + * Update Customers' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkRequestBody $customersMetadataUpdateInBulkRequestBody List the source_ids of the customers you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersMetadataInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody + */ + public function updateCustomersMetadataInBulk($customersMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersMetadataInBulk'][0]) + { + list($response) = $this->updateCustomersMetadataInBulkWithHttpInfo($customersMetadataUpdateInBulkRequestBody, $contentType); + return $response; + } + + /** + * Operation updateCustomersMetadataInBulkWithHttpInfo + * + * Update Customers' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkRequestBody $customersMetadataUpdateInBulkRequestBody List the source_ids of the customers you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersMetadataInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateCustomersMetadataInBulkWithHttpInfo($customersMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersMetadataInBulk'][0]) + { + $request = $this->updateCustomersMetadataInBulkRequest($customersMetadataUpdateInBulkRequestBody, $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 202: + if ('\OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateCustomersMetadataInBulkAsync + * + * Update Customers' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkRequestBody $customersMetadataUpdateInBulkRequestBody List the source_ids of the customers you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCustomersMetadataInBulkAsync($customersMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersMetadataInBulk'][0]) + { + return $this->updateCustomersMetadataInBulkAsyncWithHttpInfo($customersMetadataUpdateInBulkRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCustomersMetadataInBulkAsyncWithHttpInfo + * + * Update Customers' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkRequestBody $customersMetadataUpdateInBulkRequestBody List the source_ids of the customers you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateCustomersMetadataInBulkAsyncWithHttpInfo($customersMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersMetadataInBulk'][0]) + { + $returnType = '\OpenAPI\Client\Model\CustomersMetadataUpdateInBulkResponseBody'; + $request = $this->updateCustomersMetadataInBulkRequest($customersMetadataUpdateInBulkRequestBody, $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 'updateCustomersMetadataInBulk' + * + * @param \OpenAPI\Client\Model\CustomersMetadataUpdateInBulkRequestBody $customersMetadataUpdateInBulkRequestBody List the source_ids of the customers you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateCustomersMetadataInBulkRequest($customersMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateCustomersMetadataInBulk'][0]) + { + + + + $resourcePath = '/v1/customers/metadata/async'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($customersMetadataUpdateInBulkRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($customersMetadataUpdateInBulkRequestBody)); + } else { + $httpBody = $customersMetadataUpdateInBulkRequestBody; + } + } 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/Api/EventsApi.php b/src/Api/EventsApi.php new file mode 100644 index 0000000..cae5bc7 --- /dev/null +++ b/src/Api/EventsApi.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 trackCustomEvent + * + * Track Custom Event + * + * @param \OpenAPI\Client\Model\EventsCreateRequestBody $eventsCreateRequestBody Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEvent'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\EventsCreateResponseBody + */ + public function trackCustomEvent($eventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEvent'][0]) + { + list($response) = $this->trackCustomEventWithHttpInfo($eventsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation trackCustomEventWithHttpInfo + * + * Track Custom Event + * + * @param \OpenAPI\Client\Model\EventsCreateRequestBody $eventsCreateRequestBody Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEvent'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\EventsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function trackCustomEventWithHttpInfo($eventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEvent'][0]) + { + $request = $this->trackCustomEventRequest($eventsCreateRequestBody, $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\EventsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\EventsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\EventsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\EventsCreateResponseBody'; + 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\EventsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation trackCustomEventAsync + * + * Track Custom Event + * + * @param \OpenAPI\Client\Model\EventsCreateRequestBody $eventsCreateRequestBody Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function trackCustomEventAsync($eventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEvent'][0]) + { + return $this->trackCustomEventAsyncWithHttpInfo($eventsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation trackCustomEventAsyncWithHttpInfo + * + * Track Custom Event + * + * @param \OpenAPI\Client\Model\EventsCreateRequestBody $eventsCreateRequestBody Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function trackCustomEventAsyncWithHttpInfo($eventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEvent'][0]) + { + $returnType = '\OpenAPI\Client\Model\EventsCreateResponseBody'; + $request = $this->trackCustomEventRequest($eventsCreateRequestBody, $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 'trackCustomEvent' + * + * @param \OpenAPI\Client\Model\EventsCreateRequestBody $eventsCreateRequestBody Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEvent'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function trackCustomEventRequest($eventsCreateRequestBody = null, string $contentType = self::contentTypes['trackCustomEvent'][0]) + { + + + + $resourcePath = '/v1/events'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($eventsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($eventsCreateRequestBody)); + } else { + $httpBody = $eventsCreateRequestBody; + } + } 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/Api/ExportsApi.php b/src/Api/ExportsApi.php new file mode 100644 index 0000000..eb01ee8 --- /dev/null +++ b/src/Api/ExportsApi.php @@ -0,0 +1,1602 @@ + [ + 'application/json', + ], + 'deleteExport' => [ + 'application/json', + ], + 'downloadExport' => [ + 'application/json', + ], + 'getExport' => [ + 'application/json', + ], + 'listExports' => [ + '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 createExport + * + * Create Export + * + * @param \OpenAPI\Client\Model\ExportsCreateRequestBody $exportsCreateRequestBody Specify the details of the export that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ExportsCreateResponseBody + */ + public function createExport($exportsCreateRequestBody = null, string $contentType = self::contentTypes['createExport'][0]) + { + list($response) = $this->createExportWithHttpInfo($exportsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createExportWithHttpInfo + * + * Create Export + * + * @param \OpenAPI\Client\Model\ExportsCreateRequestBody $exportsCreateRequestBody Specify the details of the export that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ExportsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createExportWithHttpInfo($exportsCreateRequestBody = null, string $contentType = self::contentTypes['createExport'][0]) + { + $request = $this->createExportRequest($exportsCreateRequestBody, $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\ExportsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExportsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExportsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExportsCreateResponseBody'; + 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\ExportsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createExportAsync + * + * Create Export + * + * @param \OpenAPI\Client\Model\ExportsCreateRequestBody $exportsCreateRequestBody Specify the details of the export that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createExportAsync($exportsCreateRequestBody = null, string $contentType = self::contentTypes['createExport'][0]) + { + return $this->createExportAsyncWithHttpInfo($exportsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createExportAsyncWithHttpInfo + * + * Create Export + * + * @param \OpenAPI\Client\Model\ExportsCreateRequestBody $exportsCreateRequestBody Specify the details of the export that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createExportAsyncWithHttpInfo($exportsCreateRequestBody = null, string $contentType = self::contentTypes['createExport'][0]) + { + $returnType = '\OpenAPI\Client\Model\ExportsCreateResponseBody'; + $request = $this->createExportRequest($exportsCreateRequestBody, $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 'createExport' + * + * @param \OpenAPI\Client\Model\ExportsCreateRequestBody $exportsCreateRequestBody Specify the details of the export that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createExportRequest($exportsCreateRequestBody = null, string $contentType = self::contentTypes['createExport'][0]) + { + + + + $resourcePath = '/v1/exports'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($exportsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($exportsCreateRequestBody)); + } else { + $httpBody = $exportsCreateRequestBody; + } + } 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 deleteExport + * + * Delete Export + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteExport($exportId, string $contentType = self::contentTypes['deleteExport'][0]) + { + $this->deleteExportWithHttpInfo($exportId, $contentType); + } + + /** + * Operation deleteExportWithHttpInfo + * + * Delete Export + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExport'] 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 deleteExportWithHttpInfo($exportId, string $contentType = self::contentTypes['deleteExport'][0]) + { + $request = $this->deleteExportRequest($exportId, $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 deleteExportAsync + * + * Delete Export + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteExportAsync($exportId, string $contentType = self::contentTypes['deleteExport'][0]) + { + return $this->deleteExportAsyncWithHttpInfo($exportId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteExportAsyncWithHttpInfo + * + * Delete Export + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteExportAsyncWithHttpInfo($exportId, string $contentType = self::contentTypes['deleteExport'][0]) + { + $returnType = ''; + $request = $this->deleteExportRequest($exportId, $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 'deleteExport' + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteExportRequest($exportId, string $contentType = self::contentTypes['deleteExport'][0]) + { + + // verify the required parameter 'exportId' is set + if ($exportId === null || (is_array($exportId) && count($exportId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $exportId when calling deleteExport' + ); + } + + + $resourcePath = '/v1/exports/{exportId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($exportId !== null) { + $resourcePath = str_replace( + '{' . 'exportId' . '}', + ObjectSerializer::toPathValue($exportId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation downloadExport + * + * Download Export + * + * @param string $exportId Unique export object ID. (required) + * @param string $token Token that was issued to the export, to get this token, get the export first (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string + */ + public function downloadExport($exportId, $token = null, string $contentType = self::contentTypes['downloadExport'][0]) + { + list($response) = $this->downloadExportWithHttpInfo($exportId, $token, $contentType); + return $response; + } + + /** + * Operation downloadExportWithHttpInfo + * + * Download Export + * + * @param string $exportId Unique export object ID. (required) + * @param string $token Token that was issued to the export, to get this token, get the export first (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadExportWithHttpInfo($exportId, $token = null, string $contentType = self::contentTypes['downloadExport'][0]) + { + $request = $this->downloadExportRequest($exportId, $token, $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 ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + 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(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadExportAsync + * + * Download Export + * + * @param string $exportId Unique export object ID. (required) + * @param string $token Token that was issued to the export, to get this token, get the export first (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadExportAsync($exportId, $token = null, string $contentType = self::contentTypes['downloadExport'][0]) + { + return $this->downloadExportAsyncWithHttpInfo($exportId, $token, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadExportAsyncWithHttpInfo + * + * Download Export + * + * @param string $exportId Unique export object ID. (required) + * @param string $token Token that was issued to the export, to get this token, get the export first (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadExportAsyncWithHttpInfo($exportId, $token = null, string $contentType = self::contentTypes['downloadExport'][0]) + { + $returnType = 'string'; + $request = $this->downloadExportRequest($exportId, $token, $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 'downloadExport' + * + * @param string $exportId Unique export object ID. (required) + * @param string $token Token that was issued to the export, to get this token, get the export first (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadExportRequest($exportId, $token = null, string $contentType = self::contentTypes['downloadExport'][0]) + { + + // verify the required parameter 'exportId' is set + if ($exportId === null || (is_array($exportId) && count($exportId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $exportId when calling downloadExport' + ); + } + + + + $resourcePath = '/v1/exports/{export_Id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $token, + 'token', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($exportId !== null) { + $resourcePath = str_replace( + '{' . 'export_Id' . '}', + ObjectSerializer::toPathValue($exportId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['text/plain', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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); + } + } + + + $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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getExport + * + * Get Export + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ExportsGetResponseBody + */ + public function getExport($exportId, string $contentType = self::contentTypes['getExport'][0]) + { + list($response) = $this->getExportWithHttpInfo($exportId, $contentType); + return $response; + } + + /** + * Operation getExportWithHttpInfo + * + * Get Export + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ExportsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getExportWithHttpInfo($exportId, string $contentType = self::contentTypes['getExport'][0]) + { + $request = $this->getExportRequest($exportId, $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\ExportsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExportsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExportsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExportsGetResponseBody'; + 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\ExportsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getExportAsync + * + * Get Export + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExportAsync($exportId, string $contentType = self::contentTypes['getExport'][0]) + { + return $this->getExportAsyncWithHttpInfo($exportId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getExportAsyncWithHttpInfo + * + * Get Export + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getExportAsyncWithHttpInfo($exportId, string $contentType = self::contentTypes['getExport'][0]) + { + $returnType = '\OpenAPI\Client\Model\ExportsGetResponseBody'; + $request = $this->getExportRequest($exportId, $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 'getExport' + * + * @param string $exportId Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getExportRequest($exportId, string $contentType = self::contentTypes['getExport'][0]) + { + + // verify the required parameter 'exportId' is set + if ($exportId === null || (is_array($exportId) && count($exportId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $exportId when calling getExport' + ); + } + + + $resourcePath = '/v1/exports/{exportId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($exportId !== null) { + $resourcePath = str_replace( + '{' . 'exportId' . '}', + ObjectSerializer::toPathValue($exportId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listExports + * + * List Exports + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListExports $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listExports'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ExportsListResponseBody + */ + public function listExports($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listExports'][0]) + { + list($response) = $this->listExportsWithHttpInfo($limit, $page, $order, $contentType); + return $response; + } + + /** + * Operation listExportsWithHttpInfo + * + * List Exports + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListExports $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listExports'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ExportsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listExportsWithHttpInfo($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listExports'][0]) + { + $request = $this->listExportsRequest($limit, $page, $order, $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\ExportsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ExportsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ExportsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ExportsListResponseBody'; + 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\ExportsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listExportsAsync + * + * List Exports + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListExports $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listExports'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listExportsAsync($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listExports'][0]) + { + return $this->listExportsAsyncWithHttpInfo($limit, $page, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listExportsAsyncWithHttpInfo + * + * List Exports + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListExports $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listExports'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listExportsAsyncWithHttpInfo($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listExports'][0]) + { + $returnType = '\OpenAPI\Client\Model\ExportsListResponseBody'; + $request = $this->listExportsRequest($limit, $page, $order, $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 'listExports' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListExports $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listExports'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listExportsRequest($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listExports'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ExportsApi.listExports, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ExportsApi.listExports, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ExportsApi.listExports, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ExportsApi.listExports, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/exports'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListExports', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $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/Api/LoyaltiesApi.php b/src/Api/LoyaltiesApi.php new file mode 100644 index 0000000..2de8495 --- /dev/null +++ b/src/Api/LoyaltiesApi.php @@ -0,0 +1,14320 @@ + [ + 'application/json', + ], + 'createEarningRule' => [ + 'application/json', + ], + 'createInBulkLoyaltyTiers' => [ + 'application/json', + ], + 'createLoyaltyProgram' => [ + 'application/json', + ], + 'createPointsExpirationExport' => [ + 'application/json', + ], + 'createRewardAssignment1' => [ + 'application/json', + ], + 'deleteEarningRule' => [ + 'application/json', + ], + 'deleteLoyaltyProgram' => [ + 'application/json', + ], + 'deleteRewardAssignment1' => [ + 'application/json', + ], + 'disableEarningRule' => [ + 'application/json', + ], + 'enableEarningRule' => [ + 'application/json', + ], + 'exportLoyaltyCardTransactions' => [ + 'application/json', + ], + 'exportLoyaltyCardTransactions1' => [ + 'application/json', + ], + 'getEarningRule' => [ + 'application/json', + ], + 'getLoyaltyProgram' => [ + 'application/json', + ], + 'getLoyaltyTier' => [ + 'application/json', + ], + 'getMember' => [ + 'application/json', + ], + 'getMember1' => [ + 'application/json', + ], + 'getRewardAssignment1' => [ + 'application/json', + ], + 'getRewardAssignment2' => [ + 'application/json', + ], + 'getRewardDetails' => [ + 'application/json', + ], + 'listEarningRules' => [ + 'application/json', + ], + 'listLoyaltyCardTransactions' => [ + 'application/json', + ], + 'listLoyaltyCardTransactions1' => [ + 'application/json', + ], + 'listLoyaltyPrograms' => [ + 'application/json', + ], + 'listLoyaltyTierEarningRules' => [ + 'application/json', + ], + 'listLoyaltyTierRewards' => [ + 'application/json', + ], + 'listLoyaltyTiers' => [ + 'application/json', + ], + 'listMemberActivity' => [ + 'application/json', + ], + 'listMemberActivity1' => [ + 'application/json', + ], + 'listMemberLoyaltyTier' => [ + 'application/json', + ], + 'listMemberRewards' => [ + 'application/json', + ], + 'listMembers' => [ + 'application/json', + ], + 'listPointsExpiration' => [ + 'application/json', + ], + 'listRewardAssignments1' => [ + 'application/json', + ], + 'listRewardAssignments2' => [ + 'application/json', + ], + 'redeemReward' => [ + 'application/json', + ], + 'redeemReward1' => [ + 'application/json', + ], + 'transferPoints' => [ + 'application/json', + ], + 'updateEarningRule' => [ + 'application/json', + ], + 'updateLoyaltyCardBalance' => [ + 'application/json', + ], + 'updateLoyaltyCardBalance1' => [ + 'application/json', + ], + 'updateLoyaltyProgram' => [ + 'application/json', + ], + 'updateRewardAssignment1' => [ + '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 addMember + * + * Add Member + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersCreateRequestBody $loyaltiesMembersCreateRequestBody Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addMember'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBody + */ + public function addMember($campaignId, $loyaltiesMembersCreateRequestBody = null, string $contentType = self::contentTypes['addMember'][0]) + { + list($response) = $this->addMemberWithHttpInfo($campaignId, $loyaltiesMembersCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation addMemberWithHttpInfo + * + * Add Member + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersCreateRequestBody $loyaltiesMembersCreateRequestBody Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addMember'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function addMemberWithHttpInfo($campaignId, $loyaltiesMembersCreateRequestBody = null, string $contentType = self::contentTypes['addMember'][0]) + { + $request = $this->addMemberRequest($campaignId, $loyaltiesMembersCreateRequestBody, $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\LoyaltiesMembersCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBody'; + 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\LoyaltiesMembersCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addMemberAsync + * + * Add Member + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersCreateRequestBody $loyaltiesMembersCreateRequestBody Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addMember'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addMemberAsync($campaignId, $loyaltiesMembersCreateRequestBody = null, string $contentType = self::contentTypes['addMember'][0]) + { + return $this->addMemberAsyncWithHttpInfo($campaignId, $loyaltiesMembersCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addMemberAsyncWithHttpInfo + * + * Add Member + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersCreateRequestBody $loyaltiesMembersCreateRequestBody Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addMember'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addMemberAsyncWithHttpInfo($campaignId, $loyaltiesMembersCreateRequestBody = null, string $contentType = self::contentTypes['addMember'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBody'; + $request = $this->addMemberRequest($campaignId, $loyaltiesMembersCreateRequestBody, $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 'addMember' + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersCreateRequestBody $loyaltiesMembersCreateRequestBody Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addMember'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addMemberRequest($campaignId, $loyaltiesMembersCreateRequestBody = null, string $contentType = self::contentTypes['addMember'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling addMember' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/members'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesMembersCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesMembersCreateRequestBody)); + } else { + $httpBody = $loyaltiesMembersCreateRequestBody; + } + } 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 createEarningRule + * + * Create Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItem[] $loyaltiesEarningRulesCreateRequestBodyItem Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBody[] + */ + public function createEarningRule($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem = null, string $contentType = self::contentTypes['createEarningRule'][0]) + { + list($response) = $this->createEarningRuleWithHttpInfo($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem, $contentType); + return $response; + } + + /** + * Operation createEarningRuleWithHttpInfo + * + * Create Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItem[] $loyaltiesEarningRulesCreateRequestBodyItem Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBody[], HTTP status code, HTTP response headers (array of strings) + */ + public function createEarningRuleWithHttpInfo($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem = null, string $contentType = self::contentTypes['createEarningRule'][0]) + { + $request = $this->createEarningRuleRequest($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem, $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\LoyaltiesEarningRulesCreateResponseBody[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBody[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBody[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBody[]'; + 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\LoyaltiesEarningRulesCreateResponseBody[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createEarningRuleAsync + * + * Create Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItem[] $loyaltiesEarningRulesCreateRequestBodyItem Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEarningRuleAsync($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem = null, string $contentType = self::contentTypes['createEarningRule'][0]) + { + return $this->createEarningRuleAsyncWithHttpInfo($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEarningRuleAsyncWithHttpInfo + * + * Create Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItem[] $loyaltiesEarningRulesCreateRequestBodyItem Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEarningRuleAsyncWithHttpInfo($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem = null, string $contentType = self::contentTypes['createEarningRule'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBody[]'; + $request = $this->createEarningRuleRequest($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem, $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 'createEarningRule' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItem[] $loyaltiesEarningRulesCreateRequestBodyItem Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEarningRuleRequest($campaignId, $loyaltiesEarningRulesCreateRequestBodyItem = null, string $contentType = self::contentTypes['createEarningRule'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling createEarningRule' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/earning-rules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesEarningRulesCreateRequestBodyItem)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesEarningRulesCreateRequestBodyItem)); + } else { + $httpBody = $loyaltiesEarningRulesCreateRequestBodyItem; + } + } 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 createInBulkLoyaltyTiers + * + * Create loyalty tiers + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesTiersCreateInBulkRequestBodyItem[] $loyaltiesTiersCreateInBulkRequestBodyItem Provide tier definitions you want to add to existing loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInBulkLoyaltyTiers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltyTier[] + */ + public function createInBulkLoyaltyTiers($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem = null, string $contentType = self::contentTypes['createInBulkLoyaltyTiers'][0]) + { + list($response) = $this->createInBulkLoyaltyTiersWithHttpInfo($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem, $contentType); + return $response; + } + + /** + * Operation createInBulkLoyaltyTiersWithHttpInfo + * + * Create loyalty tiers + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesTiersCreateInBulkRequestBodyItem[] $loyaltiesTiersCreateInBulkRequestBodyItem Provide tier definitions you want to add to existing loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInBulkLoyaltyTiers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltyTier[], HTTP status code, HTTP response headers (array of strings) + */ + public function createInBulkLoyaltyTiersWithHttpInfo($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem = null, string $contentType = self::contentTypes['createInBulkLoyaltyTiers'][0]) + { + $request = $this->createInBulkLoyaltyTiersRequest($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem, $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\LoyaltyTier[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltyTier[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltyTier[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltyTier[]'; + 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\LoyaltyTier[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createInBulkLoyaltyTiersAsync + * + * Create loyalty tiers + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesTiersCreateInBulkRequestBodyItem[] $loyaltiesTiersCreateInBulkRequestBodyItem Provide tier definitions you want to add to existing loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInBulkLoyaltyTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInBulkLoyaltyTiersAsync($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem = null, string $contentType = self::contentTypes['createInBulkLoyaltyTiers'][0]) + { + return $this->createInBulkLoyaltyTiersAsyncWithHttpInfo($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createInBulkLoyaltyTiersAsyncWithHttpInfo + * + * Create loyalty tiers + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesTiersCreateInBulkRequestBodyItem[] $loyaltiesTiersCreateInBulkRequestBodyItem Provide tier definitions you want to add to existing loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInBulkLoyaltyTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createInBulkLoyaltyTiersAsyncWithHttpInfo($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem = null, string $contentType = self::contentTypes['createInBulkLoyaltyTiers'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltyTier[]'; + $request = $this->createInBulkLoyaltyTiersRequest($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem, $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 'createInBulkLoyaltyTiers' + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesTiersCreateInBulkRequestBodyItem[] $loyaltiesTiersCreateInBulkRequestBodyItem Provide tier definitions you want to add to existing loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInBulkLoyaltyTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createInBulkLoyaltyTiersRequest($campaignId, $loyaltiesTiersCreateInBulkRequestBodyItem = null, string $contentType = self::contentTypes['createInBulkLoyaltyTiers'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling createInBulkLoyaltyTiers' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesTiersCreateInBulkRequestBodyItem)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesTiersCreateInBulkRequestBodyItem)); + } else { + $httpBody = $loyaltiesTiersCreateInBulkRequestBodyItem; + } + } 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 createLoyaltyProgram + * + * Create Loyalty Campaign + * + * @param \OpenAPI\Client\Model\LoyaltiesCreateCampaignRequestBody $loyaltiesCreateCampaignRequestBody Specify the loyalty campaign details. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoyaltyProgram'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesCreateCampaignResponseBody + */ + public function createLoyaltyProgram($loyaltiesCreateCampaignRequestBody = null, string $contentType = self::contentTypes['createLoyaltyProgram'][0]) + { + list($response) = $this->createLoyaltyProgramWithHttpInfo($loyaltiesCreateCampaignRequestBody, $contentType); + return $response; + } + + /** + * Operation createLoyaltyProgramWithHttpInfo + * + * Create Loyalty Campaign + * + * @param \OpenAPI\Client\Model\LoyaltiesCreateCampaignRequestBody $loyaltiesCreateCampaignRequestBody Specify the loyalty campaign details. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoyaltyProgram'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesCreateCampaignResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createLoyaltyProgramWithHttpInfo($loyaltiesCreateCampaignRequestBody = null, string $contentType = self::contentTypes['createLoyaltyProgram'][0]) + { + $request = $this->createLoyaltyProgramRequest($loyaltiesCreateCampaignRequestBody, $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\LoyaltiesCreateCampaignResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesCreateCampaignResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesCreateCampaignResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesCreateCampaignResponseBody'; + 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\LoyaltiesCreateCampaignResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createLoyaltyProgramAsync + * + * Create Loyalty Campaign + * + * @param \OpenAPI\Client\Model\LoyaltiesCreateCampaignRequestBody $loyaltiesCreateCampaignRequestBody Specify the loyalty campaign details. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createLoyaltyProgramAsync($loyaltiesCreateCampaignRequestBody = null, string $contentType = self::contentTypes['createLoyaltyProgram'][0]) + { + return $this->createLoyaltyProgramAsyncWithHttpInfo($loyaltiesCreateCampaignRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createLoyaltyProgramAsyncWithHttpInfo + * + * Create Loyalty Campaign + * + * @param \OpenAPI\Client\Model\LoyaltiesCreateCampaignRequestBody $loyaltiesCreateCampaignRequestBody Specify the loyalty campaign details. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createLoyaltyProgramAsyncWithHttpInfo($loyaltiesCreateCampaignRequestBody = null, string $contentType = self::contentTypes['createLoyaltyProgram'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesCreateCampaignResponseBody'; + $request = $this->createLoyaltyProgramRequest($loyaltiesCreateCampaignRequestBody, $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 'createLoyaltyProgram' + * + * @param \OpenAPI\Client\Model\LoyaltiesCreateCampaignRequestBody $loyaltiesCreateCampaignRequestBody Specify the loyalty campaign details. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createLoyaltyProgramRequest($loyaltiesCreateCampaignRequestBody = null, string $contentType = self::contentTypes['createLoyaltyProgram'][0]) + { + + + + $resourcePath = '/v1/loyalties'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesCreateCampaignRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesCreateCampaignRequestBody)); + } else { + $httpBody = $loyaltiesCreateCampaignRequestBody; + } + } 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 createPointsExpirationExport + * + * Create Points Expiration Export + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBody $loyaltiesPointsExpirationExportCreateRequestBody Specify the data filters, types of data to return and order in which the results should be returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPointsExpirationExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBody + */ + public function createPointsExpirationExport($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody = null, string $contentType = self::contentTypes['createPointsExpirationExport'][0]) + { + list($response) = $this->createPointsExpirationExportWithHttpInfo($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createPointsExpirationExportWithHttpInfo + * + * Create Points Expiration Export + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBody $loyaltiesPointsExpirationExportCreateRequestBody Specify the data filters, types of data to return and order in which the results should be returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPointsExpirationExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createPointsExpirationExportWithHttpInfo($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody = null, string $contentType = self::contentTypes['createPointsExpirationExport'][0]) + { + $request = $this->createPointsExpirationExportRequest($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody, $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\LoyaltiesPointsExpirationExportCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBody'; + 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\LoyaltiesPointsExpirationExportCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPointsExpirationExportAsync + * + * Create Points Expiration Export + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBody $loyaltiesPointsExpirationExportCreateRequestBody Specify the data filters, types of data to return and order in which the results should be returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPointsExpirationExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPointsExpirationExportAsync($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody = null, string $contentType = self::contentTypes['createPointsExpirationExport'][0]) + { + return $this->createPointsExpirationExportAsyncWithHttpInfo($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPointsExpirationExportAsyncWithHttpInfo + * + * Create Points Expiration Export + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBody $loyaltiesPointsExpirationExportCreateRequestBody Specify the data filters, types of data to return and order in which the results should be returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPointsExpirationExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPointsExpirationExportAsyncWithHttpInfo($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody = null, string $contentType = self::contentTypes['createPointsExpirationExport'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBody'; + $request = $this->createPointsExpirationExportRequest($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody, $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 'createPointsExpirationExport' + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBody $loyaltiesPointsExpirationExportCreateRequestBody Specify the data filters, types of data to return and order in which the results should be returned. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPointsExpirationExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPointsExpirationExportRequest($campaignId, $loyaltiesPointsExpirationExportCreateRequestBody = null, string $contentType = self::contentTypes['createPointsExpirationExport'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling createPointsExpirationExport' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/points-expiration/export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesPointsExpirationExportCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesPointsExpirationExportCreateRequestBody)); + } else { + $httpBody = $loyaltiesPointsExpirationExportCreateRequestBody; + } + } 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 createRewardAssignment1 + * + * Create Reward Assignment + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBody[] $loyaltiesRewardsCreateAssignmentItemRequestBody Define the cost of the rewards in loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBody + */ + public function createRewardAssignment1($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment1'][0]) + { + list($response) = $this->createRewardAssignment1WithHttpInfo($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody, $contentType); + return $response; + } + + /** + * Operation createRewardAssignment1WithHttpInfo + * + * Create Reward Assignment + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBody[] $loyaltiesRewardsCreateAssignmentItemRequestBody Define the cost of the rewards in loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createRewardAssignment1WithHttpInfo($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment1'][0]) + { + $request = $this->createRewardAssignment1Request($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody, $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\LoyaltiesRewardsCreateAssignmentResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBody'; + 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\LoyaltiesRewardsCreateAssignmentResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createRewardAssignment1Async + * + * Create Reward Assignment + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBody[] $loyaltiesRewardsCreateAssignmentItemRequestBody Define the cost of the rewards in loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRewardAssignment1Async($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment1'][0]) + { + return $this->createRewardAssignment1AsyncWithHttpInfo($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createRewardAssignment1AsyncWithHttpInfo + * + * Create Reward Assignment + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBody[] $loyaltiesRewardsCreateAssignmentItemRequestBody Define the cost of the rewards in loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRewardAssignment1AsyncWithHttpInfo($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBody'; + $request = $this->createRewardAssignment1Request($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody, $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 'createRewardAssignment1' + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBody[] $loyaltiesRewardsCreateAssignmentItemRequestBody Define the cost of the rewards in loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRewardAssignment1Request($campaignId, $loyaltiesRewardsCreateAssignmentItemRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling createRewardAssignment1' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/rewards'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesRewardsCreateAssignmentItemRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesRewardsCreateAssignmentItemRequestBody)); + } else { + $httpBody = $loyaltiesRewardsCreateAssignmentItemRequestBody; + } + } 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 deleteEarningRule + * + * Delete Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteEarningRule($campaignId, $earningRuleId, string $contentType = self::contentTypes['deleteEarningRule'][0]) + { + $this->deleteEarningRuleWithHttpInfo($campaignId, $earningRuleId, $contentType); + } + + /** + * Operation deleteEarningRuleWithHttpInfo + * + * Delete Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEarningRule'] 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 deleteEarningRuleWithHttpInfo($campaignId, $earningRuleId, string $contentType = self::contentTypes['deleteEarningRule'][0]) + { + $request = $this->deleteEarningRuleRequest($campaignId, $earningRuleId, $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 deleteEarningRuleAsync + * + * Delete Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEarningRuleAsync($campaignId, $earningRuleId, string $contentType = self::contentTypes['deleteEarningRule'][0]) + { + return $this->deleteEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteEarningRuleAsyncWithHttpInfo + * + * Delete Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, string $contentType = self::contentTypes['deleteEarningRule'][0]) + { + $returnType = ''; + $request = $this->deleteEarningRuleRequest($campaignId, $earningRuleId, $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 'deleteEarningRule' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteEarningRuleRequest($campaignId, $earningRuleId, string $contentType = self::contentTypes['deleteEarningRule'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling deleteEarningRule' + ); + } + + // verify the required parameter 'earningRuleId' is set + if ($earningRuleId === null || (is_array($earningRuleId) && count($earningRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $earningRuleId when calling deleteEarningRule' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($earningRuleId !== null) { + $resourcePath = str_replace( + '{' . 'earningRuleId' . '}', + ObjectSerializer::toPathValue($earningRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteLoyaltyProgram + * + * Delete Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesDeleteResponseBody + */ + public function deleteLoyaltyProgram($campaignId, $force = null, string $contentType = self::contentTypes['deleteLoyaltyProgram'][0]) + { + list($response) = $this->deleteLoyaltyProgramWithHttpInfo($campaignId, $force, $contentType); + return $response; + } + + /** + * Operation deleteLoyaltyProgramWithHttpInfo + * + * Delete Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesDeleteResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteLoyaltyProgramWithHttpInfo($campaignId, $force = null, string $contentType = self::contentTypes['deleteLoyaltyProgram'][0]) + { + $request = $this->deleteLoyaltyProgramRequest($campaignId, $force, $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\LoyaltiesDeleteResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesDeleteResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesDeleteResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesDeleteResponseBody'; + 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\LoyaltiesDeleteResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteLoyaltyProgramAsync + * + * Delete Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteLoyaltyProgramAsync($campaignId, $force = null, string $contentType = self::contentTypes['deleteLoyaltyProgram'][0]) + { + return $this->deleteLoyaltyProgramAsyncWithHttpInfo($campaignId, $force, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteLoyaltyProgramAsyncWithHttpInfo + * + * Delete Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteLoyaltyProgramAsyncWithHttpInfo($campaignId, $force = null, string $contentType = self::contentTypes['deleteLoyaltyProgram'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesDeleteResponseBody'; + $request = $this->deleteLoyaltyProgramRequest($campaignId, $force, $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 'deleteLoyaltyProgram' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param bool $force If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteLoyaltyProgramRequest($campaignId, $force = null, string $contentType = self::contentTypes['deleteLoyaltyProgram'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling deleteLoyaltyProgram' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $force, + 'force', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteRewardAssignment1 + * + * Delete Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteRewardAssignment1($campaignId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment1'][0]) + { + $this->deleteRewardAssignment1WithHttpInfo($campaignId, $assignmentId, $contentType); + } + + /** + * Operation deleteRewardAssignment1WithHttpInfo + * + * Delete Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment1'] 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 deleteRewardAssignment1WithHttpInfo($campaignId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment1'][0]) + { + $request = $this->deleteRewardAssignment1Request($campaignId, $assignmentId, $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 deleteRewardAssignment1Async + * + * Delete Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteRewardAssignment1Async($campaignId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment1'][0]) + { + return $this->deleteRewardAssignment1AsyncWithHttpInfo($campaignId, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteRewardAssignment1AsyncWithHttpInfo + * + * Delete Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteRewardAssignment1AsyncWithHttpInfo($campaignId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment1'][0]) + { + $returnType = ''; + $request = $this->deleteRewardAssignment1Request($campaignId, $assignmentId, $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 'deleteRewardAssignment1' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteRewardAssignment1Request($campaignId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling deleteRewardAssignment1' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling deleteRewardAssignment1' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/rewards/{assignmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation disableEarningRule + * + * Disable Earning Rule + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBody + */ + public function disableEarningRule($campaignId, $earningRuleId, string $contentType = self::contentTypes['disableEarningRule'][0]) + { + list($response) = $this->disableEarningRuleWithHttpInfo($campaignId, $earningRuleId, $contentType); + return $response; + } + + /** + * Operation disableEarningRuleWithHttpInfo + * + * Disable Earning Rule + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function disableEarningRuleWithHttpInfo($campaignId, $earningRuleId, string $contentType = self::contentTypes['disableEarningRule'][0]) + { + $request = $this->disableEarningRuleRequest($campaignId, $earningRuleId, $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\LoyaltiesEarningRulesDisableResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBody'; + 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\LoyaltiesEarningRulesDisableResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation disableEarningRuleAsync + * + * Disable Earning Rule + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disableEarningRuleAsync($campaignId, $earningRuleId, string $contentType = self::contentTypes['disableEarningRule'][0]) + { + return $this->disableEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation disableEarningRuleAsyncWithHttpInfo + * + * Disable Earning Rule + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disableEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, string $contentType = self::contentTypes['disableEarningRule'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBody'; + $request = $this->disableEarningRuleRequest($campaignId, $earningRuleId, $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 'disableEarningRule' + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function disableEarningRuleRequest($campaignId, $earningRuleId, string $contentType = self::contentTypes['disableEarningRule'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling disableEarningRule' + ); + } + + // verify the required parameter 'earningRuleId' is set + if ($earningRuleId === null || (is_array($earningRuleId) && count($earningRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $earningRuleId when calling disableEarningRule' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($earningRuleId !== null) { + $resourcePath = str_replace( + '{' . 'earningRuleId' . '}', + ObjectSerializer::toPathValue($earningRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 enableEarningRule + * + * Enable Earning Rule + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBody + */ + public function enableEarningRule($campaignId, $earningRuleId, string $contentType = self::contentTypes['enableEarningRule'][0]) + { + list($response) = $this->enableEarningRuleWithHttpInfo($campaignId, $earningRuleId, $contentType); + return $response; + } + + /** + * Operation enableEarningRuleWithHttpInfo + * + * Enable Earning Rule + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function enableEarningRuleWithHttpInfo($campaignId, $earningRuleId, string $contentType = self::contentTypes['enableEarningRule'][0]) + { + $request = $this->enableEarningRuleRequest($campaignId, $earningRuleId, $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\LoyaltiesEarningRulesEnableResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBody'; + 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\LoyaltiesEarningRulesEnableResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation enableEarningRuleAsync + * + * Enable Earning Rule + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enableEarningRuleAsync($campaignId, $earningRuleId, string $contentType = self::contentTypes['enableEarningRule'][0]) + { + return $this->enableEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation enableEarningRuleAsyncWithHttpInfo + * + * Enable Earning Rule + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enableEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, string $contentType = self::contentTypes['enableEarningRule'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBody'; + $request = $this->enableEarningRuleRequest($campaignId, $earningRuleId, $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 'enableEarningRule' + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $earningRuleId Unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function enableEarningRuleRequest($campaignId, $earningRuleId, string $contentType = self::contentTypes['enableEarningRule'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling enableEarningRule' + ); + } + + // verify the required parameter 'earningRuleId' is set + if ($earningRuleId === null || (is_array($earningRuleId) && count($earningRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $earningRuleId when calling enableEarningRule' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($earningRuleId !== null) { + $resourcePath = str_replace( + '{' . 'earningRuleId' . '}', + ObjectSerializer::toPathValue($earningRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 exportLoyaltyCardTransactions + * + * Export Loyalty Card Transactions + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody + */ + public function exportLoyaltyCardTransactions($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions'][0]) + { + list($response) = $this->exportLoyaltyCardTransactionsWithHttpInfo($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation exportLoyaltyCardTransactionsWithHttpInfo + * + * Export Loyalty Card Transactions + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function exportLoyaltyCardTransactionsWithHttpInfo($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions'][0]) + { + $request = $this->exportLoyaltyCardTransactionsRequest($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody, $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\LoyaltiesMembersTransactionsExportCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody'; + 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\LoyaltiesMembersTransactionsExportCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation exportLoyaltyCardTransactionsAsync + * + * Export Loyalty Card Transactions + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function exportLoyaltyCardTransactionsAsync($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions'][0]) + { + return $this->exportLoyaltyCardTransactionsAsyncWithHttpInfo($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation exportLoyaltyCardTransactionsAsyncWithHttpInfo + * + * Export Loyalty Card Transactions + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function exportLoyaltyCardTransactionsAsyncWithHttpInfo($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody'; + $request = $this->exportLoyaltyCardTransactionsRequest($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody, $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 'exportLoyaltyCardTransactions' + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function exportLoyaltyCardTransactionsRequest($memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions'][0]) + { + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling exportLoyaltyCardTransactions' + ); + } + + + + $resourcePath = '/v1/loyalties/members/{memberId}/transactions/export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesMembersTransactionsExportCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesMembersTransactionsExportCreateRequestBody)); + } else { + $httpBody = $loyaltiesMembersTransactionsExportCreateRequestBody; + } + } 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 exportLoyaltyCardTransactions1 + * + * Export Loyalty Card Transactions + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody + */ + public function exportLoyaltyCardTransactions1($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions1'][0]) + { + list($response) = $this->exportLoyaltyCardTransactions1WithHttpInfo($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation exportLoyaltyCardTransactions1WithHttpInfo + * + * Export Loyalty Card Transactions + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function exportLoyaltyCardTransactions1WithHttpInfo($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions1'][0]) + { + $request = $this->exportLoyaltyCardTransactions1Request($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody, $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\LoyaltiesMembersTransactionsExportCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody'; + 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\LoyaltiesMembersTransactionsExportCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation exportLoyaltyCardTransactions1Async + * + * Export Loyalty Card Transactions + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function exportLoyaltyCardTransactions1Async($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions1'][0]) + { + return $this->exportLoyaltyCardTransactions1AsyncWithHttpInfo($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation exportLoyaltyCardTransactions1AsyncWithHttpInfo + * + * Export Loyalty Card Transactions + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function exportLoyaltyCardTransactions1AsyncWithHttpInfo($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBody'; + $request = $this->exportLoyaltyCardTransactions1Request($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody, $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 'exportLoyaltyCardTransactions1' + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBody $loyaltiesMembersTransactionsExportCreateRequestBody Specify the parameters and filters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function exportLoyaltyCardTransactions1Request($campaignId, $memberId, $loyaltiesMembersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportLoyaltyCardTransactions1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling exportLoyaltyCardTransactions1' + ); + } + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling exportLoyaltyCardTransactions1' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/members/{memberId}/transactions/export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesMembersTransactionsExportCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesMembersTransactionsExportCreateRequestBody)); + } else { + $httpBody = $loyaltiesMembersTransactionsExportCreateRequestBody; + } + } 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 getEarningRule + * + * Get Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBody + */ + public function getEarningRule($campaignId, $earningRuleId, string $contentType = self::contentTypes['getEarningRule'][0]) + { + list($response) = $this->getEarningRuleWithHttpInfo($campaignId, $earningRuleId, $contentType); + return $response; + } + + /** + * Operation getEarningRuleWithHttpInfo + * + * Get Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getEarningRuleWithHttpInfo($campaignId, $earningRuleId, string $contentType = self::contentTypes['getEarningRule'][0]) + { + $request = $this->getEarningRuleRequest($campaignId, $earningRuleId, $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\LoyaltiesEarningRulesGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBody'; + 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\LoyaltiesEarningRulesGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getEarningRuleAsync + * + * Get Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEarningRuleAsync($campaignId, $earningRuleId, string $contentType = self::contentTypes['getEarningRule'][0]) + { + return $this->getEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEarningRuleAsyncWithHttpInfo + * + * Get Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, string $contentType = self::contentTypes['getEarningRule'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBody'; + $request = $this->getEarningRuleRequest($campaignId, $earningRuleId, $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 'getEarningRule' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEarningRuleRequest($campaignId, $earningRuleId, string $contentType = self::contentTypes['getEarningRule'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getEarningRule' + ); + } + + // verify the required parameter 'earningRuleId' is set + if ($earningRuleId === null || (is_array($earningRuleId) && count($earningRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $earningRuleId when calling getEarningRule' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($earningRuleId !== null) { + $resourcePath = str_replace( + '{' . 'earningRuleId' . '}', + ObjectSerializer::toPathValue($earningRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLoyaltyProgram + * + * Get Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgram'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesGetCampaignResponseBody + */ + public function getLoyaltyProgram($campaignId, string $contentType = self::contentTypes['getLoyaltyProgram'][0]) + { + list($response) = $this->getLoyaltyProgramWithHttpInfo($campaignId, $contentType); + return $response; + } + + /** + * Operation getLoyaltyProgramWithHttpInfo + * + * Get Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgram'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesGetCampaignResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getLoyaltyProgramWithHttpInfo($campaignId, string $contentType = self::contentTypes['getLoyaltyProgram'][0]) + { + $request = $this->getLoyaltyProgramRequest($campaignId, $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\LoyaltiesGetCampaignResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesGetCampaignResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesGetCampaignResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesGetCampaignResponseBody'; + 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\LoyaltiesGetCampaignResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLoyaltyProgramAsync + * + * Get Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLoyaltyProgramAsync($campaignId, string $contentType = self::contentTypes['getLoyaltyProgram'][0]) + { + return $this->getLoyaltyProgramAsyncWithHttpInfo($campaignId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLoyaltyProgramAsyncWithHttpInfo + * + * Get Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLoyaltyProgramAsyncWithHttpInfo($campaignId, string $contentType = self::contentTypes['getLoyaltyProgram'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesGetCampaignResponseBody'; + $request = $this->getLoyaltyProgramRequest($campaignId, $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 'getLoyaltyProgram' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLoyaltyProgramRequest($campaignId, string $contentType = self::contentTypes['getLoyaltyProgram'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getLoyaltyProgram' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getLoyaltyTier + * + * Get Loyalty Tier + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBody + */ + public function getLoyaltyTier($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['getLoyaltyTier'][0]) + { + list($response) = $this->getLoyaltyTierWithHttpInfo($campaignId, $loyaltyTierId, $contentType); + return $response; + } + + /** + * Operation getLoyaltyTierWithHttpInfo + * + * Get Loyalty Tier + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getLoyaltyTierWithHttpInfo($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['getLoyaltyTier'][0]) + { + $request = $this->getLoyaltyTierRequest($campaignId, $loyaltyTierId, $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\LoyaltiesTiersGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBody'; + 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\LoyaltiesTiersGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getLoyaltyTierAsync + * + * Get Loyalty Tier + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLoyaltyTierAsync($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['getLoyaltyTier'][0]) + { + return $this->getLoyaltyTierAsyncWithHttpInfo($campaignId, $loyaltyTierId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getLoyaltyTierAsyncWithHttpInfo + * + * Get Loyalty Tier + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getLoyaltyTierAsyncWithHttpInfo($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['getLoyaltyTier'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBody'; + $request = $this->getLoyaltyTierRequest($campaignId, $loyaltyTierId, $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 'getLoyaltyTier' + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLoyaltyTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getLoyaltyTierRequest($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['getLoyaltyTier'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getLoyaltyTier' + ); + } + + // verify the required parameter 'loyaltyTierId' is set + if ($loyaltyTierId === null || (is_array($loyaltyTierId) && count($loyaltyTierId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $loyaltyTierId when calling getLoyaltyTier' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($loyaltyTierId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyTierId' . '}', + ObjectSerializer::toPathValue($loyaltyTierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getMember + * + * Get Member + * + * @param string $memberId Unique loyalty card code assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody + */ + public function getMember($memberId, string $contentType = self::contentTypes['getMember'][0]) + { + list($response) = $this->getMemberWithHttpInfo($memberId, $contentType); + return $response; + } + + /** + * Operation getMemberWithHttpInfo + * + * Get Member + * + * @param string $memberId Unique loyalty card code assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getMemberWithHttpInfo($memberId, string $contentType = self::contentTypes['getMember'][0]) + { + $request = $this->getMemberRequest($memberId, $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\LoyaltiesMembersGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody'; + 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\LoyaltiesMembersGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getMemberAsync + * + * Get Member + * + * @param string $memberId Unique loyalty card code assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMemberAsync($memberId, string $contentType = self::contentTypes['getMember'][0]) + { + return $this->getMemberAsyncWithHttpInfo($memberId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getMemberAsyncWithHttpInfo + * + * Get Member + * + * @param string $memberId Unique loyalty card code assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMemberAsyncWithHttpInfo($memberId, string $contentType = self::contentTypes['getMember'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody'; + $request = $this->getMemberRequest($memberId, $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 'getMember' + * + * @param string $memberId Unique loyalty card code assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getMemberRequest($memberId, string $contentType = self::contentTypes['getMember'][0]) + { + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling getMember' + ); + } + + + $resourcePath = '/v1/loyalties/members/{memberId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getMember1 + * + * Get Member + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId Unique code that identifies the loyalty card. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody + */ + public function getMember1($campaignId, $memberId, string $contentType = self::contentTypes['getMember1'][0]) + { + list($response) = $this->getMember1WithHttpInfo($campaignId, $memberId, $contentType); + return $response; + } + + /** + * Operation getMember1WithHttpInfo + * + * Get Member + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId Unique code that identifies the loyalty card. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getMember1WithHttpInfo($campaignId, $memberId, string $contentType = self::contentTypes['getMember1'][0]) + { + $request = $this->getMember1Request($campaignId, $memberId, $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\LoyaltiesMembersGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody'; + 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\LoyaltiesMembersGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getMember1Async + * + * Get Member + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId Unique code that identifies the loyalty card. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMember1Async($campaignId, $memberId, string $contentType = self::contentTypes['getMember1'][0]) + { + return $this->getMember1AsyncWithHttpInfo($campaignId, $memberId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getMember1AsyncWithHttpInfo + * + * Get Member + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId Unique code that identifies the loyalty card. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getMember1AsyncWithHttpInfo($campaignId, $memberId, string $contentType = self::contentTypes['getMember1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBody'; + $request = $this->getMember1Request($campaignId, $memberId, $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 'getMember1' + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId Unique code that identifies the loyalty card. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMember1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getMember1Request($campaignId, $memberId, string $contentType = self::contentTypes['getMember1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getMember1' + ); + } + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling getMember1' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/members/{memberId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRewardAssignment1 + * + * Get Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBody + */ + public function getRewardAssignment1($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment1'][0]) + { + list($response) = $this->getRewardAssignment1WithHttpInfo($campaignId, $assignmentId, $contentType); + return $response; + } + + /** + * Operation getRewardAssignment1WithHttpInfo + * + * Get Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getRewardAssignment1WithHttpInfo($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment1'][0]) + { + $request = $this->getRewardAssignment1Request($campaignId, $assignmentId, $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\LoyaltiesRewardAssignmentsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBody'; + 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\LoyaltiesRewardAssignmentsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRewardAssignment1Async + * + * Get Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardAssignment1Async($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment1'][0]) + { + return $this->getRewardAssignment1AsyncWithHttpInfo($campaignId, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRewardAssignment1AsyncWithHttpInfo + * + * Get Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardAssignment1AsyncWithHttpInfo($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBody'; + $request = $this->getRewardAssignment1Request($campaignId, $assignmentId, $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 'getRewardAssignment1' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRewardAssignment1Request($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getRewardAssignment1' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling getRewardAssignment1' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRewardAssignment2 + * + * Get Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment2'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBody + */ + public function getRewardAssignment2($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment2'][0]) + { + list($response) = $this->getRewardAssignment2WithHttpInfo($campaignId, $assignmentId, $contentType); + return $response; + } + + /** + * Operation getRewardAssignment2WithHttpInfo + * + * Get Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment2'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getRewardAssignment2WithHttpInfo($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment2'][0]) + { + $request = $this->getRewardAssignment2Request($campaignId, $assignmentId, $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\LoyaltiesRewardsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBody'; + 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\LoyaltiesRewardsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRewardAssignment2Async + * + * Get Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment2'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardAssignment2Async($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment2'][0]) + { + return $this->getRewardAssignment2AsyncWithHttpInfo($campaignId, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRewardAssignment2AsyncWithHttpInfo + * + * Get Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment2'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardAssignment2AsyncWithHttpInfo($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment2'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBody'; + $request = $this->getRewardAssignment2Request($campaignId, $assignmentId, $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 'getRewardAssignment2' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment2'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRewardAssignment2Request($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment2'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getRewardAssignment2' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling getRewardAssignment2' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/rewards/{assignmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRewardDetails + * + * Get Reward Details + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardDetails'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBody + */ + public function getRewardDetails($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardDetails'][0]) + { + list($response) = $this->getRewardDetailsWithHttpInfo($campaignId, $assignmentId, $contentType); + return $response; + } + + /** + * Operation getRewardDetailsWithHttpInfo + * + * Get Reward Details + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardDetails'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getRewardDetailsWithHttpInfo($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardDetails'][0]) + { + $request = $this->getRewardDetailsRequest($campaignId, $assignmentId, $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\LoyaltiesRewardAssignmentsRewardGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBody'; + 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\LoyaltiesRewardAssignmentsRewardGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRewardDetailsAsync + * + * Get Reward Details + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardDetails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardDetailsAsync($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardDetails'][0]) + { + return $this->getRewardDetailsAsyncWithHttpInfo($campaignId, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRewardDetailsAsyncWithHttpInfo + * + * Get Reward Details + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardDetails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardDetailsAsyncWithHttpInfo($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardDetails'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBody'; + $request = $this->getRewardDetailsRequest($campaignId, $assignmentId, $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 'getRewardDetails' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId Unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardDetails'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRewardDetailsRequest($campaignId, $assignmentId, string $contentType = self::contentTypes['getRewardDetails'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getRewardDetails' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling getRewardDetails' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listEarningRules + * + * List Earning Rules + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListEarningRules $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEarningRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesListResponseBody + */ + public function listEarningRules($campaignId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listEarningRules'][0]) + { + list($response) = $this->listEarningRulesWithHttpInfo($campaignId, $limit, $page, $order, $contentType); + return $response; + } + + /** + * Operation listEarningRulesWithHttpInfo + * + * List Earning Rules + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListEarningRules $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEarningRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesEarningRulesListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listEarningRulesWithHttpInfo($campaignId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listEarningRules'][0]) + { + $request = $this->listEarningRulesRequest($campaignId, $limit, $page, $order, $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\LoyaltiesEarningRulesListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesEarningRulesListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesEarningRulesListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesListResponseBody'; + 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\LoyaltiesEarningRulesListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listEarningRulesAsync + * + * List Earning Rules + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListEarningRules $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEarningRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listEarningRulesAsync($campaignId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listEarningRules'][0]) + { + return $this->listEarningRulesAsyncWithHttpInfo($campaignId, $limit, $page, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listEarningRulesAsyncWithHttpInfo + * + * List Earning Rules + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListEarningRules $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEarningRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listEarningRulesAsyncWithHttpInfo($campaignId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listEarningRules'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesListResponseBody'; + $request = $this->listEarningRulesRequest($campaignId, $limit, $page, $order, $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 'listEarningRules' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListEarningRules $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEarningRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listEarningRulesRequest($campaignId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listEarningRules'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listEarningRules' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listEarningRules, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listEarningRules, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listEarningRules, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listEarningRules, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/earning-rules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListEarningRules', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLoyaltyCardTransactions + * + * List Loyalty Card Transactions + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody + */ + public function listLoyaltyCardTransactions($memberId, $limit = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions'][0]) + { + list($response) = $this->listLoyaltyCardTransactionsWithHttpInfo($memberId, $limit, $contentType); + return $response; + } + + /** + * Operation listLoyaltyCardTransactionsWithHttpInfo + * + * List Loyalty Card Transactions + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listLoyaltyCardTransactionsWithHttpInfo($memberId, $limit = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions'][0]) + { + $request = $this->listLoyaltyCardTransactionsRequest($memberId, $limit, $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\LoyaltiesMembersTransactionsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody'; + 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\LoyaltiesMembersTransactionsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listLoyaltyCardTransactionsAsync + * + * List Loyalty Card Transactions + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyCardTransactionsAsync($memberId, $limit = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions'][0]) + { + return $this->listLoyaltyCardTransactionsAsyncWithHttpInfo($memberId, $limit, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLoyaltyCardTransactionsAsyncWithHttpInfo + * + * List Loyalty Card Transactions + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyCardTransactionsAsyncWithHttpInfo($memberId, $limit = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody'; + $request = $this->listLoyaltyCardTransactionsRequest($memberId, $limit, $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 'listLoyaltyCardTransactions' + * + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listLoyaltyCardTransactionsRequest($memberId, $limit = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions'][0]) + { + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling listLoyaltyCardTransactions' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyCardTransactions, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyCardTransactions, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/v1/loyalties/members/{memberId}/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLoyaltyCardTransactions1 + * + * List Loyalty Card Transactions + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody + */ + public function listLoyaltyCardTransactions1($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions1'][0]) + { + list($response) = $this->listLoyaltyCardTransactions1WithHttpInfo($campaignId, $memberId, $limit, $page, $contentType); + return $response; + } + + /** + * Operation listLoyaltyCardTransactions1WithHttpInfo + * + * List Loyalty Card Transactions + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listLoyaltyCardTransactions1WithHttpInfo($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions1'][0]) + { + $request = $this->listLoyaltyCardTransactions1Request($campaignId, $memberId, $limit, $page, $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\LoyaltiesMembersTransactionsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody'; + 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\LoyaltiesMembersTransactionsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listLoyaltyCardTransactions1Async + * + * List Loyalty Card Transactions + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyCardTransactions1Async($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions1'][0]) + { + return $this->listLoyaltyCardTransactions1AsyncWithHttpInfo($campaignId, $memberId, $limit, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLoyaltyCardTransactions1AsyncWithHttpInfo + * + * List Loyalty Card Transactions + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyCardTransactions1AsyncWithHttpInfo($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsListResponseBody'; + $request = $this->listLoyaltyCardTransactions1Request($campaignId, $memberId, $limit, $page, $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 'listLoyaltyCardTransactions1' + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. (required) + * @param string $memberId A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyCardTransactions1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listLoyaltyCardTransactions1Request($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyCardTransactions1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listLoyaltyCardTransactions1' + ); + } + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling listLoyaltyCardTransactions1' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyCardTransactions1, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyCardTransactions1, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listLoyaltyCardTransactions1, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listLoyaltyCardTransactions1, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/members/{memberId}/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLoyaltyPrograms + * + * List Loyalty Campaigns + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyPrograms'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesListCampaignsResponseBody + */ + public function listLoyaltyPrograms($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listLoyaltyPrograms'][0]) + { + list($response) = $this->listLoyaltyProgramsWithHttpInfo($limit, $page, $order, $contentType); + return $response; + } + + /** + * Operation listLoyaltyProgramsWithHttpInfo + * + * List Loyalty Campaigns + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyPrograms'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesListCampaignsResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listLoyaltyProgramsWithHttpInfo($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listLoyaltyPrograms'][0]) + { + $request = $this->listLoyaltyProgramsRequest($limit, $page, $order, $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\LoyaltiesListCampaignsResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesListCampaignsResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesListCampaignsResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesListCampaignsResponseBody'; + 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\LoyaltiesListCampaignsResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listLoyaltyProgramsAsync + * + * List Loyalty Campaigns + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyPrograms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyProgramsAsync($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listLoyaltyPrograms'][0]) + { + return $this->listLoyaltyProgramsAsyncWithHttpInfo($limit, $page, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLoyaltyProgramsAsyncWithHttpInfo + * + * List Loyalty Campaigns + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyPrograms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyProgramsAsyncWithHttpInfo($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listLoyaltyPrograms'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesListCampaignsResponseBody'; + $request = $this->listLoyaltyProgramsRequest($limit, $page, $order, $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 'listLoyaltyPrograms' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListCampaigns $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyPrograms'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listLoyaltyProgramsRequest($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listLoyaltyPrograms'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyPrograms, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyPrograms, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listLoyaltyPrograms, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listLoyaltyPrograms, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/loyalties'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListCampaigns', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLoyaltyTierEarningRules + * + * List Loyalty Tier Earning Rules + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierEarningRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesTiersEarningRulesListResponseBody + */ + public function listLoyaltyTierEarningRules($campaignId, $loyaltyTierId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyTierEarningRules'][0]) + { + list($response) = $this->listLoyaltyTierEarningRulesWithHttpInfo($campaignId, $loyaltyTierId, $limit, $page, $contentType); + return $response; + } + + /** + * Operation listLoyaltyTierEarningRulesWithHttpInfo + * + * List Loyalty Tier Earning Rules + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierEarningRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesTiersEarningRulesListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listLoyaltyTierEarningRulesWithHttpInfo($campaignId, $loyaltyTierId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyTierEarningRules'][0]) + { + $request = $this->listLoyaltyTierEarningRulesRequest($campaignId, $loyaltyTierId, $limit, $page, $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\LoyaltiesTiersEarningRulesListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesTiersEarningRulesListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesTiersEarningRulesListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesTiersEarningRulesListResponseBody'; + 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\LoyaltiesTiersEarningRulesListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listLoyaltyTierEarningRulesAsync + * + * List Loyalty Tier Earning Rules + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierEarningRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyTierEarningRulesAsync($campaignId, $loyaltyTierId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyTierEarningRules'][0]) + { + return $this->listLoyaltyTierEarningRulesAsyncWithHttpInfo($campaignId, $loyaltyTierId, $limit, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLoyaltyTierEarningRulesAsyncWithHttpInfo + * + * List Loyalty Tier Earning Rules + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierEarningRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyTierEarningRulesAsyncWithHttpInfo($campaignId, $loyaltyTierId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyTierEarningRules'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesTiersEarningRulesListResponseBody'; + $request = $this->listLoyaltyTierEarningRulesRequest($campaignId, $loyaltyTierId, $limit, $page, $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 'listLoyaltyTierEarningRules' + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierEarningRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listLoyaltyTierEarningRulesRequest($campaignId, $loyaltyTierId, $limit = null, $page = null, string $contentType = self::contentTypes['listLoyaltyTierEarningRules'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listLoyaltyTierEarningRules' + ); + } + + // verify the required parameter 'loyaltyTierId' is set + if ($loyaltyTierId === null || (is_array($loyaltyTierId) && count($loyaltyTierId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $loyaltyTierId when calling listLoyaltyTierEarningRules' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyTierEarningRules, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyTierEarningRules, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listLoyaltyTierEarningRules, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listLoyaltyTierEarningRules, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($loyaltyTierId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyTierId' . '}', + ObjectSerializer::toPathValue($loyaltyTierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLoyaltyTierRewards + * + * List Loyalty Tier Rewards + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierRewards'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesTiersRewardsListResponseBody + */ + public function listLoyaltyTierRewards($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['listLoyaltyTierRewards'][0]) + { + list($response) = $this->listLoyaltyTierRewardsWithHttpInfo($campaignId, $loyaltyTierId, $contentType); + return $response; + } + + /** + * Operation listLoyaltyTierRewardsWithHttpInfo + * + * List Loyalty Tier Rewards + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierRewards'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesTiersRewardsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listLoyaltyTierRewardsWithHttpInfo($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['listLoyaltyTierRewards'][0]) + { + $request = $this->listLoyaltyTierRewardsRequest($campaignId, $loyaltyTierId, $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\LoyaltiesTiersRewardsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesTiersRewardsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesTiersRewardsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesTiersRewardsListResponseBody'; + 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\LoyaltiesTiersRewardsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listLoyaltyTierRewardsAsync + * + * List Loyalty Tier Rewards + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyTierRewardsAsync($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['listLoyaltyTierRewards'][0]) + { + return $this->listLoyaltyTierRewardsAsyncWithHttpInfo($campaignId, $loyaltyTierId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLoyaltyTierRewardsAsyncWithHttpInfo + * + * List Loyalty Tier Rewards + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyTierRewardsAsyncWithHttpInfo($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['listLoyaltyTierRewards'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesTiersRewardsListResponseBody'; + $request = $this->listLoyaltyTierRewardsRequest($campaignId, $loyaltyTierId, $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 'listLoyaltyTierRewards' + * + * @param string $campaignId Unique campaign ID or name. (required) + * @param string $loyaltyTierId Unique loyalty tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTierRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listLoyaltyTierRewardsRequest($campaignId, $loyaltyTierId, string $contentType = self::contentTypes['listLoyaltyTierRewards'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listLoyaltyTierRewards' + ); + } + + // verify the required parameter 'loyaltyTierId' is set + if ($loyaltyTierId === null || (is_array($loyaltyTierId) && count($loyaltyTierId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $loyaltyTierId when calling listLoyaltyTierRewards' + ); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($loyaltyTierId !== null) { + $resourcePath = str_replace( + '{' . 'loyaltyTierId' . '}', + ObjectSerializer::toPathValue($loyaltyTierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listLoyaltyTiers + * + * List Loyalty Tiers + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListLoyaltyTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTiers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesTiersListResponseBody + */ + public function listLoyaltyTiers($campaignId, $limit = null, $order = null, string $contentType = self::contentTypes['listLoyaltyTiers'][0]) + { + list($response) = $this->listLoyaltyTiersWithHttpInfo($campaignId, $limit, $order, $contentType); + return $response; + } + + /** + * Operation listLoyaltyTiersWithHttpInfo + * + * List Loyalty Tiers + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListLoyaltyTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTiers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesTiersListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listLoyaltyTiersWithHttpInfo($campaignId, $limit = null, $order = null, string $contentType = self::contentTypes['listLoyaltyTiers'][0]) + { + $request = $this->listLoyaltyTiersRequest($campaignId, $limit, $order, $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\LoyaltiesTiersListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesTiersListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesTiersListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesTiersListResponseBody'; + 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\LoyaltiesTiersListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listLoyaltyTiersAsync + * + * List Loyalty Tiers + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListLoyaltyTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyTiersAsync($campaignId, $limit = null, $order = null, string $contentType = self::contentTypes['listLoyaltyTiers'][0]) + { + return $this->listLoyaltyTiersAsyncWithHttpInfo($campaignId, $limit, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listLoyaltyTiersAsyncWithHttpInfo + * + * List Loyalty Tiers + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListLoyaltyTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listLoyaltyTiersAsyncWithHttpInfo($campaignId, $limit = null, $order = null, string $contentType = self::contentTypes['listLoyaltyTiers'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesTiersListResponseBody'; + $request = $this->listLoyaltyTiersRequest($campaignId, $limit, $order, $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 'listLoyaltyTiers' + * + * @param string $campaignId Unique loyalty campaign ID or name. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderListLoyaltyTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listLoyaltyTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listLoyaltyTiersRequest($campaignId, $limit = null, $order = null, string $contentType = self::contentTypes['listLoyaltyTiers'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listLoyaltyTiers' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyTiers, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listLoyaltyTiers, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListLoyaltyTiers', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listMemberActivity + * + * List Member Activity + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody + */ + public function listMemberActivity($memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity'][0]) + { + list($response) = $this->listMemberActivityWithHttpInfo($memberId, $limit, $order, $startingAfterId, $contentType); + return $response; + } + + /** + * Operation listMemberActivityWithHttpInfo + * + * List Member Activity + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listMemberActivityWithHttpInfo($memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity'][0]) + { + $request = $this->listMemberActivityRequest($memberId, $limit, $order, $startingAfterId, $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\LoyaltiesMemberActivityListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody'; + 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\LoyaltiesMemberActivityListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listMemberActivityAsync + * + * List Member Activity + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMemberActivityAsync($memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity'][0]) + { + return $this->listMemberActivityAsyncWithHttpInfo($memberId, $limit, $order, $startingAfterId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMemberActivityAsyncWithHttpInfo + * + * List Member Activity + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMemberActivityAsyncWithHttpInfo($memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody'; + $request = $this->listMemberActivityRequest($memberId, $limit, $order, $startingAfterId, $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 'listMemberActivity' + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listMemberActivityRequest($memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity'][0]) + { + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling listMemberActivity' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listMemberActivity, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listMemberActivity, must be bigger than or equal to 1.'); + } + + + + + $resourcePath = '/v1/loyalties/members/{memberId}/activity'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderCreatedAt', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startingAfterId, + 'starting_after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listMemberActivity1 + * + * List Member Activity + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody + */ + public function listMemberActivity1($campaignId, $memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity1'][0]) + { + list($response) = $this->listMemberActivity1WithHttpInfo($campaignId, $memberId, $limit, $order, $startingAfterId, $contentType); + return $response; + } + + /** + * Operation listMemberActivity1WithHttpInfo + * + * List Member Activity + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listMemberActivity1WithHttpInfo($campaignId, $memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity1'][0]) + { + $request = $this->listMemberActivity1Request($campaignId, $memberId, $limit, $order, $startingAfterId, $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\LoyaltiesMemberActivityListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody'; + 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\LoyaltiesMemberActivityListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listMemberActivity1Async + * + * List Member Activity + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMemberActivity1Async($campaignId, $memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity1'][0]) + { + return $this->listMemberActivity1AsyncWithHttpInfo($campaignId, $memberId, $limit, $order, $startingAfterId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMemberActivity1AsyncWithHttpInfo + * + * List Member Activity + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMemberActivity1AsyncWithHttpInfo($campaignId, $memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMemberActivityListResponseBody'; + $request = $this->listMemberActivity1Request($campaignId, $memberId, $limit, $order, $startingAfterId, $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 'listMemberActivity1' + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param ParameterOrderCreatedAt $order Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $startingAfterId A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberActivity1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listMemberActivity1Request($campaignId, $memberId, $limit = null, $order = null, $startingAfterId = null, string $contentType = self::contentTypes['listMemberActivity1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listMemberActivity1' + ); + } + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling listMemberActivity1' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listMemberActivity1, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listMemberActivity1, must be bigger than or equal to 1.'); + } + + + + + $resourcePath = '/v1/loyalties/{campaignId}/members/{memberId}/activity'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderCreatedAt', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startingAfterId, + 'starting_after_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listMemberLoyaltyTier + * + * List Member's Loyalty Tiers + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberLoyaltyTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersTiersListResponseBody + */ + public function listMemberLoyaltyTier($memberId, string $contentType = self::contentTypes['listMemberLoyaltyTier'][0]) + { + list($response) = $this->listMemberLoyaltyTierWithHttpInfo($memberId, $contentType); + return $response; + } + + /** + * Operation listMemberLoyaltyTierWithHttpInfo + * + * List Member's Loyalty Tiers + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberLoyaltyTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersTiersListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listMemberLoyaltyTierWithHttpInfo($memberId, string $contentType = self::contentTypes['listMemberLoyaltyTier'][0]) + { + $request = $this->listMemberLoyaltyTierRequest($memberId, $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\LoyaltiesMembersTiersListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersTiersListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersTiersListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTiersListResponseBody'; + 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\LoyaltiesMembersTiersListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listMemberLoyaltyTierAsync + * + * List Member's Loyalty Tiers + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberLoyaltyTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMemberLoyaltyTierAsync($memberId, string $contentType = self::contentTypes['listMemberLoyaltyTier'][0]) + { + return $this->listMemberLoyaltyTierAsyncWithHttpInfo($memberId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMemberLoyaltyTierAsyncWithHttpInfo + * + * List Member's Loyalty Tiers + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberLoyaltyTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMemberLoyaltyTierAsyncWithHttpInfo($memberId, string $contentType = self::contentTypes['listMemberLoyaltyTier'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTiersListResponseBody'; + $request = $this->listMemberLoyaltyTierRequest($memberId, $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 'listMemberLoyaltyTier' + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberLoyaltyTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listMemberLoyaltyTierRequest($memberId, string $contentType = self::contentTypes['listMemberLoyaltyTier'][0]) + { + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling listMemberLoyaltyTier' + ); + } + + + $resourcePath = '/v1/loyalties/members/{memberId}/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listMemberRewards + * + * List Member Rewards + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param bool $affordableOnly Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberRewards'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBody + */ + public function listMemberRewards($memberId, $affordableOnly = null, string $contentType = self::contentTypes['listMemberRewards'][0]) + { + list($response) = $this->listMemberRewardsWithHttpInfo($memberId, $affordableOnly, $contentType); + return $response; + } + + /** + * Operation listMemberRewardsWithHttpInfo + * + * List Member Rewards + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param bool $affordableOnly Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberRewards'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listMemberRewardsWithHttpInfo($memberId, $affordableOnly = null, string $contentType = self::contentTypes['listMemberRewards'][0]) + { + $request = $this->listMemberRewardsRequest($memberId, $affordableOnly, $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\LoyaltiesMembersRewardsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBody'; + 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\LoyaltiesMembersRewardsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listMemberRewardsAsync + * + * List Member Rewards + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param bool $affordableOnly Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMemberRewardsAsync($memberId, $affordableOnly = null, string $contentType = self::contentTypes['listMemberRewards'][0]) + { + return $this->listMemberRewardsAsyncWithHttpInfo($memberId, $affordableOnly, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMemberRewardsAsyncWithHttpInfo + * + * List Member Rewards + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param bool $affordableOnly Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMemberRewardsAsyncWithHttpInfo($memberId, $affordableOnly = null, string $contentType = self::contentTypes['listMemberRewards'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBody'; + $request = $this->listMemberRewardsRequest($memberId, $affordableOnly, $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 'listMemberRewards' + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param bool $affordableOnly Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMemberRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listMemberRewardsRequest($memberId, $affordableOnly = null, string $contentType = self::contentTypes['listMemberRewards'][0]) + { + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling listMemberRewards' + ); + } + + + + $resourcePath = '/v1/loyalties/members/{memberId}/rewards'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $affordableOnly, + 'affordable_only', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listMembers + * + * List Members + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code code (optional) + * @param string[] $ids ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMembers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesListMembersResponseBody + */ + public function listMembers($campaignId, $limit = null, $page = null, $customer = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listMembers'][0]) + { + list($response) = $this->listMembersWithHttpInfo($campaignId, $limit, $page, $customer, $createdAt, $updatedAt, $order, $code, $ids, $contentType); + return $response; + } + + /** + * Operation listMembersWithHttpInfo + * + * List Members + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code (optional) + * @param string[] $ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMembers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesListMembersResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listMembersWithHttpInfo($campaignId, $limit = null, $page = null, $customer = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listMembers'][0]) + { + $request = $this->listMembersRequest($campaignId, $limit, $page, $customer, $createdAt, $updatedAt, $order, $code, $ids, $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\LoyaltiesListMembersResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesListMembersResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesListMembersResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesListMembersResponseBody'; + 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\LoyaltiesListMembersResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listMembersAsync + * + * List Members + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code (optional) + * @param string[] $ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMembers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMembersAsync($campaignId, $limit = null, $page = null, $customer = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listMembers'][0]) + { + return $this->listMembersAsyncWithHttpInfo($campaignId, $limit, $page, $customer, $createdAt, $updatedAt, $order, $code, $ids, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMembersAsyncWithHttpInfo + * + * List Members + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code (optional) + * @param string[] $ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMembers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listMembersAsyncWithHttpInfo($campaignId, $limit = null, $page = null, $customer = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listMembers'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesListMembersResponseBody'; + $request = $this->listMembersRequest($campaignId, $limit, $page, $customer, $createdAt, $updatedAt, $order, $code, $ids, $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 'listMembers' + * + * @param string $campaignId Unique campaign ID of the loyalty program. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code (optional) + * @param string[] $ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMembers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listMembersRequest($campaignId, $limit = null, $page = null, $customer = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listMembers'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listMembers' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listMembers, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listMembers, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listMembers, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listMembers, must be bigger than or equal to 1.'); + } + + + + + + + + + $resourcePath = '/v1/loyalties/{campaignId}/members'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $customer, + 'customer', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdAt, + 'created_at', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updatedAt, + 'updated_at', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderVouchers', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $code, + 'code', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $ids, + 'ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listPointsExpiration + * + * Get Points Expiration + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $memberId Loyalty card code. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPointsExpiration'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBody + */ + public function listPointsExpiration($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listPointsExpiration'][0]) + { + list($response) = $this->listPointsExpirationWithHttpInfo($campaignId, $memberId, $limit, $page, $contentType); + return $response; + } + + /** + * Operation listPointsExpirationWithHttpInfo + * + * Get Points Expiration + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $memberId Loyalty card code. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPointsExpiration'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listPointsExpirationWithHttpInfo($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listPointsExpiration'][0]) + { + $request = $this->listPointsExpirationRequest($campaignId, $memberId, $limit, $page, $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\LoyaltiesMembersPointsExpirationListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBody'; + 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\LoyaltiesMembersPointsExpirationListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listPointsExpirationAsync + * + * Get Points Expiration + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $memberId Loyalty card code. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPointsExpiration'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPointsExpirationAsync($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listPointsExpiration'][0]) + { + return $this->listPointsExpirationAsyncWithHttpInfo($campaignId, $memberId, $limit, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listPointsExpirationAsyncWithHttpInfo + * + * Get Points Expiration + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $memberId Loyalty card code. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPointsExpiration'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPointsExpirationAsyncWithHttpInfo($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listPointsExpiration'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBody'; + $request = $this->listPointsExpirationRequest($campaignId, $memberId, $limit, $page, $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 'listPointsExpiration' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $memberId Loyalty card code. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPointsExpiration'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listPointsExpirationRequest($campaignId, $memberId, $limit = null, $page = null, string $contentType = self::contentTypes['listPointsExpiration'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listPointsExpiration' + ); + } + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling listPointsExpiration' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listPointsExpiration, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listPointsExpiration, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listPointsExpiration, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listPointsExpiration, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/v1/loyalties/{campaignId}/members/{memberId}/points-expiration'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listRewardAssignments1 + * + * List Reward Assignments + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsListResponseBody + */ + public function listRewardAssignments1($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments1'][0]) + { + list($response) = $this->listRewardAssignments1WithHttpInfo($campaignId, $limit, $page, $assignmentId, $contentType); + return $response; + } + + /** + * Operation listRewardAssignments1WithHttpInfo + * + * List Reward Assignments + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listRewardAssignments1WithHttpInfo($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments1'][0]) + { + $request = $this->listRewardAssignments1Request($campaignId, $limit, $page, $assignmentId, $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\LoyaltiesRewardAssignmentsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsListResponseBody'; + 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\LoyaltiesRewardAssignmentsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listRewardAssignments1Async + * + * List Reward Assignments + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRewardAssignments1Async($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments1'][0]) + { + return $this->listRewardAssignments1AsyncWithHttpInfo($campaignId, $limit, $page, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listRewardAssignments1AsyncWithHttpInfo + * + * List Reward Assignments + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRewardAssignments1AsyncWithHttpInfo($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsListResponseBody'; + $request = $this->listRewardAssignments1Request($campaignId, $limit, $page, $assignmentId, $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 'listRewardAssignments1' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listRewardAssignments1Request($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listRewardAssignments1' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listRewardAssignments1, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listRewardAssignments1, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listRewardAssignments1, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listRewardAssignments1, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/reward-assignments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $assignmentId, + 'assignmentId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listRewardAssignments2 + * + * List Reward Assignments + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments2'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesRewardsListAssignmentsResponseBody + */ + public function listRewardAssignments2($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments2'][0]) + { + list($response) = $this->listRewardAssignments2WithHttpInfo($campaignId, $limit, $page, $assignmentId, $contentType); + return $response; + } + + /** + * Operation listRewardAssignments2WithHttpInfo + * + * List Reward Assignments + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments2'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesRewardsListAssignmentsResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listRewardAssignments2WithHttpInfo($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments2'][0]) + { + $request = $this->listRewardAssignments2Request($campaignId, $limit, $page, $assignmentId, $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\LoyaltiesRewardsListAssignmentsResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesRewardsListAssignmentsResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesRewardsListAssignmentsResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardsListAssignmentsResponseBody'; + 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\LoyaltiesRewardsListAssignmentsResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listRewardAssignments2Async + * + * List Reward Assignments + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments2'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRewardAssignments2Async($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments2'][0]) + { + return $this->listRewardAssignments2AsyncWithHttpInfo($campaignId, $limit, $page, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listRewardAssignments2AsyncWithHttpInfo + * + * List Reward Assignments + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments2'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRewardAssignments2AsyncWithHttpInfo($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments2'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardsListAssignmentsResponseBody'; + $request = $this->listRewardAssignments2Request($campaignId, $limit, $page, $assignmentId, $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 'listRewardAssignments2' + * + * @param string $campaignId Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments2'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listRewardAssignments2Request($campaignId, $limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewardAssignments2'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listRewardAssignments2' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listRewardAssignments2, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling LoyaltiesApi.listRewardAssignments2, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listRewardAssignments2, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling LoyaltiesApi.listRewardAssignments2, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/rewards'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $assignmentId, + 'assignment_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation redeemReward + * + * Redeem Reward + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody + */ + public function redeemReward($memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward'][0]) + { + list($response) = $this->redeemRewardWithHttpInfo($memberId, $loyaltiesMembersRedemptionRedeemRequestBody, $contentType); + return $response; + } + + /** + * Operation redeemRewardWithHttpInfo + * + * Redeem Reward + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function redeemRewardWithHttpInfo($memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward'][0]) + { + $request = $this->redeemRewardRequest($memberId, $loyaltiesMembersRedemptionRedeemRequestBody, $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\LoyaltiesMembersRedemptionRedeemResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody'; + 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\LoyaltiesMembersRedemptionRedeemResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation redeemRewardAsync + * + * Redeem Reward + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redeemRewardAsync($memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward'][0]) + { + return $this->redeemRewardAsyncWithHttpInfo($memberId, $loyaltiesMembersRedemptionRedeemRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation redeemRewardAsyncWithHttpInfo + * + * Redeem Reward + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redeemRewardAsyncWithHttpInfo($memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody'; + $request = $this->redeemRewardRequest($memberId, $loyaltiesMembersRedemptionRedeemRequestBody, $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 'redeemReward' + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function redeemRewardRequest($memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward'][0]) + { + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling redeemReward' + ); + } + + + + $resourcePath = '/v1/loyalties/members/{memberId}/redemption'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesMembersRedemptionRedeemRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesMembersRedemptionRedeemRequestBody)); + } else { + $httpBody = $loyaltiesMembersRedemptionRedeemRequestBody; + } + } 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 redeemReward1 + * + * Redeem Reward + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody + */ + public function redeemReward1($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward1'][0]) + { + list($response) = $this->redeemReward1WithHttpInfo($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody, $contentType); + return $response; + } + + /** + * Operation redeemReward1WithHttpInfo + * + * Redeem Reward + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function redeemReward1WithHttpInfo($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward1'][0]) + { + $request = $this->redeemReward1Request($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody, $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\LoyaltiesMembersRedemptionRedeemResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody'; + 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\LoyaltiesMembersRedemptionRedeemResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation redeemReward1Async + * + * Redeem Reward + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redeemReward1Async($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward1'][0]) + { + return $this->redeemReward1AsyncWithHttpInfo($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation redeemReward1AsyncWithHttpInfo + * + * Redeem Reward + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redeemReward1AsyncWithHttpInfo($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBody'; + $request = $this->redeemReward1Request($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody, $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 'redeemReward1' + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBody $loyaltiesMembersRedemptionRedeemRequestBody Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemReward1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function redeemReward1Request($campaignId, $memberId, $loyaltiesMembersRedemptionRedeemRequestBody = null, string $contentType = self::contentTypes['redeemReward1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling redeemReward1' + ); + } + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling redeemReward1' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/members/{memberId}/redemption'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesMembersRedemptionRedeemRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesMembersRedemptionRedeemRequestBody)); + } else { + $httpBody = $loyaltiesMembersRedemptionRedeemRequestBody; + } + } 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 transferPoints + * + * Transfer Loyalty Points + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). (required) + * @param string $memberId A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). (required) + * @param \OpenAPI\Client\Model\LoyaltiesTransferPoints[] $loyaltiesTransferPoints Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transferPoints'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBody + */ + public function transferPoints($campaignId, $memberId, $loyaltiesTransferPoints = null, string $contentType = self::contentTypes['transferPoints'][0]) + { + list($response) = $this->transferPointsWithHttpInfo($campaignId, $memberId, $loyaltiesTransferPoints, $contentType); + return $response; + } + + /** + * Operation transferPointsWithHttpInfo + * + * Transfer Loyalty Points + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). (required) + * @param string $memberId A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). (required) + * @param \OpenAPI\Client\Model\LoyaltiesTransferPoints[] $loyaltiesTransferPoints Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transferPoints'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function transferPointsWithHttpInfo($campaignId, $memberId, $loyaltiesTransferPoints = null, string $contentType = self::contentTypes['transferPoints'][0]) + { + $request = $this->transferPointsRequest($campaignId, $memberId, $loyaltiesTransferPoints, $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\LoyaltiesMembersTransfersCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBody'; + 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\LoyaltiesMembersTransfersCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transferPointsAsync + * + * Transfer Loyalty Points + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). (required) + * @param string $memberId A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). (required) + * @param \OpenAPI\Client\Model\LoyaltiesTransferPoints[] $loyaltiesTransferPoints Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transferPoints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transferPointsAsync($campaignId, $memberId, $loyaltiesTransferPoints = null, string $contentType = self::contentTypes['transferPoints'][0]) + { + return $this->transferPointsAsyncWithHttpInfo($campaignId, $memberId, $loyaltiesTransferPoints, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transferPointsAsyncWithHttpInfo + * + * Transfer Loyalty Points + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). (required) + * @param string $memberId A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). (required) + * @param \OpenAPI\Client\Model\LoyaltiesTransferPoints[] $loyaltiesTransferPoints Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transferPoints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transferPointsAsyncWithHttpInfo($campaignId, $memberId, $loyaltiesTransferPoints = null, string $contentType = self::contentTypes['transferPoints'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBody'; + $request = $this->transferPointsRequest($campaignId, $memberId, $loyaltiesTransferPoints, $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 'transferPoints' + * + * @param string $campaignId A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). (required) + * @param string $memberId A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). (required) + * @param \OpenAPI\Client\Model\LoyaltiesTransferPoints[] $loyaltiesTransferPoints Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transferPoints'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transferPointsRequest($campaignId, $memberId, $loyaltiesTransferPoints = null, string $contentType = self::contentTypes['transferPoints'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling transferPoints' + ); + } + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling transferPoints' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/members/{memberId}/transfers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesTransferPoints)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesTransferPoints)); + } else { + $httpBody = $loyaltiesTransferPoints; + } + } 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 updateEarningRule + * + * Update Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBody $loyaltiesEarningRulesUpdateRequestBody Specify the parameters that you would like to update for the given earning rule. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBody + */ + public function updateEarningRule($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateEarningRule'][0]) + { + list($response) = $this->updateEarningRuleWithHttpInfo($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateEarningRuleWithHttpInfo + * + * Update Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBody $loyaltiesEarningRulesUpdateRequestBody Specify the parameters that you would like to update for the given earning rule. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEarningRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateEarningRuleWithHttpInfo($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateEarningRule'][0]) + { + $request = $this->updateEarningRuleRequest($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody, $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\LoyaltiesEarningRulesUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBody'; + 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\LoyaltiesEarningRulesUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateEarningRuleAsync + * + * Update Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBody $loyaltiesEarningRulesUpdateRequestBody Specify the parameters that you would like to update for the given earning rule. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateEarningRuleAsync($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateEarningRule'][0]) + { + return $this->updateEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateEarningRuleAsyncWithHttpInfo + * + * Update Earning Rule + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBody $loyaltiesEarningRulesUpdateRequestBody Specify the parameters that you would like to update for the given earning rule. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateEarningRuleAsyncWithHttpInfo($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateEarningRule'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBody'; + $request = $this->updateEarningRuleRequest($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody, $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 'updateEarningRule' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $earningRuleId A unique earning rule ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBody $loyaltiesEarningRulesUpdateRequestBody Specify the parameters that you would like to update for the given earning rule. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEarningRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateEarningRuleRequest($campaignId, $earningRuleId, $loyaltiesEarningRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateEarningRule'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateEarningRule' + ); + } + + // verify the required parameter 'earningRuleId' is set + if ($earningRuleId === null || (is_array($earningRuleId) && count($earningRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $earningRuleId when calling updateEarningRule' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($earningRuleId !== null) { + $resourcePath = str_replace( + '{' . 'earningRuleId' . '}', + ObjectSerializer::toPathValue($earningRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesEarningRulesUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesEarningRulesUpdateRequestBody)); + } else { + $httpBody = $loyaltiesEarningRulesUpdateRequestBody; + } + } 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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateLoyaltyCardBalance + * + * Add or Remove Loyalty Card Balance + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody + */ + public function updateLoyaltyCardBalance($memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance'][0]) + { + list($response) = $this->updateLoyaltyCardBalanceWithHttpInfo($memberId, $loyaltiesMembersBalanceUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateLoyaltyCardBalanceWithHttpInfo + * + * Add or Remove Loyalty Card Balance + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateLoyaltyCardBalanceWithHttpInfo($memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance'][0]) + { + $request = $this->updateLoyaltyCardBalanceRequest($memberId, $loyaltiesMembersBalanceUpdateRequestBody, $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\LoyaltiesMembersBalanceUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody'; + 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\LoyaltiesMembersBalanceUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateLoyaltyCardBalanceAsync + * + * Add or Remove Loyalty Card Balance + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLoyaltyCardBalanceAsync($memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance'][0]) + { + return $this->updateLoyaltyCardBalanceAsyncWithHttpInfo($memberId, $loyaltiesMembersBalanceUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateLoyaltyCardBalanceAsyncWithHttpInfo + * + * Add or Remove Loyalty Card Balance + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLoyaltyCardBalanceAsyncWithHttpInfo($memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody'; + $request = $this->updateLoyaltyCardBalanceRequest($memberId, $loyaltiesMembersBalanceUpdateRequestBody, $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 'updateLoyaltyCardBalance' + * + * @param string $memberId Unique loyalty card assigned to a particular customer. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateLoyaltyCardBalanceRequest($memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance'][0]) + { + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling updateLoyaltyCardBalance' + ); + } + + + + $resourcePath = '/v1/loyalties/members/{memberId}/balance'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesMembersBalanceUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesMembersBalanceUpdateRequestBody)); + } else { + $httpBody = $loyaltiesMembersBalanceUpdateRequestBody; + } + } 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 updateLoyaltyCardBalance1 + * + * Add or Remove Loyalty Card Balance + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody + */ + public function updateLoyaltyCardBalance1($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance1'][0]) + { + list($response) = $this->updateLoyaltyCardBalance1WithHttpInfo($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateLoyaltyCardBalance1WithHttpInfo + * + * Add or Remove Loyalty Card Balance + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateLoyaltyCardBalance1WithHttpInfo($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance1'][0]) + { + $request = $this->updateLoyaltyCardBalance1Request($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody, $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\LoyaltiesMembersBalanceUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody'; + 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\LoyaltiesMembersBalanceUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateLoyaltyCardBalance1Async + * + * Add or Remove Loyalty Card Balance + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLoyaltyCardBalance1Async($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance1'][0]) + { + return $this->updateLoyaltyCardBalance1AsyncWithHttpInfo($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateLoyaltyCardBalance1AsyncWithHttpInfo + * + * Add or Remove Loyalty Card Balance + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLoyaltyCardBalance1AsyncWithHttpInfo($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBody'; + $request = $this->updateLoyaltyCardBalance1Request($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody, $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 'updateLoyaltyCardBalance1' + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $memberId A code that identifies the loyalty card. (required) + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateRequestBody $loyaltiesMembersBalanceUpdateRequestBody Specify the point adjustment along with the expiration mechanism. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyCardBalance1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateLoyaltyCardBalance1Request($campaignId, $memberId, $loyaltiesMembersBalanceUpdateRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyCardBalance1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateLoyaltyCardBalance1' + ); + } + + // verify the required parameter 'memberId' is set + if ($memberId === null || (is_array($memberId) && count($memberId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $memberId when calling updateLoyaltyCardBalance1' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/members/{memberId}/balance'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($memberId !== null) { + $resourcePath = str_replace( + '{' . 'memberId' . '}', + ObjectSerializer::toPathValue($memberId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesMembersBalanceUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesMembersBalanceUpdateRequestBody)); + } else { + $httpBody = $loyaltiesMembersBalanceUpdateRequestBody; + } + } 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 updateLoyaltyProgram + * + * Update Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBody $loyaltiesUpdateCampaignRequestBody Specify the new values for the parameters that you would like to update for the given loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesUpdateCampaignResponseBody + */ + public function updateLoyaltyProgram($campaignId, $loyaltiesUpdateCampaignRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyProgram'][0]) + { + list($response) = $this->updateLoyaltyProgramWithHttpInfo($campaignId, $loyaltiesUpdateCampaignRequestBody, $contentType); + return $response; + } + + /** + * Operation updateLoyaltyProgramWithHttpInfo + * + * Update Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBody $loyaltiesUpdateCampaignRequestBody Specify the new values for the parameters that you would like to update for the given loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesUpdateCampaignResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateLoyaltyProgramWithHttpInfo($campaignId, $loyaltiesUpdateCampaignRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyProgram'][0]) + { + $request = $this->updateLoyaltyProgramRequest($campaignId, $loyaltiesUpdateCampaignRequestBody, $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\LoyaltiesUpdateCampaignResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesUpdateCampaignResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesUpdateCampaignResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesUpdateCampaignResponseBody'; + 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\LoyaltiesUpdateCampaignResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateLoyaltyProgramAsync + * + * Update Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBody $loyaltiesUpdateCampaignRequestBody Specify the new values for the parameters that you would like to update for the given loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLoyaltyProgramAsync($campaignId, $loyaltiesUpdateCampaignRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyProgram'][0]) + { + return $this->updateLoyaltyProgramAsyncWithHttpInfo($campaignId, $loyaltiesUpdateCampaignRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateLoyaltyProgramAsyncWithHttpInfo + * + * Update Loyalty Campaign + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBody $loyaltiesUpdateCampaignRequestBody Specify the new values for the parameters that you would like to update for the given loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateLoyaltyProgramAsyncWithHttpInfo($campaignId, $loyaltiesUpdateCampaignRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyProgram'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesUpdateCampaignResponseBody'; + $request = $this->updateLoyaltyProgramRequest($campaignId, $loyaltiesUpdateCampaignRequestBody, $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 'updateLoyaltyProgram' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param \OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBody $loyaltiesUpdateCampaignRequestBody Specify the new values for the parameters that you would like to update for the given loyalty campaign. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateLoyaltyProgram'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateLoyaltyProgramRequest($campaignId, $loyaltiesUpdateCampaignRequestBody = null, string $contentType = self::contentTypes['updateLoyaltyProgram'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateLoyaltyProgram' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesUpdateCampaignRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesUpdateCampaignRequestBody)); + } else { + $httpBody = $loyaltiesUpdateCampaignRequestBody; + } + } 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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateRewardAssignment1 + * + * Update Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBody $loyaltiesRewardsUpdateAssignmentRequestBody Update the points cost for the reward assignment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBody + */ + public function updateRewardAssignment1($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment1'][0]) + { + list($response) = $this->updateRewardAssignment1WithHttpInfo($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody, $contentType); + return $response; + } + + /** + * Operation updateRewardAssignment1WithHttpInfo + * + * Update Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBody $loyaltiesRewardsUpdateAssignmentRequestBody Update the points cost for the reward assignment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateRewardAssignment1WithHttpInfo($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment1'][0]) + { + $request = $this->updateRewardAssignment1Request($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody, $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\LoyaltiesRewardsUpdateAssignmentResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBody'; + 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\LoyaltiesRewardsUpdateAssignmentResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateRewardAssignment1Async + * + * Update Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBody $loyaltiesRewardsUpdateAssignmentRequestBody Update the points cost for the reward assignment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateRewardAssignment1Async($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment1'][0]) + { + return $this->updateRewardAssignment1AsyncWithHttpInfo($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateRewardAssignment1AsyncWithHttpInfo + * + * Update Reward Assignment + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBody $loyaltiesRewardsUpdateAssignmentRequestBody Update the points cost for the reward assignment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateRewardAssignment1AsyncWithHttpInfo($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment1'][0]) + { + $returnType = '\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBody'; + $request = $this->updateRewardAssignment1Request($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody, $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 'updateRewardAssignment1' + * + * @param string $campaignId The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBody $loyaltiesRewardsUpdateAssignmentRequestBody Update the points cost for the reward assignment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRewardAssignment1Request($campaignId, $assignmentId, $loyaltiesRewardsUpdateAssignmentRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment1'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateRewardAssignment1' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling updateRewardAssignment1' + ); + } + + + + $resourcePath = '/v1/loyalties/{campaignId}/rewards/{assignmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($loyaltiesRewardsUpdateAssignmentRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($loyaltiesRewardsUpdateAssignmentRequestBody)); + } else { + $httpBody = $loyaltiesRewardsUpdateAssignmentRequestBody; + } + } 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( + 'PUT', + $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/Api/OrdersApi.php b/src/Api/OrdersApi.php new file mode 100644 index 0000000..9d100d0 --- /dev/null +++ b/src/Api/OrdersApi.php @@ -0,0 +1,1946 @@ + [ + 'application/json', + ], + 'createOrderExport' => [ + 'application/json', + ], + 'getOrder' => [ + 'application/json', + ], + 'importOrders' => [ + 'application/json', + ], + 'listOrders' => [ + 'application/json', + ], + 'updateOrder' => [ + '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 createOrder + * + * Create Order + * + * @param \OpenAPI\Client\Model\OrdersCreateRequestBody $ordersCreateRequestBody Specify the order parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\OrdersCreateResponseBody + */ + public function createOrder($ordersCreateRequestBody = null, string $contentType = self::contentTypes['createOrder'][0]) + { + list($response) = $this->createOrderWithHttpInfo($ordersCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createOrderWithHttpInfo + * + * Create Order + * + * @param \OpenAPI\Client\Model\OrdersCreateRequestBody $ordersCreateRequestBody Specify the order parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\OrdersCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createOrderWithHttpInfo($ordersCreateRequestBody = null, string $contentType = self::contentTypes['createOrder'][0]) + { + $request = $this->createOrderRequest($ordersCreateRequestBody, $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\OrdersCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\OrdersCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OrdersCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\OrdersCreateResponseBody'; + 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\OrdersCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createOrderAsync + * + * Create Order + * + * @param \OpenAPI\Client\Model\OrdersCreateRequestBody $ordersCreateRequestBody Specify the order parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createOrderAsync($ordersCreateRequestBody = null, string $contentType = self::contentTypes['createOrder'][0]) + { + return $this->createOrderAsyncWithHttpInfo($ordersCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createOrderAsyncWithHttpInfo + * + * Create Order + * + * @param \OpenAPI\Client\Model\OrdersCreateRequestBody $ordersCreateRequestBody Specify the order parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createOrderAsyncWithHttpInfo($ordersCreateRequestBody = null, string $contentType = self::contentTypes['createOrder'][0]) + { + $returnType = '\OpenAPI\Client\Model\OrdersCreateResponseBody'; + $request = $this->createOrderRequest($ordersCreateRequestBody, $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 'createOrder' + * + * @param \OpenAPI\Client\Model\OrdersCreateRequestBody $ordersCreateRequestBody Specify the order parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createOrderRequest($ordersCreateRequestBody = null, string $contentType = self::contentTypes['createOrder'][0]) + { + + + + $resourcePath = '/v1/orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($ordersCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($ordersCreateRequestBody)); + } else { + $httpBody = $ordersCreateRequestBody; + } + } 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 createOrderExport + * + * Create Orders Export + * + * @param \OpenAPI\Client\Model\OrdersExportCreateRequestBody $ordersExportCreateRequestBody Specify which order parameters you would like to export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrderExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\OrdersExportCreateResponseBody + */ + public function createOrderExport($ordersExportCreateRequestBody = null, string $contentType = self::contentTypes['createOrderExport'][0]) + { + list($response) = $this->createOrderExportWithHttpInfo($ordersExportCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createOrderExportWithHttpInfo + * + * Create Orders Export + * + * @param \OpenAPI\Client\Model\OrdersExportCreateRequestBody $ordersExportCreateRequestBody Specify which order parameters you would like to export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrderExport'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\OrdersExportCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createOrderExportWithHttpInfo($ordersExportCreateRequestBody = null, string $contentType = self::contentTypes['createOrderExport'][0]) + { + $request = $this->createOrderExportRequest($ordersExportCreateRequestBody, $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\OrdersExportCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\OrdersExportCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OrdersExportCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\OrdersExportCreateResponseBody'; + 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\OrdersExportCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createOrderExportAsync + * + * Create Orders Export + * + * @param \OpenAPI\Client\Model\OrdersExportCreateRequestBody $ordersExportCreateRequestBody Specify which order parameters you would like to export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrderExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createOrderExportAsync($ordersExportCreateRequestBody = null, string $contentType = self::contentTypes['createOrderExport'][0]) + { + return $this->createOrderExportAsyncWithHttpInfo($ordersExportCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createOrderExportAsyncWithHttpInfo + * + * Create Orders Export + * + * @param \OpenAPI\Client\Model\OrdersExportCreateRequestBody $ordersExportCreateRequestBody Specify which order parameters you would like to export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrderExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createOrderExportAsyncWithHttpInfo($ordersExportCreateRequestBody = null, string $contentType = self::contentTypes['createOrderExport'][0]) + { + $returnType = '\OpenAPI\Client\Model\OrdersExportCreateResponseBody'; + $request = $this->createOrderExportRequest($ordersExportCreateRequestBody, $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 'createOrderExport' + * + * @param \OpenAPI\Client\Model\OrdersExportCreateRequestBody $ordersExportCreateRequestBody Specify which order parameters you would like to export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createOrderExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createOrderExportRequest($ordersExportCreateRequestBody = null, string $contentType = self::contentTypes['createOrderExport'][0]) + { + + + + $resourcePath = '/v1/orders/export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($ordersExportCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($ordersExportCreateRequestBody)); + } else { + $httpBody = $ordersExportCreateRequestBody; + } + } 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 getOrder + * + * Get Order + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrder'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\OrdersGetResponseBody + */ + public function getOrder($orderId, string $contentType = self::contentTypes['getOrder'][0]) + { + list($response) = $this->getOrderWithHttpInfo($orderId, $contentType); + return $response; + } + + /** + * Operation getOrderWithHttpInfo + * + * Get Order + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrder'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\OrdersGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrderWithHttpInfo($orderId, string $contentType = self::contentTypes['getOrder'][0]) + { + $request = $this->getOrderRequest($orderId, $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\OrdersGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\OrdersGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OrdersGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\OrdersGetResponseBody'; + 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\OrdersGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOrderAsync + * + * Get Order + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrderAsync($orderId, string $contentType = self::contentTypes['getOrder'][0]) + { + return $this->getOrderAsyncWithHttpInfo($orderId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrderAsyncWithHttpInfo + * + * Get Order + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrderAsyncWithHttpInfo($orderId, string $contentType = self::contentTypes['getOrder'][0]) + { + $returnType = '\OpenAPI\Client\Model\OrdersGetResponseBody'; + $request = $this->getOrderRequest($orderId, $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 'getOrder' + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOrderRequest($orderId, string $contentType = self::contentTypes['getOrder'][0]) + { + + // verify the required parameter 'orderId' is set + if ($orderId === null || (is_array($orderId) && count($orderId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $orderId when calling getOrder' + ); + } + + + $resourcePath = '/v1/orders/{orderId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($orderId !== null) { + $resourcePath = str_replace( + '{' . 'orderId' . '}', + ObjectSerializer::toPathValue($orderId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation importOrders + * + * Import Orders + * + * @param \OpenAPI\Client\Model\OrdersImportCreateRequestBodyItem[] $ordersImportCreateRequestBodyItem The request body is sent in the form of an array of order objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOrders'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\OrdersImportCreateResponseBody + */ + public function importOrders($ordersImportCreateRequestBodyItem = null, string $contentType = self::contentTypes['importOrders'][0]) + { + list($response) = $this->importOrdersWithHttpInfo($ordersImportCreateRequestBodyItem, $contentType); + return $response; + } + + /** + * Operation importOrdersWithHttpInfo + * + * Import Orders + * + * @param \OpenAPI\Client\Model\OrdersImportCreateRequestBodyItem[] $ordersImportCreateRequestBodyItem The request body is sent in the form of an array of order objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOrders'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\OrdersImportCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function importOrdersWithHttpInfo($ordersImportCreateRequestBodyItem = null, string $contentType = self::contentTypes['importOrders'][0]) + { + $request = $this->importOrdersRequest($ordersImportCreateRequestBodyItem, $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\OrdersImportCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\OrdersImportCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OrdersImportCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\OrdersImportCreateResponseBody'; + 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\OrdersImportCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation importOrdersAsync + * + * Import Orders + * + * @param \OpenAPI\Client\Model\OrdersImportCreateRequestBodyItem[] $ordersImportCreateRequestBodyItem The request body is sent in the form of an array of order objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOrders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importOrdersAsync($ordersImportCreateRequestBodyItem = null, string $contentType = self::contentTypes['importOrders'][0]) + { + return $this->importOrdersAsyncWithHttpInfo($ordersImportCreateRequestBodyItem, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importOrdersAsyncWithHttpInfo + * + * Import Orders + * + * @param \OpenAPI\Client\Model\OrdersImportCreateRequestBodyItem[] $ordersImportCreateRequestBodyItem The request body is sent in the form of an array of order objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOrders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importOrdersAsyncWithHttpInfo($ordersImportCreateRequestBodyItem = null, string $contentType = self::contentTypes['importOrders'][0]) + { + $returnType = '\OpenAPI\Client\Model\OrdersImportCreateResponseBody'; + $request = $this->importOrdersRequest($ordersImportCreateRequestBodyItem, $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 'importOrders' + * + * @param \OpenAPI\Client\Model\OrdersImportCreateRequestBodyItem[] $ordersImportCreateRequestBodyItem The request body is sent in the form of an array of order objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importOrders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importOrdersRequest($ordersImportCreateRequestBodyItem = null, string $contentType = self::contentTypes['importOrders'][0]) + { + + + + $resourcePath = '/v1/orders/import'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($ordersImportCreateRequestBodyItem)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($ordersImportCreateRequestBodyItem)); + } else { + $httpBody = $ordersImportCreateRequestBodyItem; + } + } 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 listOrders + * + * List Orders + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListOrders $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrders'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\OrdersListResponseBody + */ + public function listOrders($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listOrders'][0]) + { + list($response) = $this->listOrdersWithHttpInfo($limit, $page, $order, $contentType); + return $response; + } + + /** + * Operation listOrdersWithHttpInfo + * + * List Orders + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListOrders $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrders'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\OrdersListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listOrdersWithHttpInfo($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listOrders'][0]) + { + $request = $this->listOrdersRequest($limit, $page, $order, $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\OrdersListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\OrdersListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OrdersListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\OrdersListResponseBody'; + 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\OrdersListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listOrdersAsync + * + * List Orders + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListOrders $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOrdersAsync($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listOrders'][0]) + { + return $this->listOrdersAsyncWithHttpInfo($limit, $page, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listOrdersAsyncWithHttpInfo + * + * List Orders + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListOrders $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listOrdersAsyncWithHttpInfo($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listOrders'][0]) + { + $returnType = '\OpenAPI\Client\Model\OrdersListResponseBody'; + $request = $this->listOrdersRequest($limit, $page, $order, $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 'listOrders' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListOrders $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOrders'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listOrdersRequest($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listOrders'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OrdersApi.listOrders, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling OrdersApi.listOrders, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling OrdersApi.listOrders, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling OrdersApi.listOrders, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/orders'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListOrders', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateOrder + * + * Update Order + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param \OpenAPI\Client\Model\OrdersUpdateRequestBody $ordersUpdateRequestBody Specify the parameters of the order that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrder'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\OrdersUpdateResponseBody + */ + public function updateOrder($orderId, $ordersUpdateRequestBody = null, string $contentType = self::contentTypes['updateOrder'][0]) + { + list($response) = $this->updateOrderWithHttpInfo($orderId, $ordersUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateOrderWithHttpInfo + * + * Update Order + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param \OpenAPI\Client\Model\OrdersUpdateRequestBody $ordersUpdateRequestBody Specify the parameters of the order that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrder'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\OrdersUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateOrderWithHttpInfo($orderId, $ordersUpdateRequestBody = null, string $contentType = self::contentTypes['updateOrder'][0]) + { + $request = $this->updateOrderRequest($orderId, $ordersUpdateRequestBody, $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\OrdersUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\OrdersUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OrdersUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\OrdersUpdateResponseBody'; + 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\OrdersUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateOrderAsync + * + * Update Order + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param \OpenAPI\Client\Model\OrdersUpdateRequestBody $ordersUpdateRequestBody Specify the parameters of the order that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateOrderAsync($orderId, $ordersUpdateRequestBody = null, string $contentType = self::contentTypes['updateOrder'][0]) + { + return $this->updateOrderAsyncWithHttpInfo($orderId, $ordersUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateOrderAsyncWithHttpInfo + * + * Update Order + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param \OpenAPI\Client\Model\OrdersUpdateRequestBody $ordersUpdateRequestBody Specify the parameters of the order that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateOrderAsyncWithHttpInfo($orderId, $ordersUpdateRequestBody = null, string $contentType = self::contentTypes['updateOrder'][0]) + { + $returnType = '\OpenAPI\Client\Model\OrdersUpdateResponseBody'; + $request = $this->updateOrderRequest($orderId, $ordersUpdateRequestBody, $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 'updateOrder' + * + * @param string $orderId Unique Voucherify order ID or order source ID. (required) + * @param \OpenAPI\Client\Model\OrdersUpdateRequestBody $ordersUpdateRequestBody Specify the parameters of the order that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateOrder'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateOrderRequest($orderId, $ordersUpdateRequestBody = null, string $contentType = self::contentTypes['updateOrder'][0]) + { + + // verify the required parameter 'orderId' is set + if ($orderId === null || (is_array($orderId) && count($orderId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $orderId when calling updateOrder' + ); + } + + + + $resourcePath = '/v1/orders/{orderId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($orderId !== null) { + $resourcePath = str_replace( + '{' . 'orderId' . '}', + ObjectSerializer::toPathValue($orderId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($ordersUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($ordersUpdateRequestBody)); + } else { + $httpBody = $ordersUpdateRequestBody; + } + } 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( + 'PUT', + $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/Api/ProductCollectionsApi.php b/src/Api/ProductCollectionsApi.php new file mode 100644 index 0000000..f6a9c5c --- /dev/null +++ b/src/Api/ProductCollectionsApi.php @@ -0,0 +1,1669 @@ + [ + 'application/json', + ], + 'deleteProductCollection' => [ + 'application/json', + ], + 'getProductCollection' => [ + 'application/json', + ], + 'listProductCollections' => [ + 'application/json', + ], + 'listProductsInCollection' => [ + '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 createProductCollection + * + * Create Product Collection + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateRequestBody $productCollectionsCreateRequestBody productCollectionsCreateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProductCollection'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductCollectionsCreateResponseBody + */ + public function createProductCollection($productCollectionsCreateRequestBody = null, string $contentType = self::contentTypes['createProductCollection'][0]) + { + list($response) = $this->createProductCollectionWithHttpInfo($productCollectionsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createProductCollectionWithHttpInfo + * + * Create Product Collection + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateRequestBody $productCollectionsCreateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProductCollection'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductCollectionsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createProductCollectionWithHttpInfo($productCollectionsCreateRequestBody = null, string $contentType = self::contentTypes['createProductCollection'][0]) + { + $request = $this->createProductCollectionRequest($productCollectionsCreateRequestBody, $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\ProductCollectionsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductCollectionsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductCollectionsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductCollectionsCreateResponseBody'; + 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\ProductCollectionsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createProductCollectionAsync + * + * Create Product Collection + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateRequestBody $productCollectionsCreateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createProductCollectionAsync($productCollectionsCreateRequestBody = null, string $contentType = self::contentTypes['createProductCollection'][0]) + { + return $this->createProductCollectionAsyncWithHttpInfo($productCollectionsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createProductCollectionAsyncWithHttpInfo + * + * Create Product Collection + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateRequestBody $productCollectionsCreateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createProductCollectionAsyncWithHttpInfo($productCollectionsCreateRequestBody = null, string $contentType = self::contentTypes['createProductCollection'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductCollectionsCreateResponseBody'; + $request = $this->createProductCollectionRequest($productCollectionsCreateRequestBody, $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 'createProductCollection' + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateRequestBody $productCollectionsCreateRequestBody (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createProductCollectionRequest($productCollectionsCreateRequestBody = null, string $contentType = self::contentTypes['createProductCollection'][0]) + { + + + + $resourcePath = '/v1/product-collections'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($productCollectionsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($productCollectionsCreateRequestBody)); + } else { + $httpBody = $productCollectionsCreateRequestBody; + } + } 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 deleteProductCollection + * + * Delete Product Collection + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProductCollection'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteProductCollection($productCollectionId, string $contentType = self::contentTypes['deleteProductCollection'][0]) + { + $this->deleteProductCollectionWithHttpInfo($productCollectionId, $contentType); + } + + /** + * Operation deleteProductCollectionWithHttpInfo + * + * Delete Product Collection + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProductCollection'] 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 deleteProductCollectionWithHttpInfo($productCollectionId, string $contentType = self::contentTypes['deleteProductCollection'][0]) + { + $request = $this->deleteProductCollectionRequest($productCollectionId, $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 deleteProductCollectionAsync + * + * Delete Product Collection + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteProductCollectionAsync($productCollectionId, string $contentType = self::contentTypes['deleteProductCollection'][0]) + { + return $this->deleteProductCollectionAsyncWithHttpInfo($productCollectionId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProductCollectionAsyncWithHttpInfo + * + * Delete Product Collection + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteProductCollectionAsyncWithHttpInfo($productCollectionId, string $contentType = self::contentTypes['deleteProductCollection'][0]) + { + $returnType = ''; + $request = $this->deleteProductCollectionRequest($productCollectionId, $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 'deleteProductCollection' + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteProductCollectionRequest($productCollectionId, string $contentType = self::contentTypes['deleteProductCollection'][0]) + { + + // verify the required parameter 'productCollectionId' is set + if ($productCollectionId === null || (is_array($productCollectionId) && count($productCollectionId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productCollectionId when calling deleteProductCollection' + ); + } + + + $resourcePath = '/v1/product-collections/{productCollectionId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($productCollectionId !== null) { + $resourcePath = str_replace( + '{' . 'productCollectionId' . '}', + ObjectSerializer::toPathValue($productCollectionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getProductCollection + * + * Get Product Collection + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductCollection'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductCollectionsGetResponseBody + */ + public function getProductCollection($productCollectionId, string $contentType = self::contentTypes['getProductCollection'][0]) + { + list($response) = $this->getProductCollectionWithHttpInfo($productCollectionId, $contentType); + return $response; + } + + /** + * Operation getProductCollectionWithHttpInfo + * + * Get Product Collection + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductCollection'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductCollectionsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getProductCollectionWithHttpInfo($productCollectionId, string $contentType = self::contentTypes['getProductCollection'][0]) + { + $request = $this->getProductCollectionRequest($productCollectionId, $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\ProductCollectionsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductCollectionsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductCollectionsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductCollectionsGetResponseBody'; + 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\ProductCollectionsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProductCollectionAsync + * + * Get Product Collection + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProductCollectionAsync($productCollectionId, string $contentType = self::contentTypes['getProductCollection'][0]) + { + return $this->getProductCollectionAsyncWithHttpInfo($productCollectionId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProductCollectionAsyncWithHttpInfo + * + * Get Product Collection + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProductCollectionAsyncWithHttpInfo($productCollectionId, string $contentType = self::contentTypes['getProductCollection'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductCollectionsGetResponseBody'; + $request = $this->getProductCollectionRequest($productCollectionId, $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 'getProductCollection' + * + * @param string $productCollectionId A unique product collection ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProductCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getProductCollectionRequest($productCollectionId, string $contentType = self::contentTypes['getProductCollection'][0]) + { + + // verify the required parameter 'productCollectionId' is set + if ($productCollectionId === null || (is_array($productCollectionId) && count($productCollectionId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productCollectionId when calling getProductCollection' + ); + } + + + $resourcePath = '/v1/product-collections/{productCollectionId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($productCollectionId !== null) { + $resourcePath = str_replace( + '{' . 'productCollectionId' . '}', + ObjectSerializer::toPathValue($productCollectionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listProductCollections + * + * List Product Collections + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductCollections'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductCollectionsListResponseBody + */ + public function listProductCollections($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listProductCollections'][0]) + { + list($response) = $this->listProductCollectionsWithHttpInfo($limit, $page, $order, $contentType); + return $response; + } + + /** + * Operation listProductCollectionsWithHttpInfo + * + * List Product Collections + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductCollections'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductCollectionsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listProductCollectionsWithHttpInfo($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listProductCollections'][0]) + { + $request = $this->listProductCollectionsRequest($limit, $page, $order, $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\ProductCollectionsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductCollectionsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductCollectionsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductCollectionsListResponseBody'; + 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\ProductCollectionsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listProductCollectionsAsync + * + * List Product Collections + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductCollections'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listProductCollectionsAsync($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listProductCollections'][0]) + { + return $this->listProductCollectionsAsyncWithHttpInfo($limit, $page, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listProductCollectionsAsyncWithHttpInfo + * + * List Product Collections + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductCollections'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listProductCollectionsAsyncWithHttpInfo($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listProductCollections'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductCollectionsListResponseBody'; + $request = $this->listProductCollectionsRequest($limit, $page, $order, $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 'listProductCollections' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductCollections'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listProductCollectionsRequest($limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listProductCollections'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductCollectionsApi.listProductCollections, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductCollectionsApi.listProductCollections, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ProductCollectionsApi.listProductCollections, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ProductCollectionsApi.listProductCollections, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/product-collections'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrder', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listProductsInCollection + * + * List Products in Collection + * + * @param string $productCollectionId Unique product collection ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductsInCollection'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductCollectionsProductsListResponseBody + */ + public function listProductsInCollection($productCollectionId, $limit = null, $page = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listProductsInCollection'][0]) + { + list($response) = $this->listProductsInCollectionWithHttpInfo($productCollectionId, $limit, $page, $order, $startingAfter, $contentType); + return $response; + } + + /** + * Operation listProductsInCollectionWithHttpInfo + * + * List Products in Collection + * + * @param string $productCollectionId Unique product collection ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductsInCollection'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductCollectionsProductsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listProductsInCollectionWithHttpInfo($productCollectionId, $limit = null, $page = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listProductsInCollection'][0]) + { + $request = $this->listProductsInCollectionRequest($productCollectionId, $limit, $page, $order, $startingAfter, $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\ProductCollectionsProductsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductCollectionsProductsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductCollectionsProductsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductCollectionsProductsListResponseBody'; + 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\ProductCollectionsProductsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listProductsInCollectionAsync + * + * List Products in Collection + * + * @param string $productCollectionId Unique product collection ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductsInCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listProductsInCollectionAsync($productCollectionId, $limit = null, $page = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listProductsInCollection'][0]) + { + return $this->listProductsInCollectionAsyncWithHttpInfo($productCollectionId, $limit, $page, $order, $startingAfter, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listProductsInCollectionAsyncWithHttpInfo + * + * List Products in Collection + * + * @param string $productCollectionId Unique product collection ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductsInCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listProductsInCollectionAsyncWithHttpInfo($productCollectionId, $limit = null, $page = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listProductsInCollection'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductCollectionsProductsListResponseBody'; + $request = $this->listProductsInCollectionRequest($productCollectionId, $limit, $page, $order, $startingAfter, $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 'listProductsInCollection' + * + * @param string $productCollectionId Unique product collection ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startingAfter Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProductsInCollection'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listProductsInCollectionRequest($productCollectionId, $limit = null, $page = null, $order = null, $startingAfter = null, string $contentType = self::contentTypes['listProductsInCollection'][0]) + { + + // verify the required parameter 'productCollectionId' is set + if ($productCollectionId === null || (is_array($productCollectionId) && count($productCollectionId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productCollectionId when calling listProductsInCollection' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductCollectionsApi.listProductsInCollection, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductCollectionsApi.listProductsInCollection, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ProductCollectionsApi.listProductsInCollection, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ProductCollectionsApi.listProductsInCollection, must be bigger than or equal to 1.'); + } + + + + + $resourcePath = '/v1/product-collections/{productCollectionId}/products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrder', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startingAfter, + 'starting_after', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($productCollectionId !== null) { + $resourcePath = str_replace( + '{' . 'productCollectionId' . '}', + ObjectSerializer::toPathValue($productCollectionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $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/Api/ProductsApi.php b/src/Api/ProductsApi.php new file mode 100644 index 0000000..5d0ad6f --- /dev/null +++ b/src/Api/ProductsApi.php @@ -0,0 +1,4415 @@ + [ + 'application/json', + ], + 'createSku' => [ + 'application/json', + ], + 'deleteProduct' => [ + 'application/json', + ], + 'deleteSku' => [ + 'application/json', + ], + 'getProduct' => [ + 'application/json', + ], + 'getSku' => [ + 'application/json', + ], + 'importProductsUsingCsv' => [ + 'multipart/form-data', + ], + 'importSkusUsingCsv' => [ + 'multipart/form-data', + ], + 'listProducts' => [ + 'application/json', + ], + 'listSkusInProduct' => [ + 'application/json', + ], + 'updateProduct' => [ + 'application/json', + ], + 'updateProductsInBulk' => [ + 'application/json', + ], + 'updateProductsMetadataInBulk' => [ + 'application/json', + ], + 'updateSku' => [ + '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 createProduct + * + * Create Product + * + * @param \OpenAPI\Client\Model\ProductsCreateRequestBody $productsCreateRequestBody Specify the product parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsCreateResponseBody + */ + public function createProduct($productsCreateRequestBody = null, string $contentType = self::contentTypes['createProduct'][0]) + { + list($response) = $this->createProductWithHttpInfo($productsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createProductWithHttpInfo + * + * Create Product + * + * @param \OpenAPI\Client\Model\ProductsCreateRequestBody $productsCreateRequestBody Specify the product parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createProductWithHttpInfo($productsCreateRequestBody = null, string $contentType = self::contentTypes['createProduct'][0]) + { + $request = $this->createProductRequest($productsCreateRequestBody, $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\ProductsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsCreateResponseBody'; + 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\ProductsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createProductAsync + * + * Create Product + * + * @param \OpenAPI\Client\Model\ProductsCreateRequestBody $productsCreateRequestBody Specify the product parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createProductAsync($productsCreateRequestBody = null, string $contentType = self::contentTypes['createProduct'][0]) + { + return $this->createProductAsyncWithHttpInfo($productsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createProductAsyncWithHttpInfo + * + * Create Product + * + * @param \OpenAPI\Client\Model\ProductsCreateRequestBody $productsCreateRequestBody Specify the product parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createProductAsyncWithHttpInfo($productsCreateRequestBody = null, string $contentType = self::contentTypes['createProduct'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsCreateResponseBody'; + $request = $this->createProductRequest($productsCreateRequestBody, $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 'createProduct' + * + * @param \OpenAPI\Client\Model\ProductsCreateRequestBody $productsCreateRequestBody Specify the product parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createProductRequest($productsCreateRequestBody = null, string $contentType = self::contentTypes['createProduct'][0]) + { + + + + $resourcePath = '/v1/products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($productsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($productsCreateRequestBody)); + } else { + $httpBody = $productsCreateRequestBody; + } + } 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 createSku + * + * Create SKU + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusCreateRequestBody $productsSkusCreateRequestBody Specify the SKU parameters to be created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSku'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsSkusCreateResponseBody + */ + public function createSku($productId, $productsSkusCreateRequestBody = null, string $contentType = self::contentTypes['createSku'][0]) + { + list($response) = $this->createSkuWithHttpInfo($productId, $productsSkusCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createSkuWithHttpInfo + * + * Create SKU + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusCreateRequestBody $productsSkusCreateRequestBody Specify the SKU parameters to be created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSku'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsSkusCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createSkuWithHttpInfo($productId, $productsSkusCreateRequestBody = null, string $contentType = self::contentTypes['createSku'][0]) + { + $request = $this->createSkuRequest($productId, $productsSkusCreateRequestBody, $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\ProductsSkusCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsSkusCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsSkusCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsSkusCreateResponseBody'; + 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\ProductsSkusCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createSkuAsync + * + * Create SKU + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusCreateRequestBody $productsSkusCreateRequestBody Specify the SKU parameters to be created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSkuAsync($productId, $productsSkusCreateRequestBody = null, string $contentType = self::contentTypes['createSku'][0]) + { + return $this->createSkuAsyncWithHttpInfo($productId, $productsSkusCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSkuAsyncWithHttpInfo + * + * Create SKU + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusCreateRequestBody $productsSkusCreateRequestBody Specify the SKU parameters to be created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSkuAsyncWithHttpInfo($productId, $productsSkusCreateRequestBody = null, string $contentType = self::contentTypes['createSku'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsSkusCreateResponseBody'; + $request = $this->createSkuRequest($productId, $productsSkusCreateRequestBody, $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 'createSku' + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusCreateRequestBody $productsSkusCreateRequestBody Specify the SKU parameters to be created. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createSkuRequest($productId, $productsSkusCreateRequestBody = null, string $contentType = self::contentTypes['createSku'][0]) + { + + // verify the required parameter 'productId' is set + if ($productId === null || (is_array($productId) && count($productId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productId when calling createSku' + ); + } + + + + $resourcePath = '/v1/products/{productId}/skus'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($productId !== null) { + $resourcePath = str_replace( + '{' . 'productId' . '}', + ObjectSerializer::toPathValue($productId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($productsSkusCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($productsSkusCreateRequestBody)); + } else { + $httpBody = $productsSkusCreateRequestBody; + } + } 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 deleteProduct + * + * Delete Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param bool $force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteProduct($productId, $force = null, string $contentType = self::contentTypes['deleteProduct'][0]) + { + $this->deleteProductWithHttpInfo($productId, $force, $contentType); + } + + /** + * Operation deleteProductWithHttpInfo + * + * Delete Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param bool $force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] 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 deleteProductWithHttpInfo($productId, $force = null, string $contentType = self::contentTypes['deleteProduct'][0]) + { + $request = $this->deleteProductRequest($productId, $force, $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 deleteProductAsync + * + * Delete Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param bool $force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteProductAsync($productId, $force = null, string $contentType = self::contentTypes['deleteProduct'][0]) + { + return $this->deleteProductAsyncWithHttpInfo($productId, $force, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProductAsyncWithHttpInfo + * + * Delete Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param bool $force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteProductAsyncWithHttpInfo($productId, $force = null, string $contentType = self::contentTypes['deleteProduct'][0]) + { + $returnType = ''; + $request = $this->deleteProductRequest($productId, $force, $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 'deleteProduct' + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param bool $force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteProductRequest($productId, $force = null, string $contentType = self::contentTypes['deleteProduct'][0]) + { + + // verify the required parameter 'productId' is set + if ($productId === null || (is_array($productId) && count($productId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productId when calling deleteProduct' + ); + } + + + + $resourcePath = '/v1/products/{productId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $force, + 'force', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($productId !== null) { + $resourcePath = str_replace( + '{' . 'productId' . '}', + ObjectSerializer::toPathValue($productId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSku + * + * Delete SKU + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param bool $force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSku'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSku($productId, $skuId, $force = null, string $contentType = self::contentTypes['deleteSku'][0]) + { + $this->deleteSkuWithHttpInfo($productId, $skuId, $force, $contentType); + } + + /** + * Operation deleteSkuWithHttpInfo + * + * Delete SKU + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param bool $force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSku'] 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 deleteSkuWithHttpInfo($productId, $skuId, $force = null, string $contentType = self::contentTypes['deleteSku'][0]) + { + $request = $this->deleteSkuRequest($productId, $skuId, $force, $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 deleteSkuAsync + * + * Delete SKU + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param bool $force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSkuAsync($productId, $skuId, $force = null, string $contentType = self::contentTypes['deleteSku'][0]) + { + return $this->deleteSkuAsyncWithHttpInfo($productId, $skuId, $force, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSkuAsyncWithHttpInfo + * + * Delete SKU + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param bool $force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSkuAsyncWithHttpInfo($productId, $skuId, $force = null, string $contentType = self::contentTypes['deleteSku'][0]) + { + $returnType = ''; + $request = $this->deleteSkuRequest($productId, $skuId, $force, $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 'deleteSku' + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param bool $force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSkuRequest($productId, $skuId, $force = null, string $contentType = self::contentTypes['deleteSku'][0]) + { + + // verify the required parameter 'productId' is set + if ($productId === null || (is_array($productId) && count($productId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productId when calling deleteSku' + ); + } + + // verify the required parameter 'skuId' is set + if ($skuId === null || (is_array($skuId) && count($skuId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $skuId when calling deleteSku' + ); + } + + + + $resourcePath = '/v1/products/{productId}/skus/{skuId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $force, + 'force', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($productId !== null) { + $resourcePath = str_replace( + '{' . 'productId' . '}', + ObjectSerializer::toPathValue($productId), + $resourcePath + ); + } + // path params + if ($skuId !== null) { + $resourcePath = str_replace( + '{' . 'skuId' . '}', + ObjectSerializer::toPathValue($skuId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getProduct + * + * Get Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsGetResponseBody + */ + public function getProduct($productId, string $contentType = self::contentTypes['getProduct'][0]) + { + list($response) = $this->getProductWithHttpInfo($productId, $contentType); + return $response; + } + + /** + * Operation getProductWithHttpInfo + * + * Get Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getProductWithHttpInfo($productId, string $contentType = self::contentTypes['getProduct'][0]) + { + $request = $this->getProductRequest($productId, $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\ProductsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsGetResponseBody'; + 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\ProductsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProductAsync + * + * Get Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProductAsync($productId, string $contentType = self::contentTypes['getProduct'][0]) + { + return $this->getProductAsyncWithHttpInfo($productId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProductAsyncWithHttpInfo + * + * Get Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProductAsyncWithHttpInfo($productId, string $contentType = self::contentTypes['getProduct'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsGetResponseBody'; + $request = $this->getProductRequest($productId, $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 'getProduct' + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getProductRequest($productId, string $contentType = self::contentTypes['getProduct'][0]) + { + + // verify the required parameter 'productId' is set + if ($productId === null || (is_array($productId) && count($productId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productId when calling getProduct' + ); + } + + + $resourcePath = '/v1/products/{productId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($productId !== null) { + $resourcePath = str_replace( + '{' . 'productId' . '}', + ObjectSerializer::toPathValue($productId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSku + * + * Get SKU + * + * @param string $skuId A Voucherify SKU identifier or SKU source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSku'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\SkusGetResponseBody + */ + public function getSku($skuId, string $contentType = self::contentTypes['getSku'][0]) + { + list($response) = $this->getSkuWithHttpInfo($skuId, $contentType); + return $response; + } + + /** + * Operation getSkuWithHttpInfo + * + * Get SKU + * + * @param string $skuId A Voucherify SKU identifier or SKU source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSku'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\SkusGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getSkuWithHttpInfo($skuId, string $contentType = self::contentTypes['getSku'][0]) + { + $request = $this->getSkuRequest($skuId, $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\SkusGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SkusGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SkusGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SkusGetResponseBody'; + 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\SkusGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSkuAsync + * + * Get SKU + * + * @param string $skuId A Voucherify SKU identifier or SKU source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSkuAsync($skuId, string $contentType = self::contentTypes['getSku'][0]) + { + return $this->getSkuAsyncWithHttpInfo($skuId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSkuAsyncWithHttpInfo + * + * Get SKU + * + * @param string $skuId A Voucherify SKU identifier or SKU source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSkuAsyncWithHttpInfo($skuId, string $contentType = self::contentTypes['getSku'][0]) + { + $returnType = '\OpenAPI\Client\Model\SkusGetResponseBody'; + $request = $this->getSkuRequest($skuId, $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 'getSku' + * + * @param string $skuId A Voucherify SKU identifier or SKU source ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSkuRequest($skuId, string $contentType = self::contentTypes['getSku'][0]) + { + + // verify the required parameter 'skuId' is set + if ($skuId === null || (is_array($skuId) && count($skuId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $skuId when calling getSku' + ); + } + + + $resourcePath = '/v1/skus/{skuId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($skuId !== null) { + $resourcePath = str_replace( + '{' . 'skuId' . '}', + ObjectSerializer::toPathValue($skuId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation importProductsUsingCsv + * + * Import Products using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importProductsUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsImportCsvCreateResponseBody + */ + public function importProductsUsingCsv($file = null, string $contentType = self::contentTypes['importProductsUsingCsv'][0]) + { + list($response) = $this->importProductsUsingCsvWithHttpInfo($file, $contentType); + return $response; + } + + /** + * Operation importProductsUsingCsvWithHttpInfo + * + * Import Products using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importProductsUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsImportCsvCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function importProductsUsingCsvWithHttpInfo($file = null, string $contentType = self::contentTypes['importProductsUsingCsv'][0]) + { + $request = $this->importProductsUsingCsvRequest($file, $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\ProductsImportCsvCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsImportCsvCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsImportCsvCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsImportCsvCreateResponseBody'; + 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\ProductsImportCsvCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation importProductsUsingCsvAsync + * + * Import Products using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importProductsUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importProductsUsingCsvAsync($file = null, string $contentType = self::contentTypes['importProductsUsingCsv'][0]) + { + return $this->importProductsUsingCsvAsyncWithHttpInfo($file, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importProductsUsingCsvAsyncWithHttpInfo + * + * Import Products using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importProductsUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importProductsUsingCsvAsyncWithHttpInfo($file = null, string $contentType = self::contentTypes['importProductsUsingCsv'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsImportCsvCreateResponseBody'; + $request = $this->importProductsUsingCsvRequest($file, $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 'importProductsUsingCsv' + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importProductsUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importProductsUsingCsvRequest($file = null, string $contentType = self::contentTypes['importProductsUsingCsv'][0]) + { + + + + $resourcePath = '/v1/products/importCSV'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // form params + if ($file !== null) { + $multipart = true; + $formParams['file'] = []; + $paramFiles = is_array($file) ? $file : [$file]; + foreach ($paramFiles as $paramFile) { + $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 importSkusUsingCsv + * + * Import SKUs using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importSkusUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\SkusImportCsvCreateResponseBody + */ + public function importSkusUsingCsv($file = null, string $contentType = self::contentTypes['importSkusUsingCsv'][0]) + { + list($response) = $this->importSkusUsingCsvWithHttpInfo($file, $contentType); + return $response; + } + + /** + * Operation importSkusUsingCsvWithHttpInfo + * + * Import SKUs using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importSkusUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\SkusImportCsvCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function importSkusUsingCsvWithHttpInfo($file = null, string $contentType = self::contentTypes['importSkusUsingCsv'][0]) + { + $request = $this->importSkusUsingCsvRequest($file, $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\SkusImportCsvCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SkusImportCsvCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SkusImportCsvCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SkusImportCsvCreateResponseBody'; + 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\SkusImportCsvCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation importSkusUsingCsvAsync + * + * Import SKUs using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importSkusUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importSkusUsingCsvAsync($file = null, string $contentType = self::contentTypes['importSkusUsingCsv'][0]) + { + return $this->importSkusUsingCsvAsyncWithHttpInfo($file, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importSkusUsingCsvAsyncWithHttpInfo + * + * Import SKUs using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importSkusUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importSkusUsingCsvAsyncWithHttpInfo($file = null, string $contentType = self::contentTypes['importSkusUsingCsv'][0]) + { + $returnType = '\OpenAPI\Client\Model\SkusImportCsvCreateResponseBody'; + $request = $this->importSkusUsingCsvRequest($file, $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 'importSkusUsingCsv' + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importSkusUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importSkusUsingCsvRequest($file = null, string $contentType = self::contentTypes['importSkusUsingCsv'][0]) + { + + + + $resourcePath = '/v1/skus/importCSV'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // form params + if ($file !== null) { + $multipart = true; + $formParams['file'] = []; + $paramFiles = is_array($file) ? $file : [$file]; + foreach ($paramFiles as $paramFile) { + $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 listProducts + * + * List Products + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProducts'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsListResponseBody + */ + public function listProducts($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listProducts'][0]) + { + list($response) = $this->listProductsWithHttpInfo($limit, $page, $order, $startDate, $endDate, $contentType); + return $response; + } + + /** + * Operation listProductsWithHttpInfo + * + * List Products + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProducts'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listProductsWithHttpInfo($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listProducts'][0]) + { + $request = $this->listProductsRequest($limit, $page, $order, $startDate, $endDate, $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\ProductsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsListResponseBody'; + 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\ProductsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listProductsAsync + * + * List Products + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProducts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listProductsAsync($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listProducts'][0]) + { + return $this->listProductsAsyncWithHttpInfo($limit, $page, $order, $startDate, $endDate, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listProductsAsyncWithHttpInfo + * + * List Products + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProducts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listProductsAsyncWithHttpInfo($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listProducts'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsListResponseBody'; + $request = $this->listProductsRequest($limit, $page, $order, $startDate, $endDate, $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 'listProducts' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProducts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listProductsRequest($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listProducts'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductsApi.listProducts, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductsApi.listProducts, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ProductsApi.listProducts, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ProductsApi.listProducts, must be bigger than or equal to 1.'); + } + + + + + + $resourcePath = '/v1/products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrder', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listSkusInProduct + * + * List SKUs in Product + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSkusInProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsSkusListResponseBody + */ + public function listSkusInProduct($productId, $limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listSkusInProduct'][0]) + { + list($response) = $this->listSkusInProductWithHttpInfo($productId, $limit, $page, $order, $startDate, $endDate, $contentType); + return $response; + } + + /** + * Operation listSkusInProductWithHttpInfo + * + * List SKUs in Product + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSkusInProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsSkusListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listSkusInProductWithHttpInfo($productId, $limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listSkusInProduct'][0]) + { + $request = $this->listSkusInProductRequest($productId, $limit, $page, $order, $startDate, $endDate, $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\ProductsSkusListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsSkusListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsSkusListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsSkusListResponseBody'; + 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\ProductsSkusListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listSkusInProductAsync + * + * List SKUs in Product + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSkusInProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSkusInProductAsync($productId, $limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listSkusInProduct'][0]) + { + return $this->listSkusInProductAsyncWithHttpInfo($productId, $limit, $page, $order, $startDate, $endDate, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listSkusInProductAsyncWithHttpInfo + * + * List SKUs in Product + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSkusInProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listSkusInProductAsyncWithHttpInfo($productId, $limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listSkusInProduct'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsSkusListResponseBody'; + $request = $this->listSkusInProductRequest($productId, $limit, $page, $order, $startDate, $endDate, $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 'listSkusInProduct' + * + * @param string $productId A Voucherify product ID or product source ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSkusInProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listSkusInProductRequest($productId, $limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listSkusInProduct'][0]) + { + + // verify the required parameter 'productId' is set + if ($productId === null || (is_array($productId) && count($productId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productId when calling listSkusInProduct' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductsApi.listSkusInProduct, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ProductsApi.listSkusInProduct, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ProductsApi.listSkusInProduct, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ProductsApi.listSkusInProduct, must be bigger than or equal to 1.'); + } + + + + + + $resourcePath = '/v1/products/{productId}/skus'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrder', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($productId !== null) { + $resourcePath = str_replace( + '{' . 'productId' . '}', + ObjectSerializer::toPathValue($productId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateProduct + * + * Update Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param \OpenAPI\Client\Model\ProductsUpdateRequestBody $productsUpdateRequestBody Specify the parameters of the product that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsUpdateResponseBody + */ + public function updateProduct($productId, $productsUpdateRequestBody = null, string $contentType = self::contentTypes['updateProduct'][0]) + { + list($response) = $this->updateProductWithHttpInfo($productId, $productsUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateProductWithHttpInfo + * + * Update Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param \OpenAPI\Client\Model\ProductsUpdateRequestBody $productsUpdateRequestBody Specify the parameters of the product that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProductWithHttpInfo($productId, $productsUpdateRequestBody = null, string $contentType = self::contentTypes['updateProduct'][0]) + { + $request = $this->updateProductRequest($productId, $productsUpdateRequestBody, $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\ProductsUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsUpdateResponseBody'; + 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\ProductsUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProductAsync + * + * Update Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param \OpenAPI\Client\Model\ProductsUpdateRequestBody $productsUpdateRequestBody Specify the parameters of the product that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProductAsync($productId, $productsUpdateRequestBody = null, string $contentType = self::contentTypes['updateProduct'][0]) + { + return $this->updateProductAsyncWithHttpInfo($productId, $productsUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProductAsyncWithHttpInfo + * + * Update Product + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param \OpenAPI\Client\Model\ProductsUpdateRequestBody $productsUpdateRequestBody Specify the parameters of the product that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProductAsyncWithHttpInfo($productId, $productsUpdateRequestBody = null, string $contentType = self::contentTypes['updateProduct'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsUpdateResponseBody'; + $request = $this->updateProductRequest($productId, $productsUpdateRequestBody, $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 'updateProduct' + * + * @param string $productId A Voucherify product ID or source ID. (required) + * @param \OpenAPI\Client\Model\ProductsUpdateRequestBody $productsUpdateRequestBody Specify the parameters of the product that are to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateProductRequest($productId, $productsUpdateRequestBody = null, string $contentType = self::contentTypes['updateProduct'][0]) + { + + // verify the required parameter 'productId' is set + if ($productId === null || (is_array($productId) && count($productId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productId when calling updateProduct' + ); + } + + + + $resourcePath = '/v1/products/{productId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($productId !== null) { + $resourcePath = str_replace( + '{' . 'productId' . '}', + ObjectSerializer::toPathValue($productId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($productsUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($productsUpdateRequestBody)); + } else { + $httpBody = $productsUpdateRequestBody; + } + } 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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateProductsInBulk + * + * Update Products in Bulk + * + * @param \OpenAPI\Client\Model\ProductsUpdateInBulkRequestBody[] $productsUpdateInBulkRequestBody List the product fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody + */ + public function updateProductsInBulk($productsUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsInBulk'][0]) + { + list($response) = $this->updateProductsInBulkWithHttpInfo($productsUpdateInBulkRequestBody, $contentType); + return $response; + } + + /** + * Operation updateProductsInBulkWithHttpInfo + * + * Update Products in Bulk + * + * @param \OpenAPI\Client\Model\ProductsUpdateInBulkRequestBody[] $productsUpdateInBulkRequestBody List the product fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProductsInBulkWithHttpInfo($productsUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsInBulk'][0]) + { + $request = $this->updateProductsInBulkRequest($productsUpdateInBulkRequestBody, $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 202: + if ('\OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProductsInBulkAsync + * + * Update Products in Bulk + * + * @param \OpenAPI\Client\Model\ProductsUpdateInBulkRequestBody[] $productsUpdateInBulkRequestBody List the product fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProductsInBulkAsync($productsUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsInBulk'][0]) + { + return $this->updateProductsInBulkAsyncWithHttpInfo($productsUpdateInBulkRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProductsInBulkAsyncWithHttpInfo + * + * Update Products in Bulk + * + * @param \OpenAPI\Client\Model\ProductsUpdateInBulkRequestBody[] $productsUpdateInBulkRequestBody List the product fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProductsInBulkAsyncWithHttpInfo($productsUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsInBulk'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsUpdateInBulkResponseBody'; + $request = $this->updateProductsInBulkRequest($productsUpdateInBulkRequestBody, $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 'updateProductsInBulk' + * + * @param \OpenAPI\Client\Model\ProductsUpdateInBulkRequestBody[] $productsUpdateInBulkRequestBody List the product fields to be updated in each customer object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateProductsInBulkRequest($productsUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsInBulk'][0]) + { + + + + $resourcePath = '/v1/products/bulk/async'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($productsUpdateInBulkRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($productsUpdateInBulkRequestBody)); + } else { + $httpBody = $productsUpdateInBulkRequestBody; + } + } 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 updateProductsMetadataInBulk + * + * Update Products' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkRequestBody $productsMetadataUpdateInBulkRequestBody List the source_ids of the products you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsMetadataInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody + */ + public function updateProductsMetadataInBulk($productsMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsMetadataInBulk'][0]) + { + list($response) = $this->updateProductsMetadataInBulkWithHttpInfo($productsMetadataUpdateInBulkRequestBody, $contentType); + return $response; + } + + /** + * Operation updateProductsMetadataInBulkWithHttpInfo + * + * Update Products' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkRequestBody $productsMetadataUpdateInBulkRequestBody List the source_ids of the products you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsMetadataInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProductsMetadataInBulkWithHttpInfo($productsMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsMetadataInBulk'][0]) + { + $request = $this->updateProductsMetadataInBulkRequest($productsMetadataUpdateInBulkRequestBody, $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 202: + if ('\OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProductsMetadataInBulkAsync + * + * Update Products' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkRequestBody $productsMetadataUpdateInBulkRequestBody List the source_ids of the products you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProductsMetadataInBulkAsync($productsMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsMetadataInBulk'][0]) + { + return $this->updateProductsMetadataInBulkAsyncWithHttpInfo($productsMetadataUpdateInBulkRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProductsMetadataInBulkAsyncWithHttpInfo + * + * Update Products' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkRequestBody $productsMetadataUpdateInBulkRequestBody List the source_ids of the products you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProductsMetadataInBulkAsyncWithHttpInfo($productsMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsMetadataInBulk'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsMetadataUpdateInBulkResponseBody'; + $request = $this->updateProductsMetadataInBulkRequest($productsMetadataUpdateInBulkRequestBody, $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 'updateProductsMetadataInBulk' + * + * @param \OpenAPI\Client\Model\ProductsMetadataUpdateInBulkRequestBody $productsMetadataUpdateInBulkRequestBody List the source_ids of the products you would like to update with the metadata key/value pairs. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProductsMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateProductsMetadataInBulkRequest($productsMetadataUpdateInBulkRequestBody = null, string $contentType = self::contentTypes['updateProductsMetadataInBulk'][0]) + { + + + + $resourcePath = '/v1/products/metadata/async'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($productsMetadataUpdateInBulkRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($productsMetadataUpdateInBulkRequestBody)); + } else { + $httpBody = $productsMetadataUpdateInBulkRequestBody; + } + } 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 updateSku + * + * Update SKU + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusUpdateRequestBody $productsSkusUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSku'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ProductsSkusUpdateResponseBody + */ + public function updateSku($productId, $skuId, $productsSkusUpdateRequestBody = null, string $contentType = self::contentTypes['updateSku'][0]) + { + list($response) = $this->updateSkuWithHttpInfo($productId, $skuId, $productsSkusUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateSkuWithHttpInfo + * + * Update SKU + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusUpdateRequestBody $productsSkusUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSku'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ProductsSkusUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateSkuWithHttpInfo($productId, $skuId, $productsSkusUpdateRequestBody = null, string $contentType = self::contentTypes['updateSku'][0]) + { + $request = $this->updateSkuRequest($productId, $skuId, $productsSkusUpdateRequestBody, $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\ProductsSkusUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ProductsSkusUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ProductsSkusUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ProductsSkusUpdateResponseBody'; + 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\ProductsSkusUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateSkuAsync + * + * Update SKU + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusUpdateRequestBody $productsSkusUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateSkuAsync($productId, $skuId, $productsSkusUpdateRequestBody = null, string $contentType = self::contentTypes['updateSku'][0]) + { + return $this->updateSkuAsyncWithHttpInfo($productId, $skuId, $productsSkusUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateSkuAsyncWithHttpInfo + * + * Update SKU + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusUpdateRequestBody $productsSkusUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateSkuAsyncWithHttpInfo($productId, $skuId, $productsSkusUpdateRequestBody = null, string $contentType = self::contentTypes['updateSku'][0]) + { + $returnType = '\OpenAPI\Client\Model\ProductsSkusUpdateResponseBody'; + $request = $this->updateSkuRequest($productId, $skuId, $productsSkusUpdateRequestBody, $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 'updateSku' + * + * @param string $productId A unique Voucherify product ID or product source ID. (required) + * @param string $skuId A Voucherify SKU ID or SKU source ID. (required) + * @param \OpenAPI\Client\Model\ProductsSkusUpdateRequestBody $productsSkusUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSku'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateSkuRequest($productId, $skuId, $productsSkusUpdateRequestBody = null, string $contentType = self::contentTypes['updateSku'][0]) + { + + // verify the required parameter 'productId' is set + if ($productId === null || (is_array($productId) && count($productId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $productId when calling updateSku' + ); + } + + // verify the required parameter 'skuId' is set + if ($skuId === null || (is_array($skuId) && count($skuId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $skuId when calling updateSku' + ); + } + + + + $resourcePath = '/v1/products/{productId}/skus/{skuId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($productId !== null) { + $resourcePath = str_replace( + '{' . 'productId' . '}', + ObjectSerializer::toPathValue($productId), + $resourcePath + ); + } + // path params + if ($skuId !== null) { + $resourcePath = str_replace( + '{' . 'skuId' . '}', + ObjectSerializer::toPathValue($skuId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($productsSkusUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($productsSkusUpdateRequestBody)); + } else { + $httpBody = $productsSkusUpdateRequestBody; + } + } 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( + 'PUT', + $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/Api/PromotionsApi.php b/src/Api/PromotionsApi.php new file mode 100644 index 0000000..68c2a6f --- /dev/null +++ b/src/Api/PromotionsApi.php @@ -0,0 +1,4408 @@ + [ + 'application/json', + ], + 'createPromotionStack' => [ + 'application/json', + ], + 'deletePromotionStack' => [ + 'application/json', + ], + 'deletePromotionTier' => [ + 'application/json', + ], + 'disablePromotionTier' => [ + 'application/json', + ], + 'enablePromotionTier' => [ + 'application/json', + ], + 'getPromotionStack' => [ + 'application/json', + ], + 'getPromotionTier' => [ + 'application/json', + ], + 'listAllPromotionStacks' => [ + 'application/json', + ], + 'listPromotionStacksInCampaign' => [ + 'application/json', + ], + 'listPromotionTiers' => [ + 'application/json', + ], + 'listPromotionTiersFromCampaign' => [ + 'application/json', + ], + 'updatePromotionStack' => [ + 'application/json', + ], + 'updatePromotionTier' => [ + '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 addPromotionTierToCampaign + * + * Add Promotion Tier to Campaign + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersCreateRequestBody $promotionsTiersCreateRequestBody Specify the promotion tier parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPromotionTierToCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsTiersCreateResponseBody + */ + public function addPromotionTierToCampaign($campaignId, $promotionsTiersCreateRequestBody = null, string $contentType = self::contentTypes['addPromotionTierToCampaign'][0]) + { + list($response) = $this->addPromotionTierToCampaignWithHttpInfo($campaignId, $promotionsTiersCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation addPromotionTierToCampaignWithHttpInfo + * + * Add Promotion Tier to Campaign + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersCreateRequestBody $promotionsTiersCreateRequestBody Specify the promotion tier parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPromotionTierToCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsTiersCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function addPromotionTierToCampaignWithHttpInfo($campaignId, $promotionsTiersCreateRequestBody = null, string $contentType = self::contentTypes['addPromotionTierToCampaign'][0]) + { + $request = $this->addPromotionTierToCampaignRequest($campaignId, $promotionsTiersCreateRequestBody, $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\PromotionsTiersCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsTiersCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsTiersCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsTiersCreateResponseBody'; + 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\PromotionsTiersCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addPromotionTierToCampaignAsync + * + * Add Promotion Tier to Campaign + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersCreateRequestBody $promotionsTiersCreateRequestBody Specify the promotion tier parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPromotionTierToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addPromotionTierToCampaignAsync($campaignId, $promotionsTiersCreateRequestBody = null, string $contentType = self::contentTypes['addPromotionTierToCampaign'][0]) + { + return $this->addPromotionTierToCampaignAsyncWithHttpInfo($campaignId, $promotionsTiersCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addPromotionTierToCampaignAsyncWithHttpInfo + * + * Add Promotion Tier to Campaign + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersCreateRequestBody $promotionsTiersCreateRequestBody Specify the promotion tier parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPromotionTierToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addPromotionTierToCampaignAsyncWithHttpInfo($campaignId, $promotionsTiersCreateRequestBody = null, string $contentType = self::contentTypes['addPromotionTierToCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsTiersCreateResponseBody'; + $request = $this->addPromotionTierToCampaignRequest($campaignId, $promotionsTiersCreateRequestBody, $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 'addPromotionTierToCampaign' + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersCreateRequestBody $promotionsTiersCreateRequestBody Specify the promotion tier parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPromotionTierToCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addPromotionTierToCampaignRequest($campaignId, $promotionsTiersCreateRequestBody = null, string $contentType = self::contentTypes['addPromotionTierToCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling addPromotionTierToCampaign' + ); + } + + + + $resourcePath = '/v1/promotions/{campaignId}/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($promotionsTiersCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($promotionsTiersCreateRequestBody)); + } else { + $httpBody = $promotionsTiersCreateRequestBody; + } + } 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 createPromotionStack + * + * Create Promotion Stack + * + * @param string $campaignId Unique campaign ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksCreateRequestBody $promotionsStacksCreateRequestBody Specify the order of promotion tiers for the promotion stack. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPromotionStack'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsStacksCreateResponseBody + */ + public function createPromotionStack($campaignId, $promotionsStacksCreateRequestBody = null, string $contentType = self::contentTypes['createPromotionStack'][0]) + { + list($response) = $this->createPromotionStackWithHttpInfo($campaignId, $promotionsStacksCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createPromotionStackWithHttpInfo + * + * Create Promotion Stack + * + * @param string $campaignId Unique campaign ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksCreateRequestBody $promotionsStacksCreateRequestBody Specify the order of promotion tiers for the promotion stack. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPromotionStack'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsStacksCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createPromotionStackWithHttpInfo($campaignId, $promotionsStacksCreateRequestBody = null, string $contentType = self::contentTypes['createPromotionStack'][0]) + { + $request = $this->createPromotionStackRequest($campaignId, $promotionsStacksCreateRequestBody, $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\PromotionsStacksCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsStacksCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsStacksCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsStacksCreateResponseBody'; + 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\PromotionsStacksCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPromotionStackAsync + * + * Create Promotion Stack + * + * @param string $campaignId Unique campaign ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksCreateRequestBody $promotionsStacksCreateRequestBody Specify the order of promotion tiers for the promotion stack. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPromotionStackAsync($campaignId, $promotionsStacksCreateRequestBody = null, string $contentType = self::contentTypes['createPromotionStack'][0]) + { + return $this->createPromotionStackAsyncWithHttpInfo($campaignId, $promotionsStacksCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPromotionStackAsyncWithHttpInfo + * + * Create Promotion Stack + * + * @param string $campaignId Unique campaign ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksCreateRequestBody $promotionsStacksCreateRequestBody Specify the order of promotion tiers for the promotion stack. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPromotionStackAsyncWithHttpInfo($campaignId, $promotionsStacksCreateRequestBody = null, string $contentType = self::contentTypes['createPromotionStack'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsStacksCreateResponseBody'; + $request = $this->createPromotionStackRequest($campaignId, $promotionsStacksCreateRequestBody, $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 'createPromotionStack' + * + * @param string $campaignId Unique campaign ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksCreateRequestBody $promotionsStacksCreateRequestBody Specify the order of promotion tiers for the promotion stack. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPromotionStackRequest($campaignId, $promotionsStacksCreateRequestBody = null, string $contentType = self::contentTypes['createPromotionStack'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling createPromotionStack' + ); + } + + + + $resourcePath = '/v1/promotions/{campaignId}/stacks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($promotionsStacksCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($promotionsStacksCreateRequestBody)); + } else { + $httpBody = $promotionsStacksCreateRequestBody; + } + } 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 deletePromotionStack + * + * Delete Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionStack'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deletePromotionStack($campaignId, $stackId, string $contentType = self::contentTypes['deletePromotionStack'][0]) + { + $this->deletePromotionStackWithHttpInfo($campaignId, $stackId, $contentType); + } + + /** + * Operation deletePromotionStackWithHttpInfo + * + * Delete Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionStack'] 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 deletePromotionStackWithHttpInfo($campaignId, $stackId, string $contentType = self::contentTypes['deletePromotionStack'][0]) + { + $request = $this->deletePromotionStackRequest($campaignId, $stackId, $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 deletePromotionStackAsync + * + * Delete Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePromotionStackAsync($campaignId, $stackId, string $contentType = self::contentTypes['deletePromotionStack'][0]) + { + return $this->deletePromotionStackAsyncWithHttpInfo($campaignId, $stackId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deletePromotionStackAsyncWithHttpInfo + * + * Delete Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePromotionStackAsyncWithHttpInfo($campaignId, $stackId, string $contentType = self::contentTypes['deletePromotionStack'][0]) + { + $returnType = ''; + $request = $this->deletePromotionStackRequest($campaignId, $stackId, $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 'deletePromotionStack' + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deletePromotionStackRequest($campaignId, $stackId, string $contentType = self::contentTypes['deletePromotionStack'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling deletePromotionStack' + ); + } + + // verify the required parameter 'stackId' is set + if ($stackId === null || (is_array($stackId) && count($stackId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $stackId when calling deletePromotionStack' + ); + } + + + $resourcePath = '/v1/promotions/{campaignId}/stacks/{stackId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($stackId !== null) { + $resourcePath = str_replace( + '{' . 'stackId' . '}', + ObjectSerializer::toPathValue($stackId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deletePromotionTier + * + * Delete Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deletePromotionTier($promotionTierId, string $contentType = self::contentTypes['deletePromotionTier'][0]) + { + $this->deletePromotionTierWithHttpInfo($promotionTierId, $contentType); + } + + /** + * Operation deletePromotionTierWithHttpInfo + * + * Delete Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionTier'] 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 deletePromotionTierWithHttpInfo($promotionTierId, string $contentType = self::contentTypes['deletePromotionTier'][0]) + { + $request = $this->deletePromotionTierRequest($promotionTierId, $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 deletePromotionTierAsync + * + * Delete Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePromotionTierAsync($promotionTierId, string $contentType = self::contentTypes['deletePromotionTier'][0]) + { + return $this->deletePromotionTierAsyncWithHttpInfo($promotionTierId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deletePromotionTierAsyncWithHttpInfo + * + * Delete Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePromotionTierAsyncWithHttpInfo($promotionTierId, string $contentType = self::contentTypes['deletePromotionTier'][0]) + { + $returnType = ''; + $request = $this->deletePromotionTierRequest($promotionTierId, $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 'deletePromotionTier' + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deletePromotionTierRequest($promotionTierId, string $contentType = self::contentTypes['deletePromotionTier'][0]) + { + + // verify the required parameter 'promotionTierId' is set + if ($promotionTierId === null || (is_array($promotionTierId) && count($promotionTierId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $promotionTierId when calling deletePromotionTier' + ); + } + + + $resourcePath = '/v1/promotions/tiers/{promotionTierId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($promotionTierId !== null) { + $resourcePath = str_replace( + '{' . 'promotionTierId' . '}', + ObjectSerializer::toPathValue($promotionTierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation disablePromotionTier + * + * Disable Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disablePromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsTiersDisableResponseBody + */ + public function disablePromotionTier($promotionTierId, string $contentType = self::contentTypes['disablePromotionTier'][0]) + { + list($response) = $this->disablePromotionTierWithHttpInfo($promotionTierId, $contentType); + return $response; + } + + /** + * Operation disablePromotionTierWithHttpInfo + * + * Disable Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disablePromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsTiersDisableResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function disablePromotionTierWithHttpInfo($promotionTierId, string $contentType = self::contentTypes['disablePromotionTier'][0]) + { + $request = $this->disablePromotionTierRequest($promotionTierId, $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\PromotionsTiersDisableResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsTiersDisableResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsTiersDisableResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsTiersDisableResponseBody'; + 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\PromotionsTiersDisableResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation disablePromotionTierAsync + * + * Disable Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disablePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disablePromotionTierAsync($promotionTierId, string $contentType = self::contentTypes['disablePromotionTier'][0]) + { + return $this->disablePromotionTierAsyncWithHttpInfo($promotionTierId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation disablePromotionTierAsyncWithHttpInfo + * + * Disable Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disablePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disablePromotionTierAsyncWithHttpInfo($promotionTierId, string $contentType = self::contentTypes['disablePromotionTier'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsTiersDisableResponseBody'; + $request = $this->disablePromotionTierRequest($promotionTierId, $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 'disablePromotionTier' + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disablePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function disablePromotionTierRequest($promotionTierId, string $contentType = self::contentTypes['disablePromotionTier'][0]) + { + + // verify the required parameter 'promotionTierId' is set + if ($promotionTierId === null || (is_array($promotionTierId) && count($promotionTierId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $promotionTierId when calling disablePromotionTier' + ); + } + + + $resourcePath = '/v1/promotions/tiers/{promotionTierId}/disable'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($promotionTierId !== null) { + $resourcePath = str_replace( + '{' . 'promotionTierId' . '}', + ObjectSerializer::toPathValue($promotionTierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 enablePromotionTier + * + * Enable Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enablePromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsTiersEnableResponseBody + */ + public function enablePromotionTier($promotionTierId, string $contentType = self::contentTypes['enablePromotionTier'][0]) + { + list($response) = $this->enablePromotionTierWithHttpInfo($promotionTierId, $contentType); + return $response; + } + + /** + * Operation enablePromotionTierWithHttpInfo + * + * Enable Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enablePromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsTiersEnableResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function enablePromotionTierWithHttpInfo($promotionTierId, string $contentType = self::contentTypes['enablePromotionTier'][0]) + { + $request = $this->enablePromotionTierRequest($promotionTierId, $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\PromotionsTiersEnableResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsTiersEnableResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsTiersEnableResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsTiersEnableResponseBody'; + 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\PromotionsTiersEnableResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation enablePromotionTierAsync + * + * Enable Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enablePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enablePromotionTierAsync($promotionTierId, string $contentType = self::contentTypes['enablePromotionTier'][0]) + { + return $this->enablePromotionTierAsyncWithHttpInfo($promotionTierId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation enablePromotionTierAsyncWithHttpInfo + * + * Enable Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enablePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enablePromotionTierAsyncWithHttpInfo($promotionTierId, string $contentType = self::contentTypes['enablePromotionTier'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsTiersEnableResponseBody'; + $request = $this->enablePromotionTierRequest($promotionTierId, $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 'enablePromotionTier' + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enablePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function enablePromotionTierRequest($promotionTierId, string $contentType = self::contentTypes['enablePromotionTier'][0]) + { + + // verify the required parameter 'promotionTierId' is set + if ($promotionTierId === null || (is_array($promotionTierId) && count($promotionTierId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $promotionTierId when calling enablePromotionTier' + ); + } + + + $resourcePath = '/v1/promotions/tiers/{promotionTierId}/enable'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($promotionTierId !== null) { + $resourcePath = str_replace( + '{' . 'promotionTierId' . '}', + ObjectSerializer::toPathValue($promotionTierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 getPromotionStack + * + * Get Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionStack'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsStacksGetResponseBody + */ + public function getPromotionStack($campaignId, $stackId, string $contentType = self::contentTypes['getPromotionStack'][0]) + { + list($response) = $this->getPromotionStackWithHttpInfo($campaignId, $stackId, $contentType); + return $response; + } + + /** + * Operation getPromotionStackWithHttpInfo + * + * Get Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionStack'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsStacksGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getPromotionStackWithHttpInfo($campaignId, $stackId, string $contentType = self::contentTypes['getPromotionStack'][0]) + { + $request = $this->getPromotionStackRequest($campaignId, $stackId, $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\PromotionsStacksGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsStacksGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsStacksGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsStacksGetResponseBody'; + 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\PromotionsStacksGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPromotionStackAsync + * + * Get Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPromotionStackAsync($campaignId, $stackId, string $contentType = self::contentTypes['getPromotionStack'][0]) + { + return $this->getPromotionStackAsyncWithHttpInfo($campaignId, $stackId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPromotionStackAsyncWithHttpInfo + * + * Get Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPromotionStackAsyncWithHttpInfo($campaignId, $stackId, string $contentType = self::contentTypes['getPromotionStack'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsStacksGetResponseBody'; + $request = $this->getPromotionStackRequest($campaignId, $stackId, $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 'getPromotionStack' + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPromotionStackRequest($campaignId, $stackId, string $contentType = self::contentTypes['getPromotionStack'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getPromotionStack' + ); + } + + // verify the required parameter 'stackId' is set + if ($stackId === null || (is_array($stackId) && count($stackId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $stackId when calling getPromotionStack' + ); + } + + + $resourcePath = '/v1/promotions/{campaignId}/stacks/{stackId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($stackId !== null) { + $resourcePath = str_replace( + '{' . 'stackId' . '}', + ObjectSerializer::toPathValue($stackId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPromotionTier + * + * Get Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsTiersGetResponseBody + */ + public function getPromotionTier($promotionTierId, string $contentType = self::contentTypes['getPromotionTier'][0]) + { + list($response) = $this->getPromotionTierWithHttpInfo($promotionTierId, $contentType); + return $response; + } + + /** + * Operation getPromotionTierWithHttpInfo + * + * Get Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsTiersGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getPromotionTierWithHttpInfo($promotionTierId, string $contentType = self::contentTypes['getPromotionTier'][0]) + { + $request = $this->getPromotionTierRequest($promotionTierId, $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\PromotionsTiersGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsTiersGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsTiersGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsTiersGetResponseBody'; + 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\PromotionsTiersGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPromotionTierAsync + * + * Get Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPromotionTierAsync($promotionTierId, string $contentType = self::contentTypes['getPromotionTier'][0]) + { + return $this->getPromotionTierAsyncWithHttpInfo($promotionTierId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPromotionTierAsyncWithHttpInfo + * + * Get Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPromotionTierAsyncWithHttpInfo($promotionTierId, string $contentType = self::contentTypes['getPromotionTier'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsTiersGetResponseBody'; + $request = $this->getPromotionTierRequest($promotionTierId, $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 'getPromotionTier' + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPromotionTierRequest($promotionTierId, string $contentType = self::contentTypes['getPromotionTier'][0]) + { + + // verify the required parameter 'promotionTierId' is set + if ($promotionTierId === null || (is_array($promotionTierId) && count($promotionTierId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $promotionTierId when calling getPromotionTier' + ); + } + + + $resourcePath = '/v1/promotions/tiers/{promotionTierId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($promotionTierId !== null) { + $resourcePath = str_replace( + '{' . 'promotionTierId' . '}', + ObjectSerializer::toPathValue($promotionTierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listAllPromotionStacks + * + * List Promotion Stacks + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListAllPromotionStacks $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllPromotionStacks'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsStacksListResponseBody + */ + public function listAllPromotionStacks($limit = null, $page = null, $order = null, $createdAt = null, $updatedAt = null, string $contentType = self::contentTypes['listAllPromotionStacks'][0]) + { + list($response) = $this->listAllPromotionStacksWithHttpInfo($limit, $page, $order, $createdAt, $updatedAt, $contentType); + return $response; + } + + /** + * Operation listAllPromotionStacksWithHttpInfo + * + * List Promotion Stacks + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListAllPromotionStacks $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllPromotionStacks'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsStacksListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listAllPromotionStacksWithHttpInfo($limit = null, $page = null, $order = null, $createdAt = null, $updatedAt = null, string $contentType = self::contentTypes['listAllPromotionStacks'][0]) + { + $request = $this->listAllPromotionStacksRequest($limit, $page, $order, $createdAt, $updatedAt, $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\PromotionsStacksListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsStacksListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsStacksListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsStacksListResponseBody'; + 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\PromotionsStacksListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listAllPromotionStacksAsync + * + * List Promotion Stacks + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListAllPromotionStacks $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllPromotionStacks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listAllPromotionStacksAsync($limit = null, $page = null, $order = null, $createdAt = null, $updatedAt = null, string $contentType = self::contentTypes['listAllPromotionStacks'][0]) + { + return $this->listAllPromotionStacksAsyncWithHttpInfo($limit, $page, $order, $createdAt, $updatedAt, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listAllPromotionStacksAsyncWithHttpInfo + * + * List Promotion Stacks + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListAllPromotionStacks $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllPromotionStacks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listAllPromotionStacksAsyncWithHttpInfo($limit = null, $page = null, $order = null, $createdAt = null, $updatedAt = null, string $contentType = self::contentTypes['listAllPromotionStacks'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsStacksListResponseBody'; + $request = $this->listAllPromotionStacksRequest($limit, $page, $order, $createdAt, $updatedAt, $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 'listAllPromotionStacks' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListAllPromotionStacks $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllPromotionStacks'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listAllPromotionStacksRequest($limit = null, $page = null, $order = null, $createdAt = null, $updatedAt = null, string $contentType = self::contentTypes['listAllPromotionStacks'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PromotionsApi.listAllPromotionStacks, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PromotionsApi.listAllPromotionStacks, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling PromotionsApi.listAllPromotionStacks, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling PromotionsApi.listAllPromotionStacks, must be bigger than or equal to 1.'); + } + + + + + + $resourcePath = '/v1/promotions/stacks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListAllPromotionStacks', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdAt, + 'created_at', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updatedAt, + 'updated_at', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listPromotionStacksInCampaign + * + * List Promotion Stacks in Campaign + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionStacksInCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsStacksListResponseBody + */ + public function listPromotionStacksInCampaign($campaignId, string $contentType = self::contentTypes['listPromotionStacksInCampaign'][0]) + { + list($response) = $this->listPromotionStacksInCampaignWithHttpInfo($campaignId, $contentType); + return $response; + } + + /** + * Operation listPromotionStacksInCampaignWithHttpInfo + * + * List Promotion Stacks in Campaign + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionStacksInCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsStacksListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listPromotionStacksInCampaignWithHttpInfo($campaignId, string $contentType = self::contentTypes['listPromotionStacksInCampaign'][0]) + { + $request = $this->listPromotionStacksInCampaignRequest($campaignId, $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\PromotionsStacksListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsStacksListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsStacksListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsStacksListResponseBody'; + 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\PromotionsStacksListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listPromotionStacksInCampaignAsync + * + * List Promotion Stacks in Campaign + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionStacksInCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPromotionStacksInCampaignAsync($campaignId, string $contentType = self::contentTypes['listPromotionStacksInCampaign'][0]) + { + return $this->listPromotionStacksInCampaignAsyncWithHttpInfo($campaignId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listPromotionStacksInCampaignAsyncWithHttpInfo + * + * List Promotion Stacks in Campaign + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionStacksInCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPromotionStacksInCampaignAsyncWithHttpInfo($campaignId, string $contentType = self::contentTypes['listPromotionStacksInCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsStacksListResponseBody'; + $request = $this->listPromotionStacksInCampaignRequest($campaignId, $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 'listPromotionStacksInCampaign' + * + * @param string $campaignId Unique campaign ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionStacksInCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listPromotionStacksInCampaignRequest($campaignId, string $contentType = self::contentTypes['listPromotionStacksInCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listPromotionStacksInCampaign' + ); + } + + + $resourcePath = '/v1/promotions/{campaignId}/stacks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listPromotionTiers + * + * List Promotion Tiers + * + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsTiersListResponseBody + */ + public function listPromotionTiers($isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiers'][0]) + { + list($response) = $this->listPromotionTiersWithHttpInfo($isAvailable, $limit, $page, $order, $contentType); + return $response; + } + + /** + * Operation listPromotionTiersWithHttpInfo + * + * List Promotion Tiers + * + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsTiersListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listPromotionTiersWithHttpInfo($isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiers'][0]) + { + $request = $this->listPromotionTiersRequest($isAvailable, $limit, $page, $order, $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\PromotionsTiersListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsTiersListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsTiersListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsTiersListResponseBody'; + 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\PromotionsTiersListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listPromotionTiersAsync + * + * List Promotion Tiers + * + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPromotionTiersAsync($isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiers'][0]) + { + return $this->listPromotionTiersAsyncWithHttpInfo($isAvailable, $limit, $page, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listPromotionTiersAsyncWithHttpInfo + * + * List Promotion Tiers + * + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPromotionTiersAsyncWithHttpInfo($isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiers'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsTiersListResponseBody'; + $request = $this->listPromotionTiersRequest($isAvailable, $limit, $page, $order, $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 'listPromotionTiers' + * + * @param bool $isAvailable This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPromotionTiers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listPromotionTiersRequest($isAvailable = null, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listPromotionTiers'][0]) + { + + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PromotionsApi.listPromotionTiers, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PromotionsApi.listPromotionTiers, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling PromotionsApi.listPromotionTiers, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling PromotionsApi.listPromotionTiers, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/promotions/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $isAvailable, + 'is_available', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListPromotionTiers', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listPromotionTiersFromCampaign + * + * List Promotion Tiers from Campaign + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersFromCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsTiersListResponseBody + */ + public function listPromotionTiersFromCampaign($campaignId, string $contentType = self::contentTypes['listPromotionTiersFromCampaign'][0]) + { + list($response) = $this->listPromotionTiersFromCampaignWithHttpInfo($campaignId, $contentType); + return $response; + } + + /** + * Operation listPromotionTiersFromCampaignWithHttpInfo + * + * List Promotion Tiers from Campaign + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersFromCampaign'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsTiersListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listPromotionTiersFromCampaignWithHttpInfo($campaignId, string $contentType = self::contentTypes['listPromotionTiersFromCampaign'][0]) + { + $request = $this->listPromotionTiersFromCampaignRequest($campaignId, $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\PromotionsTiersListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsTiersListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsTiersListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsTiersListResponseBody'; + 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\PromotionsTiersListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listPromotionTiersFromCampaignAsync + * + * List Promotion Tiers from Campaign + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersFromCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPromotionTiersFromCampaignAsync($campaignId, string $contentType = self::contentTypes['listPromotionTiersFromCampaign'][0]) + { + return $this->listPromotionTiersFromCampaignAsyncWithHttpInfo($campaignId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listPromotionTiersFromCampaignAsyncWithHttpInfo + * + * List Promotion Tiers from Campaign + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersFromCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPromotionTiersFromCampaignAsyncWithHttpInfo($campaignId, string $contentType = self::contentTypes['listPromotionTiersFromCampaign'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsTiersListResponseBody'; + $request = $this->listPromotionTiersFromCampaignRequest($campaignId, $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 'listPromotionTiersFromCampaign' + * + * @param string $campaignId Unique campaign ID assigned by Voucherify. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPromotionTiersFromCampaign'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listPromotionTiersFromCampaignRequest($campaignId, string $contentType = self::contentTypes['listPromotionTiersFromCampaign'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling listPromotionTiersFromCampaign' + ); + } + + + $resourcePath = '/v1/promotions/{campaignId}/tiers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updatePromotionStack + * + * Update Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksUpdateRequestBody $promotionsStacksUpdateRequestBody Specify the promotion stack parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionStack'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsStacksUpdateResponseBody + */ + public function updatePromotionStack($campaignId, $stackId, $promotionsStacksUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionStack'][0]) + { + list($response) = $this->updatePromotionStackWithHttpInfo($campaignId, $stackId, $promotionsStacksUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updatePromotionStackWithHttpInfo + * + * Update Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksUpdateRequestBody $promotionsStacksUpdateRequestBody Specify the promotion stack parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionStack'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsStacksUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updatePromotionStackWithHttpInfo($campaignId, $stackId, $promotionsStacksUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionStack'][0]) + { + $request = $this->updatePromotionStackRequest($campaignId, $stackId, $promotionsStacksUpdateRequestBody, $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\PromotionsStacksUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsStacksUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsStacksUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsStacksUpdateResponseBody'; + 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\PromotionsStacksUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updatePromotionStackAsync + * + * Update Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksUpdateRequestBody $promotionsStacksUpdateRequestBody Specify the promotion stack parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePromotionStackAsync($campaignId, $stackId, $promotionsStacksUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionStack'][0]) + { + return $this->updatePromotionStackAsyncWithHttpInfo($campaignId, $stackId, $promotionsStacksUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updatePromotionStackAsyncWithHttpInfo + * + * Update Promotion Stack + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksUpdateRequestBody $promotionsStacksUpdateRequestBody Specify the promotion stack parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePromotionStackAsyncWithHttpInfo($campaignId, $stackId, $promotionsStacksUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionStack'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsStacksUpdateResponseBody'; + $request = $this->updatePromotionStackRequest($campaignId, $stackId, $promotionsStacksUpdateRequestBody, $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 'updatePromotionStack' + * + * @param string $campaignId ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + * @param string $stackId Promotion stack ID. (required) + * @param \OpenAPI\Client\Model\PromotionsStacksUpdateRequestBody $promotionsStacksUpdateRequestBody Specify the promotion stack parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionStack'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updatePromotionStackRequest($campaignId, $stackId, $promotionsStacksUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionStack'][0]) + { + + // verify the required parameter 'campaignId' is set + if ($campaignId === null || (is_array($campaignId) && count($campaignId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updatePromotionStack' + ); + } + + // verify the required parameter 'stackId' is set + if ($stackId === null || (is_array($stackId) && count($stackId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $stackId when calling updatePromotionStack' + ); + } + + + + $resourcePath = '/v1/promotions/{campaignId}/stacks/{stackId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($campaignId !== null) { + $resourcePath = str_replace( + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), + $resourcePath + ); + } + // path params + if ($stackId !== null) { + $resourcePath = str_replace( + '{' . 'stackId' . '}', + ObjectSerializer::toPathValue($stackId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($promotionsStacksUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($promotionsStacksUpdateRequestBody)); + } else { + $httpBody = $promotionsStacksUpdateRequestBody; + } + } 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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updatePromotionTier + * + * Update Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateRequestBody $promotionsTiersUpdateRequestBody Specify the promotion tier parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBody + */ + public function updatePromotionTier($promotionTierId, $promotionsTiersUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionTier'][0]) + { + list($response) = $this->updatePromotionTierWithHttpInfo($promotionTierId, $promotionsTiersUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updatePromotionTierWithHttpInfo + * + * Update Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateRequestBody $promotionsTiersUpdateRequestBody Specify the promotion tier parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionTier'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updatePromotionTierWithHttpInfo($promotionTierId, $promotionsTiersUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionTier'][0]) + { + $request = $this->updatePromotionTierRequest($promotionTierId, $promotionsTiersUpdateRequestBody, $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\PromotionsTiersUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBody'; + 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\PromotionsTiersUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updatePromotionTierAsync + * + * Update Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateRequestBody $promotionsTiersUpdateRequestBody Specify the promotion tier parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePromotionTierAsync($promotionTierId, $promotionsTiersUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionTier'][0]) + { + return $this->updatePromotionTierAsyncWithHttpInfo($promotionTierId, $promotionsTiersUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updatePromotionTierAsyncWithHttpInfo + * + * Update Promotion Tier + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateRequestBody $promotionsTiersUpdateRequestBody Specify the promotion tier parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePromotionTierAsyncWithHttpInfo($promotionTierId, $promotionsTiersUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionTier'][0]) + { + $returnType = '\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBody'; + $request = $this->updatePromotionTierRequest($promotionTierId, $promotionsTiersUpdateRequestBody, $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 'updatePromotionTier' + * + * @param string $promotionTierId Unique promotion tier ID. (required) + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateRequestBody $promotionsTiersUpdateRequestBody Specify the promotion tier parameters that you would like to update. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePromotionTier'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updatePromotionTierRequest($promotionTierId, $promotionsTiersUpdateRequestBody = null, string $contentType = self::contentTypes['updatePromotionTier'][0]) + { + + // verify the required parameter 'promotionTierId' is set + if ($promotionTierId === null || (is_array($promotionTierId) && count($promotionTierId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $promotionTierId when calling updatePromotionTier' + ); + } + + + + $resourcePath = '/v1/promotions/tiers/{promotionTierId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($promotionTierId !== null) { + $resourcePath = str_replace( + '{' . 'promotionTierId' . '}', + ObjectSerializer::toPathValue($promotionTierId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($promotionsTiersUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($promotionsTiersUpdateRequestBody)); + } else { + $httpBody = $promotionsTiersUpdateRequestBody; + } + } 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( + 'PUT', + $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/Api/PublicationsApi.php b/src/Api/PublicationsApi.php new file mode 100644 index 0000000..2cf25cf --- /dev/null +++ b/src/Api/PublicationsApi.php @@ -0,0 +1,1270 @@ + [ + 'application/json', + ], + 'createPublication1' => [ + 'application/json', + ], + 'listPublications' => [ + '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 createPublication + * + * Create Publication + * + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param \OpenAPI\Client\Model\PublicationsCreateRequestBody $publicationsCreateRequestBody Specify the publication parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PublicationsCreateResponseBody + */ + public function createPublication($joinOnce = null, $publicationsCreateRequestBody = null, string $contentType = self::contentTypes['createPublication'][0]) + { + list($response) = $this->createPublicationWithHttpInfo($joinOnce, $publicationsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createPublicationWithHttpInfo + * + * Create Publication + * + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param \OpenAPI\Client\Model\PublicationsCreateRequestBody $publicationsCreateRequestBody Specify the publication parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PublicationsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createPublicationWithHttpInfo($joinOnce = null, $publicationsCreateRequestBody = null, string $contentType = self::contentTypes['createPublication'][0]) + { + $request = $this->createPublicationRequest($joinOnce, $publicationsCreateRequestBody, $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\PublicationsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PublicationsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PublicationsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PublicationsCreateResponseBody'; + 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\PublicationsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPublicationAsync + * + * Create Publication + * + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param \OpenAPI\Client\Model\PublicationsCreateRequestBody $publicationsCreateRequestBody Specify the publication parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPublicationAsync($joinOnce = null, $publicationsCreateRequestBody = null, string $contentType = self::contentTypes['createPublication'][0]) + { + return $this->createPublicationAsyncWithHttpInfo($joinOnce, $publicationsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPublicationAsyncWithHttpInfo + * + * Create Publication + * + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param \OpenAPI\Client\Model\PublicationsCreateRequestBody $publicationsCreateRequestBody Specify the publication parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPublicationAsyncWithHttpInfo($joinOnce = null, $publicationsCreateRequestBody = null, string $contentType = self::contentTypes['createPublication'][0]) + { + $returnType = '\OpenAPI\Client\Model\PublicationsCreateResponseBody'; + $request = $this->createPublicationRequest($joinOnce, $publicationsCreateRequestBody, $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 'createPublication' + * + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param \OpenAPI\Client\Model\PublicationsCreateRequestBody $publicationsCreateRequestBody Specify the publication parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPublicationRequest($joinOnce = null, $publicationsCreateRequestBody = null, string $contentType = self::contentTypes['createPublication'][0]) + { + + + + + $resourcePath = '/v1/publications'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $joinOnce, + 'join_once', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($publicationsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($publicationsCreateRequestBody)); + } else { + $httpBody = $publicationsCreateRequestBody; + } + } 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 createPublication1 + * + * Create Publication + * + * @param Customer $customer Contains information about the customer to whom the publication was directed. (required) + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param string $voucher Code of voucher being published. (optional) + * @param CreatePublicationCampaign $campaign Create publication with campaign. (optional) + * @param string $sourceId The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. (optional) + * @param object $metadata The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PublicationsCreateResponseBody + */ + public function createPublication1($customer, $joinOnce = null, $voucher = null, $campaign = null, $sourceId = null, $metadata = null, string $contentType = self::contentTypes['createPublication1'][0]) + { + list($response) = $this->createPublication1WithHttpInfo($customer, $joinOnce, $voucher, $campaign, $sourceId, $metadata, $contentType); + return $response; + } + + /** + * Operation createPublication1WithHttpInfo + * + * Create Publication + * + * @param Customer $customer Contains information about the customer to whom the publication was directed. (required) + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param string $voucher Code of voucher being published. (optional) + * @param CreatePublicationCampaign $campaign Create publication with campaign. (optional) + * @param string $sourceId The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. (optional) + * @param object $metadata The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication1'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PublicationsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createPublication1WithHttpInfo($customer, $joinOnce = null, $voucher = null, $campaign = null, $sourceId = null, $metadata = null, string $contentType = self::contentTypes['createPublication1'][0]) + { + $request = $this->createPublication1Request($customer, $joinOnce, $voucher, $campaign, $sourceId, $metadata, $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\PublicationsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PublicationsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PublicationsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PublicationsCreateResponseBody'; + 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\PublicationsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPublication1Async + * + * Create Publication + * + * @param Customer $customer Contains information about the customer to whom the publication was directed. (required) + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param string $voucher Code of voucher being published. (optional) + * @param CreatePublicationCampaign $campaign Create publication with campaign. (optional) + * @param string $sourceId The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. (optional) + * @param object $metadata The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPublication1Async($customer, $joinOnce = null, $voucher = null, $campaign = null, $sourceId = null, $metadata = null, string $contentType = self::contentTypes['createPublication1'][0]) + { + return $this->createPublication1AsyncWithHttpInfo($customer, $joinOnce, $voucher, $campaign, $sourceId, $metadata, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPublication1AsyncWithHttpInfo + * + * Create Publication + * + * @param Customer $customer Contains information about the customer to whom the publication was directed. (required) + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param string $voucher Code of voucher being published. (optional) + * @param CreatePublicationCampaign $campaign Create publication with campaign. (optional) + * @param string $sourceId The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. (optional) + * @param object $metadata The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPublication1AsyncWithHttpInfo($customer, $joinOnce = null, $voucher = null, $campaign = null, $sourceId = null, $metadata = null, string $contentType = self::contentTypes['createPublication1'][0]) + { + $returnType = '\OpenAPI\Client\Model\PublicationsCreateResponseBody'; + $request = $this->createPublication1Request($customer, $joinOnce, $voucher, $campaign, $sourceId, $metadata, $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 'createPublication1' + * + * @param Customer $customer Contains information about the customer to whom the publication was directed. (required) + * @param bool $joinOnce Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + * @param string $voucher Code of voucher being published. (optional) + * @param CreatePublicationCampaign $campaign Create publication with campaign. (optional) + * @param string $sourceId The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. (optional) + * @param object $metadata The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPublication1'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPublication1Request($customer, $joinOnce = null, $voucher = null, $campaign = null, $sourceId = null, $metadata = null, string $contentType = self::contentTypes['createPublication1'][0]) + { + + // verify the required parameter 'customer' is set + if ($customer === null || (is_array($customer) && count($customer) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customer when calling createPublication1' + ); + } + + + + + + + + $resourcePath = '/v1/publications/create'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $joinOnce, + 'join_once', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $voucher, + 'voucher', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaign, + 'campaign', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sourceId, + 'source_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $customer, + 'customer', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $metadata, + 'metadata', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listPublications + * + * List Publications + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPublications $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $campaign Filters by a given campaign name. (optional) + * @param string $customer Filters by a unique customer ID. (optional) + * @param string $voucher Filters by a given voucher code. (optional) + * @param ParameterResultListPublications $result Filters by a publication result. (optional) + * @param ParameterVoucherTypeListPublications $voucherType Filters by a voucher type. (optional) + * @param bool $isReferralCode This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. (optional) + * @param string $filters Allows for combining the filters mentioned in the endpoint description. (optional) + * @param string $sourceId Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPublications'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\PublicationsListResponseBody + */ + public function listPublications($limit = null, $page = null, $order = null, $campaign = null, $customer = null, $voucher = null, $result = null, $voucherType = null, $isReferralCode = null, $filters = null, $sourceId = null, string $contentType = self::contentTypes['listPublications'][0]) + { + list($response) = $this->listPublicationsWithHttpInfo($limit, $page, $order, $campaign, $customer, $voucher, $result, $voucherType, $isReferralCode, $filters, $sourceId, $contentType); + return $response; + } + + /** + * Operation listPublicationsWithHttpInfo + * + * List Publications + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPublications $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $campaign Filters by a given campaign name. (optional) + * @param string $customer Filters by a unique customer ID. (optional) + * @param string $voucher Filters by a given voucher code. (optional) + * @param ParameterResultListPublications $result Filters by a publication result. (optional) + * @param ParameterVoucherTypeListPublications $voucherType Filters by a voucher type. (optional) + * @param bool $isReferralCode This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. (optional) + * @param string $filters Allows for combining the filters mentioned in the endpoint description. (optional) + * @param string $sourceId Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPublications'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\PublicationsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listPublicationsWithHttpInfo($limit = null, $page = null, $order = null, $campaign = null, $customer = null, $voucher = null, $result = null, $voucherType = null, $isReferralCode = null, $filters = null, $sourceId = null, string $contentType = self::contentTypes['listPublications'][0]) + { + $request = $this->listPublicationsRequest($limit, $page, $order, $campaign, $customer, $voucher, $result, $voucherType, $isReferralCode, $filters, $sourceId, $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\PublicationsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\PublicationsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\PublicationsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\PublicationsListResponseBody'; + 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\PublicationsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listPublicationsAsync + * + * List Publications + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPublications $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $campaign Filters by a given campaign name. (optional) + * @param string $customer Filters by a unique customer ID. (optional) + * @param string $voucher Filters by a given voucher code. (optional) + * @param ParameterResultListPublications $result Filters by a publication result. (optional) + * @param ParameterVoucherTypeListPublications $voucherType Filters by a voucher type. (optional) + * @param bool $isReferralCode This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. (optional) + * @param string $filters Allows for combining the filters mentioned in the endpoint description. (optional) + * @param string $sourceId Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPublications'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPublicationsAsync($limit = null, $page = null, $order = null, $campaign = null, $customer = null, $voucher = null, $result = null, $voucherType = null, $isReferralCode = null, $filters = null, $sourceId = null, string $contentType = self::contentTypes['listPublications'][0]) + { + return $this->listPublicationsAsyncWithHttpInfo($limit, $page, $order, $campaign, $customer, $voucher, $result, $voucherType, $isReferralCode, $filters, $sourceId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listPublicationsAsyncWithHttpInfo + * + * List Publications + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPublications $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $campaign Filters by a given campaign name. (optional) + * @param string $customer Filters by a unique customer ID. (optional) + * @param string $voucher Filters by a given voucher code. (optional) + * @param ParameterResultListPublications $result Filters by a publication result. (optional) + * @param ParameterVoucherTypeListPublications $voucherType Filters by a voucher type. (optional) + * @param bool $isReferralCode This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. (optional) + * @param string $filters Allows for combining the filters mentioned in the endpoint description. (optional) + * @param string $sourceId Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPublications'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPublicationsAsyncWithHttpInfo($limit = null, $page = null, $order = null, $campaign = null, $customer = null, $voucher = null, $result = null, $voucherType = null, $isReferralCode = null, $filters = null, $sourceId = null, string $contentType = self::contentTypes['listPublications'][0]) + { + $returnType = '\OpenAPI\Client\Model\PublicationsListResponseBody'; + $request = $this->listPublicationsRequest($limit, $page, $order, $campaign, $customer, $voucher, $result, $voucherType, $isReferralCode, $filters, $sourceId, $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 'listPublications' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListPublications $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $campaign Filters by a given campaign name. (optional) + * @param string $customer Filters by a unique customer ID. (optional) + * @param string $voucher Filters by a given voucher code. (optional) + * @param ParameterResultListPublications $result Filters by a publication result. (optional) + * @param ParameterVoucherTypeListPublications $voucherType Filters by a voucher type. (optional) + * @param bool $isReferralCode This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. (optional) + * @param string $filters Allows for combining the filters mentioned in the endpoint description. (optional) + * @param string $sourceId Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPublications'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listPublicationsRequest($limit = null, $page = null, $order = null, $campaign = null, $customer = null, $voucher = null, $result = null, $voucherType = null, $isReferralCode = null, $filters = null, $sourceId = null, string $contentType = self::contentTypes['listPublications'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PublicationsApi.listPublications, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling PublicationsApi.listPublications, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling PublicationsApi.listPublications, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling PublicationsApi.listPublications, must be bigger than or equal to 1.'); + } + + + + + + + + + + + + $resourcePath = '/v1/publications'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListPublications', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaign, + 'campaign', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $customer, + 'customer', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $voucher, + 'voucher', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $result, + 'result', // param base name + 'ParameterResultListPublications', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $voucherType, + 'voucher_type', // param base name + 'ParameterVoucherTypeListPublications', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $isReferralCode, + 'is_referral_code', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filters, + 'filters', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sourceId, + 'source_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $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/Api/QualificationsApi.php b/src/Api/QualificationsApi.php new file mode 100644 index 0000000..aaba007 --- /dev/null +++ b/src/Api/QualificationsApi.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 checkEligibility + * + * Check Eligibility + * + * @param \OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody $qualificationsCheckEligibilityRequestBody Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibility'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\QualificationsCheckEligibilityResponseBody + */ + public function checkEligibility($qualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibility'][0]) + { + list($response) = $this->checkEligibilityWithHttpInfo($qualificationsCheckEligibilityRequestBody, $contentType); + return $response; + } + + /** + * Operation checkEligibilityWithHttpInfo + * + * Check Eligibility + * + * @param \OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody $qualificationsCheckEligibilityRequestBody Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibility'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\QualificationsCheckEligibilityResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function checkEligibilityWithHttpInfo($qualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibility'][0]) + { + $request = $this->checkEligibilityRequest($qualificationsCheckEligibilityRequestBody, $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\QualificationsCheckEligibilityResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\QualificationsCheckEligibilityResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\QualificationsCheckEligibilityResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\QualificationsCheckEligibilityResponseBody'; + 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\QualificationsCheckEligibilityResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation checkEligibilityAsync + * + * Check Eligibility + * + * @param \OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody $qualificationsCheckEligibilityRequestBody Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibility'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function checkEligibilityAsync($qualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibility'][0]) + { + return $this->checkEligibilityAsyncWithHttpInfo($qualificationsCheckEligibilityRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation checkEligibilityAsyncWithHttpInfo + * + * Check Eligibility + * + * @param \OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody $qualificationsCheckEligibilityRequestBody Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibility'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function checkEligibilityAsyncWithHttpInfo($qualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibility'][0]) + { + $returnType = '\OpenAPI\Client\Model\QualificationsCheckEligibilityResponseBody'; + $request = $this->checkEligibilityRequest($qualificationsCheckEligibilityRequestBody, $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 'checkEligibility' + * + * @param \OpenAPI\Client\Model\QualificationsCheckEligibilityRequestBody $qualificationsCheckEligibilityRequestBody Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibility'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function checkEligibilityRequest($qualificationsCheckEligibilityRequestBody = null, string $contentType = self::contentTypes['checkEligibility'][0]) + { + + + + $resourcePath = '/v1/qualifications'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($qualificationsCheckEligibilityRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($qualificationsCheckEligibilityRequestBody)); + } else { + $httpBody = $qualificationsCheckEligibilityRequestBody; + } + } 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/Api/RedemptionsApi.php b/src/Api/RedemptionsApi.php new file mode 100644 index 0000000..3557b02 --- /dev/null +++ b/src/Api/RedemptionsApi.php @@ -0,0 +1,2108 @@ + [ + 'application/json', + ], + 'getVoucherRedemptions' => [ + 'application/json', + ], + 'listRedemptions' => [ + 'application/json', + ], + 'redeemStackedDiscounts' => [ + 'application/json', + ], + 'rollbackRedemption' => [ + 'application/json', + ], + 'rollbackStackedRedemptions' => [ + '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 getRedemption + * + * Get Redemption + * + * @param string $redemptionId ID of previously created redemption. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRedemption'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBody + */ + public function getRedemption($redemptionId, string $contentType = self::contentTypes['getRedemption'][0]) + { + list($response) = $this->getRedemptionWithHttpInfo($redemptionId, $contentType); + return $response; + } + + /** + * Operation getRedemptionWithHttpInfo + * + * Get Redemption + * + * @param string $redemptionId ID of previously created redemption. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRedemption'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RedemptionsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getRedemptionWithHttpInfo($redemptionId, string $contentType = self::contentTypes['getRedemption'][0]) + { + $request = $this->getRedemptionRequest($redemptionId, $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\RedemptionsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RedemptionsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RedemptionsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RedemptionsGetResponseBody'; + 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\RedemptionsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRedemptionAsync + * + * Get Redemption + * + * @param string $redemptionId ID of previously created redemption. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRedemption'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRedemptionAsync($redemptionId, string $contentType = self::contentTypes['getRedemption'][0]) + { + return $this->getRedemptionAsyncWithHttpInfo($redemptionId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRedemptionAsyncWithHttpInfo + * + * Get Redemption + * + * @param string $redemptionId ID of previously created redemption. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRedemption'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRedemptionAsyncWithHttpInfo($redemptionId, string $contentType = self::contentTypes['getRedemption'][0]) + { + $returnType = '\OpenAPI\Client\Model\RedemptionsGetResponseBody'; + $request = $this->getRedemptionRequest($redemptionId, $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 'getRedemption' + * + * @param string $redemptionId ID of previously created redemption. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRedemption'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRedemptionRequest($redemptionId, string $contentType = self::contentTypes['getRedemption'][0]) + { + + // verify the required parameter 'redemptionId' is set + if ($redemptionId === null || (is_array($redemptionId) && count($redemptionId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $redemptionId when calling getRedemption' + ); + } + + + $resourcePath = '/v1/redemptions/{redemptionId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($redemptionId !== null) { + $resourcePath = str_replace( + '{' . 'redemptionId' . '}', + ObjectSerializer::toPathValue($redemptionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getVoucherRedemptions + * + * Get Voucher's Redemptions + * + * @param string $code A **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucherRedemptions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersRedemptionGetResponseBody + */ + public function getVoucherRedemptions($code, string $contentType = self::contentTypes['getVoucherRedemptions'][0]) + { + list($response) = $this->getVoucherRedemptionsWithHttpInfo($code, $contentType); + return $response; + } + + /** + * Operation getVoucherRedemptionsWithHttpInfo + * + * Get Voucher's Redemptions + * + * @param string $code A **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucherRedemptions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersRedemptionGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getVoucherRedemptionsWithHttpInfo($code, string $contentType = self::contentTypes['getVoucherRedemptions'][0]) + { + $request = $this->getVoucherRedemptionsRequest($code, $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\VouchersRedemptionGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersRedemptionGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersRedemptionGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersRedemptionGetResponseBody'; + 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\VouchersRedemptionGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getVoucherRedemptionsAsync + * + * Get Voucher's Redemptions + * + * @param string $code A **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucherRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getVoucherRedemptionsAsync($code, string $contentType = self::contentTypes['getVoucherRedemptions'][0]) + { + return $this->getVoucherRedemptionsAsyncWithHttpInfo($code, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getVoucherRedemptionsAsyncWithHttpInfo + * + * Get Voucher's Redemptions + * + * @param string $code A **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucherRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getVoucherRedemptionsAsyncWithHttpInfo($code, string $contentType = self::contentTypes['getVoucherRedemptions'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersRedemptionGetResponseBody'; + $request = $this->getVoucherRedemptionsRequest($code, $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 'getVoucherRedemptions' + * + * @param string $code A **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucherRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getVoucherRedemptionsRequest($code, string $contentType = self::contentTypes['getVoucherRedemptions'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling getVoucherRedemptions' + ); + } + + + $resourcePath = '/v1/vouchers/{code}/redemption'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listRedemptions + * + * List Redemptions + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $result A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. (optional) + * @param string $campaign A filter by the campaign **name** that the redemption resources originate from. (optional) + * @param string $customer Return redemptions performed by the customer with given id or source_id. (optional) + * @param ParameterOrderListRedemptions $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterFiltersListRedemptions $filters Filters for listing responses. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRedemptions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RedemptionsListResponseBody + */ + public function listRedemptions($limit = null, $page = null, $result = null, $campaign = null, $customer = null, $order = null, $createdAt = null, $filters = null, string $contentType = self::contentTypes['listRedemptions'][0]) + { + list($response) = $this->listRedemptionsWithHttpInfo($limit, $page, $result, $campaign, $customer, $order, $createdAt, $filters, $contentType); + return $response; + } + + /** + * Operation listRedemptionsWithHttpInfo + * + * List Redemptions + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $result A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. (optional) + * @param string $campaign A filter by the campaign **name** that the redemption resources originate from. (optional) + * @param string $customer Return redemptions performed by the customer with given id or source_id. (optional) + * @param ParameterOrderListRedemptions $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterFiltersListRedemptions $filters Filters for listing responses. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRedemptions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RedemptionsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listRedemptionsWithHttpInfo($limit = null, $page = null, $result = null, $campaign = null, $customer = null, $order = null, $createdAt = null, $filters = null, string $contentType = self::contentTypes['listRedemptions'][0]) + { + $request = $this->listRedemptionsRequest($limit, $page, $result, $campaign, $customer, $order, $createdAt, $filters, $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\RedemptionsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RedemptionsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RedemptionsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RedemptionsListResponseBody'; + 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\RedemptionsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listRedemptionsAsync + * + * List Redemptions + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $result A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. (optional) + * @param string $campaign A filter by the campaign **name** that the redemption resources originate from. (optional) + * @param string $customer Return redemptions performed by the customer with given id or source_id. (optional) + * @param ParameterOrderListRedemptions $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterFiltersListRedemptions $filters Filters for listing responses. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRedemptionsAsync($limit = null, $page = null, $result = null, $campaign = null, $customer = null, $order = null, $createdAt = null, $filters = null, string $contentType = self::contentTypes['listRedemptions'][0]) + { + return $this->listRedemptionsAsyncWithHttpInfo($limit, $page, $result, $campaign, $customer, $order, $createdAt, $filters, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listRedemptionsAsyncWithHttpInfo + * + * List Redemptions + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $result A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. (optional) + * @param string $campaign A filter by the campaign **name** that the redemption resources originate from. (optional) + * @param string $customer Return redemptions performed by the customer with given id or source_id. (optional) + * @param ParameterOrderListRedemptions $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterFiltersListRedemptions $filters Filters for listing responses. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRedemptionsAsyncWithHttpInfo($limit = null, $page = null, $result = null, $campaign = null, $customer = null, $order = null, $createdAt = null, $filters = null, string $contentType = self::contentTypes['listRedemptions'][0]) + { + $returnType = '\OpenAPI\Client\Model\RedemptionsListResponseBody'; + $request = $this->listRedemptionsRequest($limit, $page, $result, $campaign, $customer, $order, $createdAt, $filters, $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 'listRedemptions' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $result A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. (optional) + * @param string $campaign A filter by the campaign **name** that the redemption resources originate from. (optional) + * @param string $customer Return redemptions performed by the customer with given id or source_id. (optional) + * @param ParameterOrderListRedemptions $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterFiltersListRedemptions $filters Filters for listing responses. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listRedemptionsRequest($limit = null, $page = null, $result = null, $campaign = null, $customer = null, $order = null, $createdAt = null, $filters = null, string $contentType = self::contentTypes['listRedemptions'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RedemptionsApi.listRedemptions, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RedemptionsApi.listRedemptions, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling RedemptionsApi.listRedemptions, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling RedemptionsApi.listRedemptions, must be bigger than or equal to 1.'); + } + + + + + + + + + $resourcePath = '/v1/redemptions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $result, + 'result', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaign, + 'campaign', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $customer, + 'customer', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListRedemptions', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdAt, + 'created_at', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $filters, + 'filters', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation redeemStackedDiscounts + * + * Redeem Stackable Discounts + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptionsRedeemRequestBody redemptionsRedeemRequestBody (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($redemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + list($response) = $this->redeemStackedDiscountsWithHttpInfo($redemptionsRedeemRequestBody, $contentType); + return $response; + } + + /** + * Operation redeemStackedDiscountsWithHttpInfo + * + * Redeem Stackable Discounts + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptionsRedeemRequestBody (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($redemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + $request = $this->redeemStackedDiscountsRequest($redemptionsRedeemRequestBody, $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 $redemptionsRedeemRequestBody (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($redemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + return $this->redeemStackedDiscountsAsyncWithHttpInfo($redemptionsRedeemRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation redeemStackedDiscountsAsyncWithHttpInfo + * + * Redeem Stackable Discounts + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptionsRedeemRequestBody (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($redemptionsRedeemRequestBody = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + $returnType = '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody'; + $request = $this->redeemStackedDiscountsRequest($redemptionsRedeemRequestBody, $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 $redemptionsRedeemRequestBody (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($redemptionsRedeemRequestBody = 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($redemptionsRedeemRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($redemptionsRedeemRequestBody)); + } else { + $httpBody = $redemptionsRedeemRequestBody; + } + } 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 + * + * Rollback Redemption + * + * @param string $redemptionId The original redemption ID to be rolled back (undone). (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateRequestBody $redemptionsRollbackCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackRedemption'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBody + */ + public function rollbackRedemption($redemptionId, $reason = null, $trackingId = null, $redemptionsRollbackCreateRequestBody = null, string $contentType = self::contentTypes['rollbackRedemption'][0]) + { + list($response) = $this->rollbackRedemptionWithHttpInfo($redemptionId, $reason, $trackingId, $redemptionsRollbackCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation rollbackRedemptionWithHttpInfo + * + * Rollback Redemption + * + * @param string $redemptionId The original redemption ID to be rolled back (undone). (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateRequestBody $redemptionsRollbackCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackRedemption'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function rollbackRedemptionWithHttpInfo($redemptionId, $reason = null, $trackingId = null, $redemptionsRollbackCreateRequestBody = null, string $contentType = self::contentTypes['rollbackRedemption'][0]) + { + $request = $this->rollbackRedemptionRequest($redemptionId, $reason, $trackingId, $redemptionsRollbackCreateRequestBody, $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\RedemptionsRollbackCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBody'; + 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\RedemptionsRollbackCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation rollbackRedemptionAsync + * + * Rollback Redemption + * + * @param string $redemptionId The original redemption ID to be rolled back (undone). (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateRequestBody $redemptionsRollbackCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackRedemption'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function rollbackRedemptionAsync($redemptionId, $reason = null, $trackingId = null, $redemptionsRollbackCreateRequestBody = null, string $contentType = self::contentTypes['rollbackRedemption'][0]) + { + return $this->rollbackRedemptionAsyncWithHttpInfo($redemptionId, $reason, $trackingId, $redemptionsRollbackCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation rollbackRedemptionAsyncWithHttpInfo + * + * Rollback Redemption + * + * @param string $redemptionId The original redemption ID to be rolled back (undone). (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateRequestBody $redemptionsRollbackCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackRedemption'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function rollbackRedemptionAsyncWithHttpInfo($redemptionId, $reason = null, $trackingId = null, $redemptionsRollbackCreateRequestBody = null, string $contentType = self::contentTypes['rollbackRedemption'][0]) + { + $returnType = '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBody'; + $request = $this->rollbackRedemptionRequest($redemptionId, $reason, $trackingId, $redemptionsRollbackCreateRequestBody, $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 'rollbackRedemption' + * + * @param string $redemptionId The original redemption ID to be rolled back (undone). (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateRequestBody $redemptionsRollbackCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackRedemption'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function rollbackRedemptionRequest($redemptionId, $reason = null, $trackingId = null, $redemptionsRollbackCreateRequestBody = null, string $contentType = self::contentTypes['rollbackRedemption'][0]) + { + + // verify the required parameter 'redemptionId' is set + if ($redemptionId === null || (is_array($redemptionId) && count($redemptionId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $redemptionId when calling rollbackRedemption' + ); + } + + + + + + $resourcePath = '/v1/redemptions/{redemptionId}/rollback'; + $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( + $trackingId, + 'tracking_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($redemptionId !== null) { + $resourcePath = str_replace( + '{' . 'redemptionId' . '}', + ObjectSerializer::toPathValue($redemptionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($redemptionsRollbackCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($redemptionsRollbackCreateRequestBody)); + } else { + $httpBody = $redemptionsRollbackCreateRequestBody; + } + } 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 rollbackStackedRedemptions + * + * Rollback Stackable Redemptions + * + * @param string $parentRedemptionId Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $redemptionsRollbacksCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @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($parentRedemptionId, $reason = null, $trackingId = null, $redemptionsRollbacksCreateRequestBody = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + list($response) = $this->rollbackStackedRedemptionsWithHttpInfo($parentRedemptionId, $reason, $trackingId, $redemptionsRollbacksCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation rollbackStackedRedemptionsWithHttpInfo + * + * Rollback Stackable Redemptions + * + * @param string $parentRedemptionId Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $redemptionsRollbacksCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @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($parentRedemptionId, $reason = null, $trackingId = null, $redemptionsRollbacksCreateRequestBody = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + $request = $this->rollbackStackedRedemptionsRequest($parentRedemptionId, $reason, $trackingId, $redemptionsRollbacksCreateRequestBody, $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 $parentRedemptionId Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $redemptionsRollbacksCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @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($parentRedemptionId, $reason = null, $trackingId = null, $redemptionsRollbacksCreateRequestBody = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + return $this->rollbackStackedRedemptionsAsyncWithHttpInfo($parentRedemptionId, $reason, $trackingId, $redemptionsRollbacksCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation rollbackStackedRedemptionsAsyncWithHttpInfo + * + * Rollback Stackable Redemptions + * + * @param string $parentRedemptionId Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $redemptionsRollbacksCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @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($parentRedemptionId, $reason = null, $trackingId = null, $redemptionsRollbacksCreateRequestBody = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + $returnType = '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody'; + $request = $this->rollbackStackedRedemptionsRequest($parentRedemptionId, $reason, $trackingId, $redemptionsRollbacksCreateRequestBody, $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 $parentRedemptionId Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $trackingId Customers source_id. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $redemptionsRollbacksCreateRequestBody Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + * @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($parentRedemptionId, $reason = null, $trackingId = null, $redemptionsRollbacksCreateRequestBody = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + + // verify the required parameter 'parentRedemptionId' is set + if ($parentRedemptionId === null || (is_array($parentRedemptionId) && count($parentRedemptionId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $parentRedemptionId 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( + $trackingId, + 'tracking_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($parentRedemptionId !== null) { + $resourcePath = str_replace( + '{' . 'parentRedemptionId' . '}', + ObjectSerializer::toPathValue($parentRedemptionId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($redemptionsRollbacksCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($redemptionsRollbacksCreateRequestBody)); + } else { + $httpBody = $redemptionsRollbacksCreateRequestBody; + } + } 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/Api/RewardsApi.php b/src/Api/RewardsApi.php new file mode 100644 index 0000000..58f85a8 --- /dev/null +++ b/src/Api/RewardsApi.php @@ -0,0 +1,3164 @@ + [ + 'application/json', + ], + 'createRewardAssignment' => [ + 'application/json', + ], + 'deleteReward' => [ + 'application/json', + ], + 'deleteRewardAssignment' => [ + 'application/json', + ], + 'getReward' => [ + 'application/json', + ], + 'getRewardAssignment' => [ + 'application/json', + ], + 'listRewardAssignments' => [ + 'application/json', + ], + 'listRewards' => [ + 'application/json', + ], + 'updateReward' => [ + 'application/json', + ], + 'updateRewardAssignment' => [ + '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 createReward + * + * Create Reward + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBody $rewardsCreateRequestBody Define parameters of the new reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RewardsCreateResponseBody + */ + public function createReward($rewardsCreateRequestBody = null, string $contentType = self::contentTypes['createReward'][0]) + { + list($response) = $this->createRewardWithHttpInfo($rewardsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createRewardWithHttpInfo + * + * Create Reward + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBody $rewardsCreateRequestBody Define parameters of the new reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RewardsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createRewardWithHttpInfo($rewardsCreateRequestBody = null, string $contentType = self::contentTypes['createReward'][0]) + { + $request = $this->createRewardRequest($rewardsCreateRequestBody, $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\RewardsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RewardsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RewardsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RewardsCreateResponseBody'; + 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\RewardsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createRewardAsync + * + * Create Reward + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBody $rewardsCreateRequestBody Define parameters of the new reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRewardAsync($rewardsCreateRequestBody = null, string $contentType = self::contentTypes['createReward'][0]) + { + return $this->createRewardAsyncWithHttpInfo($rewardsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createRewardAsyncWithHttpInfo + * + * Create Reward + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBody $rewardsCreateRequestBody Define parameters of the new reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRewardAsyncWithHttpInfo($rewardsCreateRequestBody = null, string $contentType = self::contentTypes['createReward'][0]) + { + $returnType = '\OpenAPI\Client\Model\RewardsCreateResponseBody'; + $request = $this->createRewardRequest($rewardsCreateRequestBody, $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 'createReward' + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBody $rewardsCreateRequestBody Define parameters of the new reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRewardRequest($rewardsCreateRequestBody = null, string $contentType = self::contentTypes['createReward'][0]) + { + + + + $resourcePath = '/v1/rewards'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($rewardsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rewardsCreateRequestBody)); + } else { + $httpBody = $rewardsCreateRequestBody; + } + } 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 createRewardAssignment + * + * Create Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBody $rewardsAssignmentsCreateRequestBody Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBody + */ + public function createRewardAssignment($rewardId, $rewardsAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment'][0]) + { + list($response) = $this->createRewardAssignmentWithHttpInfo($rewardId, $rewardsAssignmentsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createRewardAssignmentWithHttpInfo + * + * Create Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBody $rewardsAssignmentsCreateRequestBody Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createRewardAssignmentWithHttpInfo($rewardId, $rewardsAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment'][0]) + { + $request = $this->createRewardAssignmentRequest($rewardId, $rewardsAssignmentsCreateRequestBody, $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\RewardsAssignmentsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBody'; + 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\RewardsAssignmentsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createRewardAssignmentAsync + * + * Create Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBody $rewardsAssignmentsCreateRequestBody Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRewardAssignmentAsync($rewardId, $rewardsAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment'][0]) + { + return $this->createRewardAssignmentAsyncWithHttpInfo($rewardId, $rewardsAssignmentsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createRewardAssignmentAsyncWithHttpInfo + * + * Create Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBody $rewardsAssignmentsCreateRequestBody Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createRewardAssignmentAsyncWithHttpInfo($rewardId, $rewardsAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment'][0]) + { + $returnType = '\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBody'; + $request = $this->createRewardAssignmentRequest($rewardId, $rewardsAssignmentsCreateRequestBody, $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 'createRewardAssignment' + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBody $rewardsAssignmentsCreateRequestBody Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRewardAssignmentRequest($rewardId, $rewardsAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createRewardAssignment'][0]) + { + + // verify the required parameter 'rewardId' is set + if ($rewardId === null || (is_array($rewardId) && count($rewardId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rewardId when calling createRewardAssignment' + ); + } + + + + $resourcePath = '/v1/rewards/{rewardId}/assignments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($rewardId !== null) { + $resourcePath = str_replace( + '{' . 'rewardId' . '}', + ObjectSerializer::toPathValue($rewardId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($rewardsAssignmentsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rewardsAssignmentsCreateRequestBody)); + } else { + $httpBody = $rewardsAssignmentsCreateRequestBody; + } + } 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 deleteReward + * + * Delete Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteReward($rewardId, string $contentType = self::contentTypes['deleteReward'][0]) + { + $this->deleteRewardWithHttpInfo($rewardId, $contentType); + } + + /** + * Operation deleteRewardWithHttpInfo + * + * Delete Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteReward'] 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 deleteRewardWithHttpInfo($rewardId, string $contentType = self::contentTypes['deleteReward'][0]) + { + $request = $this->deleteRewardRequest($rewardId, $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 deleteRewardAsync + * + * Delete Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteRewardAsync($rewardId, string $contentType = self::contentTypes['deleteReward'][0]) + { + return $this->deleteRewardAsyncWithHttpInfo($rewardId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteRewardAsyncWithHttpInfo + * + * Delete Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteRewardAsyncWithHttpInfo($rewardId, string $contentType = self::contentTypes['deleteReward'][0]) + { + $returnType = ''; + $request = $this->deleteRewardRequest($rewardId, $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 'deleteReward' + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteRewardRequest($rewardId, string $contentType = self::contentTypes['deleteReward'][0]) + { + + // verify the required parameter 'rewardId' is set + if ($rewardId === null || (is_array($rewardId) && count($rewardId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rewardId when calling deleteReward' + ); + } + + + $resourcePath = '/v1/rewards/{rewardId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($rewardId !== null) { + $resourcePath = str_replace( + '{' . 'rewardId' . '}', + ObjectSerializer::toPathValue($rewardId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteRewardAssignment + * + * Delete Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteRewardAssignment($rewardId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment'][0]) + { + $this->deleteRewardAssignmentWithHttpInfo($rewardId, $assignmentId, $contentType); + } + + /** + * Operation deleteRewardAssignmentWithHttpInfo + * + * Delete Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment'] 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 deleteRewardAssignmentWithHttpInfo($rewardId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment'][0]) + { + $request = $this->deleteRewardAssignmentRequest($rewardId, $assignmentId, $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 deleteRewardAssignmentAsync + * + * Delete Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteRewardAssignmentAsync($rewardId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment'][0]) + { + return $this->deleteRewardAssignmentAsyncWithHttpInfo($rewardId, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteRewardAssignmentAsyncWithHttpInfo + * + * Delete Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteRewardAssignmentAsyncWithHttpInfo($rewardId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment'][0]) + { + $returnType = ''; + $request = $this->deleteRewardAssignmentRequest($rewardId, $assignmentId, $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 'deleteRewardAssignment' + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteRewardAssignmentRequest($rewardId, $assignmentId, string $contentType = self::contentTypes['deleteRewardAssignment'][0]) + { + + // verify the required parameter 'rewardId' is set + if ($rewardId === null || (is_array($rewardId) && count($rewardId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rewardId when calling deleteRewardAssignment' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling deleteRewardAssignment' + ); + } + + + $resourcePath = '/v1/rewards/{rewardId}/assignments/{assignmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($rewardId !== null) { + $resourcePath = str_replace( + '{' . 'rewardId' . '}', + ObjectSerializer::toPathValue($rewardId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getReward + * + * Get Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Reward + */ + public function getReward($rewardId, string $contentType = self::contentTypes['getReward'][0]) + { + list($response) = $this->getRewardWithHttpInfo($rewardId, $contentType); + return $response; + } + + /** + * Operation getRewardWithHttpInfo + * + * Get Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Reward, HTTP status code, HTTP response headers (array of strings) + */ + public function getRewardWithHttpInfo($rewardId, string $contentType = self::contentTypes['getReward'][0]) + { + $request = $this->getRewardRequest($rewardId, $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\Reward' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Reward' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Reward', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Reward'; + 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\Reward', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRewardAsync + * + * Get Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardAsync($rewardId, string $contentType = self::contentTypes['getReward'][0]) + { + return $this->getRewardAsyncWithHttpInfo($rewardId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRewardAsyncWithHttpInfo + * + * Get Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardAsyncWithHttpInfo($rewardId, string $contentType = self::contentTypes['getReward'][0]) + { + $returnType = '\OpenAPI\Client\Model\Reward'; + $request = $this->getRewardRequest($rewardId, $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 'getReward' + * + * @param string $rewardId A unique reward ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRewardRequest($rewardId, string $contentType = self::contentTypes['getReward'][0]) + { + + // verify the required parameter 'rewardId' is set + if ($rewardId === null || (is_array($rewardId) && count($rewardId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rewardId when calling getReward' + ); + } + + + $resourcePath = '/v1/rewards/{rewardId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($rewardId !== null) { + $resourcePath = str_replace( + '{' . 'rewardId' . '}', + ObjectSerializer::toPathValue($rewardId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getRewardAssignment + * + * Get Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RewardsAssignmentsGetResponseBody + */ + public function getRewardAssignment($rewardId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment'][0]) + { + list($response) = $this->getRewardAssignmentWithHttpInfo($rewardId, $assignmentId, $contentType); + return $response; + } + + /** + * Operation getRewardAssignmentWithHttpInfo + * + * Get Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RewardsAssignmentsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getRewardAssignmentWithHttpInfo($rewardId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment'][0]) + { + $request = $this->getRewardAssignmentRequest($rewardId, $assignmentId, $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\RewardsAssignmentsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBody'; + 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\RewardsAssignmentsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getRewardAssignmentAsync + * + * Get Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardAssignmentAsync($rewardId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment'][0]) + { + return $this->getRewardAssignmentAsyncWithHttpInfo($rewardId, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRewardAssignmentAsyncWithHttpInfo + * + * Get Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getRewardAssignmentAsyncWithHttpInfo($rewardId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment'][0]) + { + $returnType = '\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBody'; + $request = $this->getRewardAssignmentRequest($rewardId, $assignmentId, $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 'getRewardAssignment' + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRewardAssignmentRequest($rewardId, $assignmentId, string $contentType = self::contentTypes['getRewardAssignment'][0]) + { + + // verify the required parameter 'rewardId' is set + if ($rewardId === null || (is_array($rewardId) && count($rewardId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rewardId when calling getRewardAssignment' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling getRewardAssignment' + ); + } + + + $resourcePath = '/v1/rewards/{rewardId}/assignments/{assignmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($rewardId !== null) { + $resourcePath = str_replace( + '{' . 'rewardId' . '}', + ObjectSerializer::toPathValue($rewardId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listRewardAssignments + * + * List Reward Assignments + * + * @param string $rewardId A unique reward ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RewardsAssignmentsListResponseBody + */ + public function listRewardAssignments($rewardId, $limit = null, $page = null, string $contentType = self::contentTypes['listRewardAssignments'][0]) + { + list($response) = $this->listRewardAssignmentsWithHttpInfo($rewardId, $limit, $page, $contentType); + return $response; + } + + /** + * Operation listRewardAssignmentsWithHttpInfo + * + * List Reward Assignments + * + * @param string $rewardId A unique reward ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RewardsAssignmentsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listRewardAssignmentsWithHttpInfo($rewardId, $limit = null, $page = null, string $contentType = self::contentTypes['listRewardAssignments'][0]) + { + $request = $this->listRewardAssignmentsRequest($rewardId, $limit, $page, $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\RewardsAssignmentsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RewardsAssignmentsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RewardsAssignmentsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RewardsAssignmentsListResponseBody'; + 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\RewardsAssignmentsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listRewardAssignmentsAsync + * + * List Reward Assignments + * + * @param string $rewardId A unique reward ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRewardAssignmentsAsync($rewardId, $limit = null, $page = null, string $contentType = self::contentTypes['listRewardAssignments'][0]) + { + return $this->listRewardAssignmentsAsyncWithHttpInfo($rewardId, $limit, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listRewardAssignmentsAsyncWithHttpInfo + * + * List Reward Assignments + * + * @param string $rewardId A unique reward ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRewardAssignmentsAsyncWithHttpInfo($rewardId, $limit = null, $page = null, string $contentType = self::contentTypes['listRewardAssignments'][0]) + { + $returnType = '\OpenAPI\Client\Model\RewardsAssignmentsListResponseBody'; + $request = $this->listRewardAssignmentsRequest($rewardId, $limit, $page, $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 'listRewardAssignments' + * + * @param string $rewardId A unique reward ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewardAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listRewardAssignmentsRequest($rewardId, $limit = null, $page = null, string $contentType = self::contentTypes['listRewardAssignments'][0]) + { + + // verify the required parameter 'rewardId' is set + if ($rewardId === null || (is_array($rewardId) && count($rewardId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rewardId when calling listRewardAssignments' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RewardsApi.listRewardAssignments, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RewardsApi.listRewardAssignments, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling RewardsApi.listRewardAssignments, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling RewardsApi.listRewardAssignments, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/v1/rewards/{rewardId}/assignments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($rewardId !== null) { + $resourcePath = str_replace( + '{' . 'rewardId' . '}', + ObjectSerializer::toPathValue($rewardId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listRewards + * + * List Rewards + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewards'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RewardsListResponseBody + */ + public function listRewards($limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewards'][0]) + { + list($response) = $this->listRewardsWithHttpInfo($limit, $page, $assignmentId, $contentType); + return $response; + } + + /** + * Operation listRewardsWithHttpInfo + * + * List Rewards + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewards'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RewardsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listRewardsWithHttpInfo($limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewards'][0]) + { + $request = $this->listRewardsRequest($limit, $page, $assignmentId, $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\RewardsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RewardsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RewardsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RewardsListResponseBody'; + 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\RewardsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listRewardsAsync + * + * List Rewards + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRewardsAsync($limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewards'][0]) + { + return $this->listRewardsAsyncWithHttpInfo($limit, $page, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listRewardsAsyncWithHttpInfo + * + * List Rewards + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listRewardsAsyncWithHttpInfo($limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewards'][0]) + { + $returnType = '\OpenAPI\Client\Model\RewardsListResponseBody'; + $request = $this->listRewardsRequest($limit, $page, $assignmentId, $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 'listRewards' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $assignmentId A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRewards'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listRewardsRequest($limit = null, $page = null, $assignmentId = null, string $contentType = self::contentTypes['listRewards'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RewardsApi.listRewards, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling RewardsApi.listRewards, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling RewardsApi.listRewards, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling RewardsApi.listRewards, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/rewards'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $assignmentId, + 'assignment_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateReward + * + * Update Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBody $rewardsUpdateRequestBody Define the parameters to be updated for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RewardsUpdateResponseBody + */ + public function updateReward($rewardId, $rewardsUpdateRequestBody = null, string $contentType = self::contentTypes['updateReward'][0]) + { + list($response) = $this->updateRewardWithHttpInfo($rewardId, $rewardsUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateRewardWithHttpInfo + * + * Update Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBody $rewardsUpdateRequestBody Define the parameters to be updated for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateReward'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RewardsUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateRewardWithHttpInfo($rewardId, $rewardsUpdateRequestBody = null, string $contentType = self::contentTypes['updateReward'][0]) + { + $request = $this->updateRewardRequest($rewardId, $rewardsUpdateRequestBody, $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\RewardsUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RewardsUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RewardsUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RewardsUpdateResponseBody'; + 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\RewardsUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateRewardAsync + * + * Update Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBody $rewardsUpdateRequestBody Define the parameters to be updated for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateRewardAsync($rewardId, $rewardsUpdateRequestBody = null, string $contentType = self::contentTypes['updateReward'][0]) + { + return $this->updateRewardAsyncWithHttpInfo($rewardId, $rewardsUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateRewardAsyncWithHttpInfo + * + * Update Reward + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBody $rewardsUpdateRequestBody Define the parameters to be updated for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateRewardAsyncWithHttpInfo($rewardId, $rewardsUpdateRequestBody = null, string $contentType = self::contentTypes['updateReward'][0]) + { + $returnType = '\OpenAPI\Client\Model\RewardsUpdateResponseBody'; + $request = $this->updateRewardRequest($rewardId, $rewardsUpdateRequestBody, $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 'updateReward' + * + * @param string $rewardId A unique reward ID. (required) + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBody $rewardsUpdateRequestBody Define the parameters to be updated for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateReward'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRewardRequest($rewardId, $rewardsUpdateRequestBody = null, string $contentType = self::contentTypes['updateReward'][0]) + { + + // verify the required parameter 'rewardId' is set + if ($rewardId === null || (is_array($rewardId) && count($rewardId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rewardId when calling updateReward' + ); + } + + + + $resourcePath = '/v1/rewards/{rewardId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($rewardId !== null) { + $resourcePath = str_replace( + '{' . 'rewardId' . '}', + ObjectSerializer::toPathValue($rewardId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($rewardsUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rewardsUpdateRequestBody)); + } else { + $httpBody = $rewardsUpdateRequestBody; + } + } 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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateRewardAssignment + * + * Update Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBody $rewardsAssignmentsUpdateRequestBody Define the number of points required to exchange for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBody + */ + public function updateRewardAssignment($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment'][0]) + { + list($response) = $this->updateRewardAssignmentWithHttpInfo($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateRewardAssignmentWithHttpInfo + * + * Update Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBody $rewardsAssignmentsUpdateRequestBody Define the number of points required to exchange for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateRewardAssignmentWithHttpInfo($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment'][0]) + { + $request = $this->updateRewardAssignmentRequest($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody, $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\RewardsAssignmentsUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBody'; + 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\RewardsAssignmentsUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateRewardAssignmentAsync + * + * Update Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBody $rewardsAssignmentsUpdateRequestBody Define the number of points required to exchange for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateRewardAssignmentAsync($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment'][0]) + { + return $this->updateRewardAssignmentAsyncWithHttpInfo($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateRewardAssignmentAsyncWithHttpInfo + * + * Update Reward Assignment + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBody $rewardsAssignmentsUpdateRequestBody Define the number of points required to exchange for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateRewardAssignmentAsyncWithHttpInfo($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment'][0]) + { + $returnType = '\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBody'; + $request = $this->updateRewardAssignmentRequest($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody, $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 'updateRewardAssignment' + * + * @param string $rewardId A unique reward ID. (required) + * @param string $assignmentId A unique reward assignment ID. (required) + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBody $rewardsAssignmentsUpdateRequestBody Define the number of points required to exchange for the reward. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateRewardAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateRewardAssignmentRequest($rewardId, $assignmentId, $rewardsAssignmentsUpdateRequestBody = null, string $contentType = self::contentTypes['updateRewardAssignment'][0]) + { + + // verify the required parameter 'rewardId' is set + if ($rewardId === null || (is_array($rewardId) && count($rewardId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rewardId when calling updateRewardAssignment' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling updateRewardAssignment' + ); + } + + + + $resourcePath = '/v1/rewards/{rewardId}/assignments/{assignmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($rewardId !== null) { + $resourcePath = str_replace( + '{' . 'rewardId' . '}', + ObjectSerializer::toPathValue($rewardId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($rewardsAssignmentsUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($rewardsAssignmentsUpdateRequestBody)); + } else { + $httpBody = $rewardsAssignmentsUpdateRequestBody; + } + } 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( + 'PUT', + $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/Api/SegmentsApi.php b/src/Api/SegmentsApi.php new file mode 100644 index 0000000..1d27f8a --- /dev/null +++ b/src/Api/SegmentsApi.php @@ -0,0 +1,968 @@ + [ + 'application/json', + ], + 'deleteSegment' => [ + 'application/json', + ], + 'getSegment' => [ + '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 createSegment + * + * Create Segment + * + * @param \OpenAPI\Client\Model\SegmentsCreateRequestBody $segmentsCreateRequestBody Specify the boundary conditions for the customer segment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSegment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\SegmentsCreateResponseBody + */ + public function createSegment($segmentsCreateRequestBody = null, string $contentType = self::contentTypes['createSegment'][0]) + { + list($response) = $this->createSegmentWithHttpInfo($segmentsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createSegmentWithHttpInfo + * + * Create Segment + * + * @param \OpenAPI\Client\Model\SegmentsCreateRequestBody $segmentsCreateRequestBody Specify the boundary conditions for the customer segment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSegment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\SegmentsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createSegmentWithHttpInfo($segmentsCreateRequestBody = null, string $contentType = self::contentTypes['createSegment'][0]) + { + $request = $this->createSegmentRequest($segmentsCreateRequestBody, $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\SegmentsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SegmentsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SegmentsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SegmentsCreateResponseBody'; + 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\SegmentsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createSegmentAsync + * + * Create Segment + * + * @param \OpenAPI\Client\Model\SegmentsCreateRequestBody $segmentsCreateRequestBody Specify the boundary conditions for the customer segment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSegmentAsync($segmentsCreateRequestBody = null, string $contentType = self::contentTypes['createSegment'][0]) + { + return $this->createSegmentAsyncWithHttpInfo($segmentsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSegmentAsyncWithHttpInfo + * + * Create Segment + * + * @param \OpenAPI\Client\Model\SegmentsCreateRequestBody $segmentsCreateRequestBody Specify the boundary conditions for the customer segment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSegmentAsyncWithHttpInfo($segmentsCreateRequestBody = null, string $contentType = self::contentTypes['createSegment'][0]) + { + $returnType = '\OpenAPI\Client\Model\SegmentsCreateResponseBody'; + $request = $this->createSegmentRequest($segmentsCreateRequestBody, $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 'createSegment' + * + * @param \OpenAPI\Client\Model\SegmentsCreateRequestBody $segmentsCreateRequestBody Specify the boundary conditions for the customer segment. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createSegmentRequest($segmentsCreateRequestBody = null, string $contentType = self::contentTypes['createSegment'][0]) + { + + + + $resourcePath = '/v1/segments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($segmentsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($segmentsCreateRequestBody)); + } else { + $httpBody = $segmentsCreateRequestBody; + } + } 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 deleteSegment + * + * Delete Segment + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSegment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSegment($segmentId, string $contentType = self::contentTypes['deleteSegment'][0]) + { + $this->deleteSegmentWithHttpInfo($segmentId, $contentType); + } + + /** + * Operation deleteSegmentWithHttpInfo + * + * Delete Segment + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSegment'] 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 deleteSegmentWithHttpInfo($segmentId, string $contentType = self::contentTypes['deleteSegment'][0]) + { + $request = $this->deleteSegmentRequest($segmentId, $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 deleteSegmentAsync + * + * Delete Segment + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSegmentAsync($segmentId, string $contentType = self::contentTypes['deleteSegment'][0]) + { + return $this->deleteSegmentAsyncWithHttpInfo($segmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSegmentAsyncWithHttpInfo + * + * Delete Segment + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSegmentAsyncWithHttpInfo($segmentId, string $contentType = self::contentTypes['deleteSegment'][0]) + { + $returnType = ''; + $request = $this->deleteSegmentRequest($segmentId, $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 'deleteSegment' + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteSegmentRequest($segmentId, string $contentType = self::contentTypes['deleteSegment'][0]) + { + + // verify the required parameter 'segmentId' is set + if ($segmentId === null || (is_array($segmentId) && count($segmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $segmentId when calling deleteSegment' + ); + } + + + $resourcePath = '/v1/segments/{segmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($segmentId !== null) { + $resourcePath = str_replace( + '{' . 'segmentId' . '}', + ObjectSerializer::toPathValue($segmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSegment + * + * Get Segment + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\SegmentsGetResponseBody + */ + public function getSegment($segmentId, string $contentType = self::contentTypes['getSegment'][0]) + { + list($response) = $this->getSegmentWithHttpInfo($segmentId, $contentType); + return $response; + } + + /** + * Operation getSegmentWithHttpInfo + * + * Get Segment + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\SegmentsGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getSegmentWithHttpInfo($segmentId, string $contentType = self::contentTypes['getSegment'][0]) + { + $request = $this->getSegmentRequest($segmentId, $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\SegmentsGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SegmentsGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SegmentsGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SegmentsGetResponseBody'; + 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\SegmentsGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSegmentAsync + * + * Get Segment + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSegmentAsync($segmentId, string $contentType = self::contentTypes['getSegment'][0]) + { + return $this->getSegmentAsyncWithHttpInfo($segmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSegmentAsyncWithHttpInfo + * + * Get Segment + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSegmentAsyncWithHttpInfo($segmentId, string $contentType = self::contentTypes['getSegment'][0]) + { + $returnType = '\OpenAPI\Client\Model\SegmentsGetResponseBody'; + $request = $this->getSegmentRequest($segmentId, $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 'getSegment' + * + * @param string $segmentId A unique customer segment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSegment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getSegmentRequest($segmentId, string $contentType = self::contentTypes['getSegment'][0]) + { + + // verify the required parameter 'segmentId' is set + if ($segmentId === null || (is_array($segmentId) && count($segmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $segmentId when calling getSegment' + ); + } + + + $resourcePath = '/v1/segments/{segmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($segmentId !== null) { + $resourcePath = str_replace( + '{' . 'segmentId' . '}', + ObjectSerializer::toPathValue($segmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $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/Api/ValidationRulesApi.php b/src/Api/ValidationRulesApi.php new file mode 100644 index 0000000..2ad687e --- /dev/null +++ b/src/Api/ValidationRulesApi.php @@ -0,0 +1,2942 @@ + [ + 'application/json', + ], + 'createValidationRules' => [ + 'application/json', + ], + 'deleteValidationRuleAssignment' => [ + 'application/json', + ], + 'deleteValidationRules' => [ + 'application/json', + ], + 'getValidationRule' => [ + 'application/json', + ], + 'listValidationRuleAssignments' => [ + 'application/json', + ], + 'listValidationRules' => [ + 'application/json', + ], + 'listValidationRulesAssignments' => [ + 'application/json', + ], + 'updateValidationRule' => [ + '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 createValidationRuleAssignment + * + * Create Validation Rules Assignments + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param bool $force If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. (optional) + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateRequestBody $validationRulesAssignmentsCreateRequestBody Specify the resource that you would like to assign the validation rule to. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateResponseBody + */ + public function createValidationRuleAssignment($validationRuleId, $force = null, $validationRulesAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRuleAssignment'][0]) + { + list($response) = $this->createValidationRuleAssignmentWithHttpInfo($validationRuleId, $force, $validationRulesAssignmentsCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createValidationRuleAssignmentWithHttpInfo + * + * Create Validation Rules Assignments + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param bool $force If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. (optional) + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateRequestBody $validationRulesAssignmentsCreateRequestBody Specify the resource that you would like to assign the validation rule to. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createValidationRuleAssignmentWithHttpInfo($validationRuleId, $force = null, $validationRulesAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRuleAssignment'][0]) + { + $request = $this->createValidationRuleAssignmentRequest($validationRuleId, $force, $validationRulesAssignmentsCreateRequestBody, $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\ValidationRulesAssignmentsCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ValidationRulesAssignmentsCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationRulesAssignmentsCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ValidationRulesAssignmentsCreateResponseBody'; + 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\ValidationRulesAssignmentsCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createValidationRuleAssignmentAsync + * + * Create Validation Rules Assignments + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param bool $force If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. (optional) + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateRequestBody $validationRulesAssignmentsCreateRequestBody Specify the resource that you would like to assign the validation rule to. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createValidationRuleAssignmentAsync($validationRuleId, $force = null, $validationRulesAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRuleAssignment'][0]) + { + return $this->createValidationRuleAssignmentAsyncWithHttpInfo($validationRuleId, $force, $validationRulesAssignmentsCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createValidationRuleAssignmentAsyncWithHttpInfo + * + * Create Validation Rules Assignments + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param bool $force If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. (optional) + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateRequestBody $validationRulesAssignmentsCreateRequestBody Specify the resource that you would like to assign the validation rule to. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createValidationRuleAssignmentAsyncWithHttpInfo($validationRuleId, $force = null, $validationRulesAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRuleAssignment'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationRulesAssignmentsCreateResponseBody'; + $request = $this->createValidationRuleAssignmentRequest($validationRuleId, $force, $validationRulesAssignmentsCreateRequestBody, $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 'createValidationRuleAssignment' + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param bool $force If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. (optional) + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsCreateRequestBody $validationRulesAssignmentsCreateRequestBody Specify the resource that you would like to assign the validation rule to. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createValidationRuleAssignmentRequest($validationRuleId, $force = null, $validationRulesAssignmentsCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRuleAssignment'][0]) + { + + // verify the required parameter 'validationRuleId' is set + if ($validationRuleId === null || (is_array($validationRuleId) && count($validationRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $validationRuleId when calling createValidationRuleAssignment' + ); + } + + + + + $resourcePath = '/v1/validation-rules/{validationRuleId}/assignments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $force, + 'force', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($validationRuleId !== null) { + $resourcePath = str_replace( + '{' . 'validationRuleId' . '}', + ObjectSerializer::toPathValue($validationRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($validationRulesAssignmentsCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($validationRulesAssignmentsCreateRequestBody)); + } else { + $httpBody = $validationRulesAssignmentsCreateRequestBody; + } + } 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 createValidationRules + * + * Create Validation Rules + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateRequestBody $validationRulesCreateRequestBody Specify the validation rules parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ValidationRulesCreateResponseBody + */ + public function createValidationRules($validationRulesCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRules'][0]) + { + list($response) = $this->createValidationRulesWithHttpInfo($validationRulesCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation createValidationRulesWithHttpInfo + * + * Create Validation Rules + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateRequestBody $validationRulesCreateRequestBody Specify the validation rules parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ValidationRulesCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createValidationRulesWithHttpInfo($validationRulesCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRules'][0]) + { + $request = $this->createValidationRulesRequest($validationRulesCreateRequestBody, $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\ValidationRulesCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ValidationRulesCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationRulesCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ValidationRulesCreateResponseBody'; + 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\ValidationRulesCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createValidationRulesAsync + * + * Create Validation Rules + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateRequestBody $validationRulesCreateRequestBody Specify the validation rules parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createValidationRulesAsync($validationRulesCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRules'][0]) + { + return $this->createValidationRulesAsyncWithHttpInfo($validationRulesCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createValidationRulesAsyncWithHttpInfo + * + * Create Validation Rules + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateRequestBody $validationRulesCreateRequestBody Specify the validation rules parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createValidationRulesAsyncWithHttpInfo($validationRulesCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRules'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationRulesCreateResponseBody'; + $request = $this->createValidationRulesRequest($validationRulesCreateRequestBody, $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 'createValidationRules' + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateRequestBody $validationRulesCreateRequestBody Specify the validation rules parameters. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createValidationRulesRequest($validationRulesCreateRequestBody = null, string $contentType = self::contentTypes['createValidationRules'][0]) + { + + + + $resourcePath = '/v1/validation-rules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($validationRulesCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($validationRulesCreateRequestBody)); + } else { + $httpBody = $validationRulesCreateRequestBody; + } + } 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 deleteValidationRuleAssignment + * + * Delete Validation Rule Assignment + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $assignmentId A unique validation rule assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteValidationRuleAssignment($validationRuleId, $assignmentId, string $contentType = self::contentTypes['deleteValidationRuleAssignment'][0]) + { + $this->deleteValidationRuleAssignmentWithHttpInfo($validationRuleId, $assignmentId, $contentType); + } + + /** + * Operation deleteValidationRuleAssignmentWithHttpInfo + * + * Delete Validation Rule Assignment + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $assignmentId A unique validation rule assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRuleAssignment'] 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 deleteValidationRuleAssignmentWithHttpInfo($validationRuleId, $assignmentId, string $contentType = self::contentTypes['deleteValidationRuleAssignment'][0]) + { + $request = $this->deleteValidationRuleAssignmentRequest($validationRuleId, $assignmentId, $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 deleteValidationRuleAssignmentAsync + * + * Delete Validation Rule Assignment + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $assignmentId A unique validation rule assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteValidationRuleAssignmentAsync($validationRuleId, $assignmentId, string $contentType = self::contentTypes['deleteValidationRuleAssignment'][0]) + { + return $this->deleteValidationRuleAssignmentAsyncWithHttpInfo($validationRuleId, $assignmentId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteValidationRuleAssignmentAsyncWithHttpInfo + * + * Delete Validation Rule Assignment + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $assignmentId A unique validation rule assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteValidationRuleAssignmentAsyncWithHttpInfo($validationRuleId, $assignmentId, string $contentType = self::contentTypes['deleteValidationRuleAssignment'][0]) + { + $returnType = ''; + $request = $this->deleteValidationRuleAssignmentRequest($validationRuleId, $assignmentId, $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 'deleteValidationRuleAssignment' + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $assignmentId A unique validation rule assignment ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRuleAssignment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteValidationRuleAssignmentRequest($validationRuleId, $assignmentId, string $contentType = self::contentTypes['deleteValidationRuleAssignment'][0]) + { + + // verify the required parameter 'validationRuleId' is set + if ($validationRuleId === null || (is_array($validationRuleId) && count($validationRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $validationRuleId when calling deleteValidationRuleAssignment' + ); + } + + // verify the required parameter 'assignmentId' is set + if ($assignmentId === null || (is_array($assignmentId) && count($assignmentId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignmentId when calling deleteValidationRuleAssignment' + ); + } + + + $resourcePath = '/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($validationRuleId !== null) { + $resourcePath = str_replace( + '{' . 'validationRuleId' . '}', + ObjectSerializer::toPathValue($validationRuleId), + $resourcePath + ); + } + // path params + if ($assignmentId !== null) { + $resourcePath = str_replace( + '{' . 'assignmentId' . '}', + ObjectSerializer::toPathValue($assignmentId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteValidationRules + * + * Delete Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteValidationRules($validationRuleId, string $contentType = self::contentTypes['deleteValidationRules'][0]) + { + $this->deleteValidationRulesWithHttpInfo($validationRuleId, $contentType); + } + + /** + * Operation deleteValidationRulesWithHttpInfo + * + * Delete Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRules'] 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 deleteValidationRulesWithHttpInfo($validationRuleId, string $contentType = self::contentTypes['deleteValidationRules'][0]) + { + $request = $this->deleteValidationRulesRequest($validationRuleId, $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 deleteValidationRulesAsync + * + * Delete Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteValidationRulesAsync($validationRuleId, string $contentType = self::contentTypes['deleteValidationRules'][0]) + { + return $this->deleteValidationRulesAsyncWithHttpInfo($validationRuleId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteValidationRulesAsyncWithHttpInfo + * + * Delete Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteValidationRulesAsyncWithHttpInfo($validationRuleId, string $contentType = self::contentTypes['deleteValidationRules'][0]) + { + $returnType = ''; + $request = $this->deleteValidationRulesRequest($validationRuleId, $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 'deleteValidationRules' + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteValidationRulesRequest($validationRuleId, string $contentType = self::contentTypes['deleteValidationRules'][0]) + { + + // verify the required parameter 'validationRuleId' is set + if ($validationRuleId === null || (is_array($validationRuleId) && count($validationRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $validationRuleId when calling deleteValidationRules' + ); + } + + + $resourcePath = '/v1/validation-rules/{validationRuleId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($validationRuleId !== null) { + $resourcePath = str_replace( + '{' . 'validationRuleId' . '}', + ObjectSerializer::toPathValue($validationRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getValidationRule + * + * Get Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ValidationRulesGetResponseBody + */ + public function getValidationRule($validationRuleId, string $contentType = self::contentTypes['getValidationRule'][0]) + { + list($response) = $this->getValidationRuleWithHttpInfo($validationRuleId, $contentType); + return $response; + } + + /** + * Operation getValidationRuleWithHttpInfo + * + * Get Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ValidationRulesGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getValidationRuleWithHttpInfo($validationRuleId, string $contentType = self::contentTypes['getValidationRule'][0]) + { + $request = $this->getValidationRuleRequest($validationRuleId, $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\ValidationRulesGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ValidationRulesGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationRulesGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ValidationRulesGetResponseBody'; + 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\ValidationRulesGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getValidationRuleAsync + * + * Get Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getValidationRuleAsync($validationRuleId, string $contentType = self::contentTypes['getValidationRule'][0]) + { + return $this->getValidationRuleAsyncWithHttpInfo($validationRuleId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getValidationRuleAsyncWithHttpInfo + * + * Get Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getValidationRuleAsyncWithHttpInfo($validationRuleId, string $contentType = self::contentTypes['getValidationRule'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationRulesGetResponseBody'; + $request = $this->getValidationRuleRequest($validationRuleId, $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 'getValidationRule' + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getValidationRuleRequest($validationRuleId, string $contentType = self::contentTypes['getValidationRule'][0]) + { + + // verify the required parameter 'validationRuleId' is set + if ($validationRuleId === null || (is_array($validationRuleId) && count($validationRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $validationRuleId when calling getValidationRule' + ); + } + + + $resourcePath = '/v1/validation-rules/{validationRuleId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($validationRuleId !== null) { + $resourcePath = str_replace( + '{' . 'validationRuleId' . '}', + ObjectSerializer::toPathValue($validationRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listValidationRuleAssignments + * + * List Validation Rule Assignments + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRuleAssignments $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRuleAssignments'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody + */ + public function listValidationRuleAssignments($validationRuleId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listValidationRuleAssignments'][0]) + { + list($response) = $this->listValidationRuleAssignmentsWithHttpInfo($validationRuleId, $limit, $page, $order, $contentType); + return $response; + } + + /** + * Operation listValidationRuleAssignmentsWithHttpInfo + * + * List Validation Rule Assignments + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRuleAssignments $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRuleAssignments'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listValidationRuleAssignmentsWithHttpInfo($validationRuleId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listValidationRuleAssignments'][0]) + { + $request = $this->listValidationRuleAssignmentsRequest($validationRuleId, $limit, $page, $order, $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\ValidationRulesAssignmentsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody'; + 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\ValidationRulesAssignmentsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listValidationRuleAssignmentsAsync + * + * List Validation Rule Assignments + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRuleAssignments $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRuleAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listValidationRuleAssignmentsAsync($validationRuleId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listValidationRuleAssignments'][0]) + { + return $this->listValidationRuleAssignmentsAsyncWithHttpInfo($validationRuleId, $limit, $page, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listValidationRuleAssignmentsAsyncWithHttpInfo + * + * List Validation Rule Assignments + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRuleAssignments $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRuleAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listValidationRuleAssignmentsAsyncWithHttpInfo($validationRuleId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listValidationRuleAssignments'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody'; + $request = $this->listValidationRuleAssignmentsRequest($validationRuleId, $limit, $page, $order, $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 'listValidationRuleAssignments' + * + * @param string $validationRuleId Unique validation rule ID. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRuleAssignments $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRuleAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listValidationRuleAssignmentsRequest($validationRuleId, $limit = null, $page = null, $order = null, string $contentType = self::contentTypes['listValidationRuleAssignments'][0]) + { + + // verify the required parameter 'validationRuleId' is set + if ($validationRuleId === null || (is_array($validationRuleId) && count($validationRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $validationRuleId when calling listValidationRuleAssignments' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ValidationRulesApi.listValidationRuleAssignments, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ValidationRulesApi.listValidationRuleAssignments, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ValidationRulesApi.listValidationRuleAssignments, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ValidationRulesApi.listValidationRuleAssignments, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/validation-rules/{validationRuleId}/assignments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListValidationRuleAssignments', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($validationRuleId !== null) { + $resourcePath = str_replace( + '{' . 'validationRuleId' . '}', + ObjectSerializer::toPathValue($validationRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listValidationRules + * + * List Validation Rules + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRules $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ValidationRulesListResponseBody + */ + public function listValidationRules($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listValidationRules'][0]) + { + list($response) = $this->listValidationRulesWithHttpInfo($limit, $page, $order, $startDate, $endDate, $contentType); + return $response; + } + + /** + * Operation listValidationRulesWithHttpInfo + * + * List Validation Rules + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRules $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRules'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ValidationRulesListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listValidationRulesWithHttpInfo($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listValidationRules'][0]) + { + $request = $this->listValidationRulesRequest($limit, $page, $order, $startDate, $endDate, $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\ValidationRulesListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ValidationRulesListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationRulesListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ValidationRulesListResponseBody'; + 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\ValidationRulesListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listValidationRulesAsync + * + * List Validation Rules + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRules $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listValidationRulesAsync($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listValidationRules'][0]) + { + return $this->listValidationRulesAsyncWithHttpInfo($limit, $page, $order, $startDate, $endDate, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listValidationRulesAsyncWithHttpInfo + * + * List Validation Rules + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRules $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listValidationRulesAsyncWithHttpInfo($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listValidationRules'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationRulesListResponseBody'; + $request = $this->listValidationRulesRequest($limit, $page, $order, $startDate, $endDate, $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 'listValidationRules' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param ParameterOrderListValidationRules $order This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param \DateTime $startDate Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. (optional) + * @param \DateTime $endDate Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRules'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listValidationRulesRequest($limit = null, $page = null, $order = null, $startDate = null, $endDate = null, string $contentType = self::contentTypes['listValidationRules'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ValidationRulesApi.listValidationRules, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ValidationRulesApi.listValidationRules, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ValidationRulesApi.listValidationRules, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ValidationRulesApi.listValidationRules, must be bigger than or equal to 1.'); + } + + + + + + $resourcePath = '/v1/validation-rules'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderListValidationRules', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listValidationRulesAssignments + * + * List Validation Rules' Assignment(s) + * + * @param string $relatedObjectId The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. (optional) + * @param string $rule Validation rule ID. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $order Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRulesAssignments'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody + */ + public function listValidationRulesAssignments($relatedObjectId = null, $rule = null, $page = null, $limit = null, $order = null, string $contentType = self::contentTypes['listValidationRulesAssignments'][0]) + { + list($response) = $this->listValidationRulesAssignmentsWithHttpInfo($relatedObjectId, $rule, $page, $limit, $order, $contentType); + return $response; + } + + /** + * Operation listValidationRulesAssignmentsWithHttpInfo + * + * List Validation Rules' Assignment(s) + * + * @param string $relatedObjectId The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. (optional) + * @param string $rule Validation rule ID. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $order Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRulesAssignments'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listValidationRulesAssignmentsWithHttpInfo($relatedObjectId = null, $rule = null, $page = null, $limit = null, $order = null, string $contentType = self::contentTypes['listValidationRulesAssignments'][0]) + { + $request = $this->listValidationRulesAssignmentsRequest($relatedObjectId, $rule, $page, $limit, $order, $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\ValidationRulesAssignmentsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody'; + 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\ValidationRulesAssignmentsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listValidationRulesAssignmentsAsync + * + * List Validation Rules' Assignment(s) + * + * @param string $relatedObjectId The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. (optional) + * @param string $rule Validation rule ID. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $order Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRulesAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listValidationRulesAssignmentsAsync($relatedObjectId = null, $rule = null, $page = null, $limit = null, $order = null, string $contentType = self::contentTypes['listValidationRulesAssignments'][0]) + { + return $this->listValidationRulesAssignmentsAsyncWithHttpInfo($relatedObjectId, $rule, $page, $limit, $order, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listValidationRulesAssignmentsAsyncWithHttpInfo + * + * List Validation Rules' Assignment(s) + * + * @param string $relatedObjectId The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. (optional) + * @param string $rule Validation rule ID. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $order Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRulesAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listValidationRulesAssignmentsAsyncWithHttpInfo($relatedObjectId = null, $rule = null, $page = null, $limit = null, $order = null, string $contentType = self::contentTypes['listValidationRulesAssignments'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationRulesAssignmentsListResponseBody'; + $request = $this->listValidationRulesAssignmentsRequest($relatedObjectId, $rule, $page, $limit, $order, $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 'listValidationRulesAssignments' + * + * @param string $relatedObjectId The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. (optional) + * @param string $rule Validation rule ID. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param string $order Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listValidationRulesAssignments'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listValidationRulesAssignmentsRequest($relatedObjectId = null, $rule = null, $page = null, $limit = null, $order = null, string $contentType = self::contentTypes['listValidationRulesAssignments'][0]) + { + + + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ValidationRulesApi.listValidationRulesAssignments, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling ValidationRulesApi.listValidationRulesAssignments, must be bigger than or equal to 1.'); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ValidationRulesApi.listValidationRulesAssignments, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ValidationRulesApi.listValidationRulesAssignments, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/v1/validation-rules-assignments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $relatedObjectId, + 'related_object_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $rule, + 'rule', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateValidationRule + * + * Update Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param \OpenAPI\Client\Model\ValidationRulesUpdateRequestBody $validationRulesUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateValidationRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ValidationRulesUpdateResponseBody + */ + public function updateValidationRule($validationRuleId, $validationRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateValidationRule'][0]) + { + list($response) = $this->updateValidationRuleWithHttpInfo($validationRuleId, $validationRulesUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateValidationRuleWithHttpInfo + * + * Update Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param \OpenAPI\Client\Model\ValidationRulesUpdateRequestBody $validationRulesUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateValidationRule'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ValidationRulesUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateValidationRuleWithHttpInfo($validationRuleId, $validationRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateValidationRule'][0]) + { + $request = $this->updateValidationRuleRequest($validationRuleId, $validationRulesUpdateRequestBody, $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\ValidationRulesUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ValidationRulesUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationRulesUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ValidationRulesUpdateResponseBody'; + 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\ValidationRulesUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateValidationRuleAsync + * + * Update Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param \OpenAPI\Client\Model\ValidationRulesUpdateRequestBody $validationRulesUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateValidationRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateValidationRuleAsync($validationRuleId, $validationRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateValidationRule'][0]) + { + return $this->updateValidationRuleAsyncWithHttpInfo($validationRuleId, $validationRulesUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateValidationRuleAsyncWithHttpInfo + * + * Update Validation Rule + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param \OpenAPI\Client\Model\ValidationRulesUpdateRequestBody $validationRulesUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateValidationRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateValidationRuleAsyncWithHttpInfo($validationRuleId, $validationRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateValidationRule'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationRulesUpdateResponseBody'; + $request = $this->updateValidationRuleRequest($validationRuleId, $validationRulesUpdateRequestBody, $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 'updateValidationRule' + * + * @param string $validationRuleId A unique validation rule ID. (required) + * @param \OpenAPI\Client\Model\ValidationRulesUpdateRequestBody $validationRulesUpdateRequestBody Specify the parameters to be updated. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateValidationRule'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateValidationRuleRequest($validationRuleId, $validationRulesUpdateRequestBody = null, string $contentType = self::contentTypes['updateValidationRule'][0]) + { + + // verify the required parameter 'validationRuleId' is set + if ($validationRuleId === null || (is_array($validationRuleId) && count($validationRuleId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $validationRuleId when calling updateValidationRule' + ); + } + + + + $resourcePath = '/v1/validation-rules/{validationRuleId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($validationRuleId !== null) { + $resourcePath = str_replace( + '{' . 'validationRuleId' . '}', + ObjectSerializer::toPathValue($validationRuleId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($validationRulesUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($validationRulesUpdateRequestBody)); + } else { + $httpBody = $validationRulesUpdateRequestBody; + } + } 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( + 'PUT', + $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/Api/ValidationsApi.php b/src/Api/ValidationsApi.php new file mode 100644 index 0000000..2a533a9 --- /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 $validationsValidateRequestBody validationsValidateRequestBody (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($validationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + list($response) = $this->validateStackedDiscountsWithHttpInfo($validationsValidateRequestBody, $contentType); + return $response; + } + + /** + * Operation validateStackedDiscountsWithHttpInfo + * + * Validate Stackable Discounts + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validationsValidateRequestBody (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($validationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + $request = $this->validateStackedDiscountsRequest($validationsValidateRequestBody, $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 $validationsValidateRequestBody (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($validationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + return $this->validateStackedDiscountsAsyncWithHttpInfo($validationsValidateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation validateStackedDiscountsAsyncWithHttpInfo + * + * Validate Stackable Discounts + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validationsValidateRequestBody (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($validationsValidateRequestBody = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationsValidateResponseBody'; + $request = $this->validateStackedDiscountsRequest($validationsValidateRequestBody, $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 $validationsValidateRequestBody (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($validationsValidateRequestBody = 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($validationsValidateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($validationsValidateRequestBody)); + } else { + $httpBody = $validationsValidateRequestBody; + } + } 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/Api/VouchersApi.php b/src/Api/VouchersApi.php new file mode 100644 index 0000000..b742336 --- /dev/null +++ b/src/Api/VouchersApi.php @@ -0,0 +1,5055 @@ + [ + 'application/json', + ], + 'deleteVoucher' => [ + 'application/json', + ], + 'disableVoucher' => [ + 'application/json', + ], + 'enableVoucher' => [ + 'application/json', + ], + 'exportVoucherTransactions' => [ + 'application/json', + ], + 'generateRandomCode' => [ + 'application/json', + ], + 'getVoucher' => [ + 'application/json', + ], + 'importVouchers' => [ + 'application/json', + ], + 'importVouchersUsingCsv' => [ + 'multipart/form-data', + ], + 'listVoucherTransactions' => [ + 'application/json', + ], + 'listVouchers' => [ + 'application/json', + ], + 'releaseValidationSession' => [ + 'application/json', + ], + 'updateVoucher' => [ + 'application/json', + ], + 'updateVoucherBalance' => [ + 'application/json', + ], + 'updateVouchersInBulk' => [ + 'application/json', + ], + 'updateVouchersMetadataInBulk' => [ + '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 createVoucher + * + * Create Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBody $vouchersCreateWithSpecificCodeRequestBody Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersCreateResponseBody + */ + public function createVoucher($code, $vouchersCreateWithSpecificCodeRequestBody = null, string $contentType = self::contentTypes['createVoucher'][0]) + { + list($response) = $this->createVoucherWithHttpInfo($code, $vouchersCreateWithSpecificCodeRequestBody, $contentType); + return $response; + } + + /** + * Operation createVoucherWithHttpInfo + * + * Create Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBody $vouchersCreateWithSpecificCodeRequestBody Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function createVoucherWithHttpInfo($code, $vouchersCreateWithSpecificCodeRequestBody = null, string $contentType = self::contentTypes['createVoucher'][0]) + { + $request = $this->createVoucherRequest($code, $vouchersCreateWithSpecificCodeRequestBody, $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\VouchersCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersCreateResponseBody'; + 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\VouchersCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createVoucherAsync + * + * Create Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBody $vouchersCreateWithSpecificCodeRequestBody Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createVoucherAsync($code, $vouchersCreateWithSpecificCodeRequestBody = null, string $contentType = self::contentTypes['createVoucher'][0]) + { + return $this->createVoucherAsyncWithHttpInfo($code, $vouchersCreateWithSpecificCodeRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createVoucherAsyncWithHttpInfo + * + * Create Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBody $vouchersCreateWithSpecificCodeRequestBody Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createVoucherAsyncWithHttpInfo($code, $vouchersCreateWithSpecificCodeRequestBody = null, string $contentType = self::contentTypes['createVoucher'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersCreateResponseBody'; + $request = $this->createVoucherRequest($code, $vouchersCreateWithSpecificCodeRequestBody, $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 'createVoucher' + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBody $vouchersCreateWithSpecificCodeRequestBody Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createVoucherRequest($code, $vouchersCreateWithSpecificCodeRequestBody = null, string $contentType = self::contentTypes['createVoucher'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling createVoucher' + ); + } + + + + $resourcePath = '/v1/vouchers/{code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($vouchersCreateWithSpecificCodeRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($vouchersCreateWithSpecificCodeRequestBody)); + } else { + $httpBody = $vouchersCreateWithSpecificCodeRequestBody; + } + } 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 deleteVoucher + * + * Delete Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param bool $force If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteVoucher($code, $force = null, string $contentType = self::contentTypes['deleteVoucher'][0]) + { + $this->deleteVoucherWithHttpInfo($code, $force, $contentType); + } + + /** + * Operation deleteVoucherWithHttpInfo + * + * Delete Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param bool $force If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVoucher'] 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 deleteVoucherWithHttpInfo($code, $force = null, string $contentType = self::contentTypes['deleteVoucher'][0]) + { + $request = $this->deleteVoucherRequest($code, $force, $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 deleteVoucherAsync + * + * Delete Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param bool $force If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteVoucherAsync($code, $force = null, string $contentType = self::contentTypes['deleteVoucher'][0]) + { + return $this->deleteVoucherAsyncWithHttpInfo($code, $force, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteVoucherAsyncWithHttpInfo + * + * Delete Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param bool $force If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteVoucherAsyncWithHttpInfo($code, $force = null, string $contentType = self::contentTypes['deleteVoucher'][0]) + { + $returnType = ''; + $request = $this->deleteVoucherRequest($code, $force, $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 'deleteVoucher' + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param bool $force If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteVoucherRequest($code, $force = null, string $contentType = self::contentTypes['deleteVoucher'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling deleteVoucher' + ); + } + + + + $resourcePath = '/v1/vouchers/{code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $force, + 'force', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation disableVoucher + * + * Disable Voucher + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersDisableResponseBody + */ + public function disableVoucher($code, string $contentType = self::contentTypes['disableVoucher'][0]) + { + list($response) = $this->disableVoucherWithHttpInfo($code, $contentType); + return $response; + } + + /** + * Operation disableVoucherWithHttpInfo + * + * Disable Voucher + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersDisableResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function disableVoucherWithHttpInfo($code, string $contentType = self::contentTypes['disableVoucher'][0]) + { + $request = $this->disableVoucherRequest($code, $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\VouchersDisableResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersDisableResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersDisableResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersDisableResponseBody'; + 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\VouchersDisableResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation disableVoucherAsync + * + * Disable Voucher + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disableVoucherAsync($code, string $contentType = self::contentTypes['disableVoucher'][0]) + { + return $this->disableVoucherAsyncWithHttpInfo($code, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation disableVoucherAsyncWithHttpInfo + * + * Disable Voucher + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function disableVoucherAsyncWithHttpInfo($code, string $contentType = self::contentTypes['disableVoucher'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersDisableResponseBody'; + $request = $this->disableVoucherRequest($code, $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 'disableVoucher' + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function disableVoucherRequest($code, string $contentType = self::contentTypes['disableVoucher'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling disableVoucher' + ); + } + + + $resourcePath = '/v1/vouchers/{code}/disable'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 enableVoucher + * + * Enable Voucher + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersEnableResponseBody + */ + public function enableVoucher($code, string $contentType = self::contentTypes['enableVoucher'][0]) + { + list($response) = $this->enableVoucherWithHttpInfo($code, $contentType); + return $response; + } + + /** + * Operation enableVoucherWithHttpInfo + * + * Enable Voucher + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersEnableResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function enableVoucherWithHttpInfo($code, string $contentType = self::contentTypes['enableVoucher'][0]) + { + $request = $this->enableVoucherRequest($code, $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\VouchersEnableResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersEnableResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersEnableResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersEnableResponseBody'; + 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\VouchersEnableResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation enableVoucherAsync + * + * Enable Voucher + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enableVoucherAsync($code, string $contentType = self::contentTypes['enableVoucher'][0]) + { + return $this->enableVoucherAsyncWithHttpInfo($code, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation enableVoucherAsyncWithHttpInfo + * + * Enable Voucher + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function enableVoucherAsyncWithHttpInfo($code, string $contentType = self::contentTypes['enableVoucher'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersEnableResponseBody'; + $request = $this->enableVoucherRequest($code, $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 'enableVoucher' + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['enableVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function enableVoucherRequest($code, string $contentType = self::contentTypes['enableVoucher'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling enableVoucher' + ); + } + + + $resourcePath = '/v1/vouchers/{code}/enable'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 exportVoucherTransactions + * + * Export Voucher Transactions + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersTransactionsExportCreateRequestBody $vouchersTransactionsExportCreateRequestBody Specify the parameters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportVoucherTransactions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBody + */ + public function exportVoucherTransactions($code, $vouchersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportVoucherTransactions'][0]) + { + list($response) = $this->exportVoucherTransactionsWithHttpInfo($code, $vouchersTransactionsExportCreateRequestBody, $contentType); + return $response; + } + + /** + * Operation exportVoucherTransactionsWithHttpInfo + * + * Export Voucher Transactions + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersTransactionsExportCreateRequestBody $vouchersTransactionsExportCreateRequestBody Specify the parameters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportVoucherTransactions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function exportVoucherTransactionsWithHttpInfo($code, $vouchersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportVoucherTransactions'][0]) + { + $request = $this->exportVoucherTransactionsRequest($code, $vouchersTransactionsExportCreateRequestBody, $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\VouchersTransactionsExportCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBody'; + 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\VouchersTransactionsExportCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation exportVoucherTransactionsAsync + * + * Export Voucher Transactions + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersTransactionsExportCreateRequestBody $vouchersTransactionsExportCreateRequestBody Specify the parameters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportVoucherTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function exportVoucherTransactionsAsync($code, $vouchersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportVoucherTransactions'][0]) + { + return $this->exportVoucherTransactionsAsyncWithHttpInfo($code, $vouchersTransactionsExportCreateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation exportVoucherTransactionsAsyncWithHttpInfo + * + * Export Voucher Transactions + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersTransactionsExportCreateRequestBody $vouchersTransactionsExportCreateRequestBody Specify the parameters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportVoucherTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function exportVoucherTransactionsAsyncWithHttpInfo($code, $vouchersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportVoucherTransactions'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBody'; + $request = $this->exportVoucherTransactionsRequest($code, $vouchersTransactionsExportCreateRequestBody, $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 'exportVoucherTransactions' + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersTransactionsExportCreateRequestBody $vouchersTransactionsExportCreateRequestBody Specify the parameters for the transaction export. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportVoucherTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function exportVoucherTransactionsRequest($code, $vouchersTransactionsExportCreateRequestBody = null, string $contentType = self::contentTypes['exportVoucherTransactions'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling exportVoucherTransactions' + ); + } + + + + $resourcePath = '/v1/vouchers/{code}/transactions/export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($vouchersTransactionsExportCreateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($vouchersTransactionsExportCreateRequestBody)); + } else { + $httpBody = $vouchersTransactionsExportCreateRequestBody; + } + } 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 generateRandomCode + * + * Generate Random Code + * + * @param object $body Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateRandomCode'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersCreateResponseBody + */ + public function generateRandomCode($body = null, string $contentType = self::contentTypes['generateRandomCode'][0]) + { + list($response) = $this->generateRandomCodeWithHttpInfo($body, $contentType); + return $response; + } + + /** + * Operation generateRandomCodeWithHttpInfo + * + * Generate Random Code + * + * @param object $body Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateRandomCode'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function generateRandomCodeWithHttpInfo($body = null, string $contentType = self::contentTypes['generateRandomCode'][0]) + { + $request = $this->generateRandomCodeRequest($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\VouchersCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersCreateResponseBody'; + 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\VouchersCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation generateRandomCodeAsync + * + * Generate Random Code + * + * @param object $body Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateRandomCode'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function generateRandomCodeAsync($body = null, string $contentType = self::contentTypes['generateRandomCode'][0]) + { + return $this->generateRandomCodeAsyncWithHttpInfo($body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation generateRandomCodeAsyncWithHttpInfo + * + * Generate Random Code + * + * @param object $body Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateRandomCode'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function generateRandomCodeAsyncWithHttpInfo($body = null, string $contentType = self::contentTypes['generateRandomCode'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersCreateResponseBody'; + $request = $this->generateRandomCodeRequest($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 'generateRandomCode' + * + * @param object $body Specify the details of the voucher that you would like to create. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateRandomCode'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function generateRandomCodeRequest($body = null, string $contentType = self::contentTypes['generateRandomCode'][0]) + { + + + + $resourcePath = '/v1/vouchers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $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-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 getVoucher + * + * Get Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersGetResponseBody + */ + public function getVoucher($code, string $contentType = self::contentTypes['getVoucher'][0]) + { + list($response) = $this->getVoucherWithHttpInfo($code, $contentType); + return $response; + } + + /** + * Operation getVoucherWithHttpInfo + * + * Get Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersGetResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function getVoucherWithHttpInfo($code, string $contentType = self::contentTypes['getVoucher'][0]) + { + $request = $this->getVoucherRequest($code, $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\VouchersGetResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersGetResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersGetResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersGetResponseBody'; + 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\VouchersGetResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getVoucherAsync + * + * Get Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getVoucherAsync($code, string $contentType = self::contentTypes['getVoucher'][0]) + { + return $this->getVoucherAsyncWithHttpInfo($code, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getVoucherAsyncWithHttpInfo + * + * Get Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getVoucherAsyncWithHttpInfo($code, string $contentType = self::contentTypes['getVoucher'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersGetResponseBody'; + $request = $this->getVoucherRequest($code, $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 'getVoucher' + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getVoucherRequest($code, string $contentType = self::contentTypes['getVoucher'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling getVoucher' + ); + } + + + $resourcePath = '/v1/vouchers/{code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation importVouchers + * + * Import Vouchers + * + * @param \OpenAPI\Client\Model\VouchersImportCreateItemRequestBody[] $vouchersImportCreateItemRequestBody The request body is an array of objects. Each object contains details about a specific voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersImportCreateResponseBody + */ + public function importVouchers($vouchersImportCreateItemRequestBody, string $contentType = self::contentTypes['importVouchers'][0]) + { + list($response) = $this->importVouchersWithHttpInfo($vouchersImportCreateItemRequestBody, $contentType); + return $response; + } + + /** + * Operation importVouchersWithHttpInfo + * + * Import Vouchers + * + * @param \OpenAPI\Client\Model\VouchersImportCreateItemRequestBody[] $vouchersImportCreateItemRequestBody The request body is an array of objects. Each object contains details about a specific voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersImportCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function importVouchersWithHttpInfo($vouchersImportCreateItemRequestBody, string $contentType = self::contentTypes['importVouchers'][0]) + { + $request = $this->importVouchersRequest($vouchersImportCreateItemRequestBody, $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 202: + if ('\OpenAPI\Client\Model\VouchersImportCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersImportCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersImportCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersImportCreateResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\VouchersImportCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation importVouchersAsync + * + * Import Vouchers + * + * @param \OpenAPI\Client\Model\VouchersImportCreateItemRequestBody[] $vouchersImportCreateItemRequestBody The request body is an array of objects. Each object contains details about a specific voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importVouchersAsync($vouchersImportCreateItemRequestBody, string $contentType = self::contentTypes['importVouchers'][0]) + { + return $this->importVouchersAsyncWithHttpInfo($vouchersImportCreateItemRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importVouchersAsyncWithHttpInfo + * + * Import Vouchers + * + * @param \OpenAPI\Client\Model\VouchersImportCreateItemRequestBody[] $vouchersImportCreateItemRequestBody The request body is an array of objects. Each object contains details about a specific voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importVouchersAsyncWithHttpInfo($vouchersImportCreateItemRequestBody, string $contentType = self::contentTypes['importVouchers'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersImportCreateResponseBody'; + $request = $this->importVouchersRequest($vouchersImportCreateItemRequestBody, $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 'importVouchers' + * + * @param \OpenAPI\Client\Model\VouchersImportCreateItemRequestBody[] $vouchersImportCreateItemRequestBody The request body is an array of objects. Each object contains details about a specific voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importVouchersRequest($vouchersImportCreateItemRequestBody, string $contentType = self::contentTypes['importVouchers'][0]) + { + + // verify the required parameter 'vouchersImportCreateItemRequestBody' is set + if ($vouchersImportCreateItemRequestBody === null || (is_array($vouchersImportCreateItemRequestBody) && count($vouchersImportCreateItemRequestBody) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $vouchersImportCreateItemRequestBody when calling importVouchers' + ); + } + + + $resourcePath = '/v1/vouchers/import'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($vouchersImportCreateItemRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($vouchersImportCreateItemRequestBody)); + } else { + $httpBody = $vouchersImportCreateItemRequestBody; + } + } 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 importVouchersUsingCsv + * + * Import Vouchers using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody + */ + public function importVouchersUsingCsv($file = null, string $contentType = self::contentTypes['importVouchersUsingCsv'][0]) + { + list($response) = $this->importVouchersUsingCsvWithHttpInfo($file, $contentType); + return $response; + } + + /** + * Operation importVouchersUsingCsvWithHttpInfo + * + * Import Vouchers using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersUsingCsv'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function importVouchersUsingCsvWithHttpInfo($file = null, string $contentType = self::contentTypes['importVouchersUsingCsv'][0]) + { + $request = $this->importVouchersUsingCsvRequest($file, $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 202: + if ('\OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation importVouchersUsingCsvAsync + * + * Import Vouchers using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importVouchersUsingCsvAsync($file = null, string $contentType = self::contentTypes['importVouchersUsingCsv'][0]) + { + return $this->importVouchersUsingCsvAsyncWithHttpInfo($file, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importVouchersUsingCsvAsyncWithHttpInfo + * + * Import Vouchers using CSV + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importVouchersUsingCsvAsyncWithHttpInfo($file = null, string $contentType = self::contentTypes['importVouchersUsingCsv'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersImportCsvCreateResponseBody'; + $request = $this->importVouchersUsingCsvRequest($file, $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 'importVouchersUsingCsv' + * + * @param \SplFileObject $file File path. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['importVouchersUsingCsv'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function importVouchersUsingCsvRequest($file = null, string $contentType = self::contentTypes['importVouchersUsingCsv'][0]) + { + + + + $resourcePath = '/v1/vouchers/importCSV'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // form params + if ($file !== null) { + $multipart = true; + $formParams['file'] = []; + $paramFiles = is_array($file) ? $file : [$file]; + foreach ($paramFiles as $paramFile) { + $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + } + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 listVoucherTransactions + * + * List Voucher Transactions + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVoucherTransactions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersTransactionsListResponseBody + */ + public function listVoucherTransactions($code, $limit = null, $page = null, string $contentType = self::contentTypes['listVoucherTransactions'][0]) + { + list($response) = $this->listVoucherTransactionsWithHttpInfo($code, $limit, $page, $contentType); + return $response; + } + + /** + * Operation listVoucherTransactionsWithHttpInfo + * + * List Voucher Transactions + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVoucherTransactions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersTransactionsListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listVoucherTransactionsWithHttpInfo($code, $limit = null, $page = null, string $contentType = self::contentTypes['listVoucherTransactions'][0]) + { + $request = $this->listVoucherTransactionsRequest($code, $limit, $page, $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\VouchersTransactionsListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersTransactionsListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersTransactionsListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersTransactionsListResponseBody'; + 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\VouchersTransactionsListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listVoucherTransactionsAsync + * + * List Voucher Transactions + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVoucherTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listVoucherTransactionsAsync($code, $limit = null, $page = null, string $contentType = self::contentTypes['listVoucherTransactions'][0]) + { + return $this->listVoucherTransactionsAsyncWithHttpInfo($code, $limit, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listVoucherTransactionsAsyncWithHttpInfo + * + * List Voucher Transactions + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVoucherTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listVoucherTransactionsAsyncWithHttpInfo($code, $limit = null, $page = null, string $contentType = self::contentTypes['listVoucherTransactions'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersTransactionsListResponseBody'; + $request = $this->listVoucherTransactionsRequest($code, $limit, $page, $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 'listVoucherTransactions' + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVoucherTransactions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listVoucherTransactionsRequest($code, $limit = null, $page = null, string $contentType = self::contentTypes['listVoucherTransactions'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling listVoucherTransactions' + ); + } + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling VouchersApi.listVoucherTransactions, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling VouchersApi.listVoucherTransactions, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling VouchersApi.listVoucherTransactions, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling VouchersApi.listVoucherTransactions, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/v1/vouchers/{code}/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listVouchers + * + * List Vouchers + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $category Limit search results to vouchers within the specified category. (optional) + * @param string $campaignId Limit search results to vouchers within the specified campaign (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param string $campaign A unique campaign name, identifies the parent campaign. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code code (optional) + * @param string[] $ids ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVouchers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersListResponseBody + */ + public function listVouchers($limit = null, $page = null, $category = null, $campaignId = null, $customer = null, $campaign = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listVouchers'][0]) + { + list($response) = $this->listVouchersWithHttpInfo($limit, $page, $category, $campaignId, $customer, $campaign, $createdAt, $updatedAt, $order, $code, $ids, $contentType); + return $response; + } + + /** + * Operation listVouchersWithHttpInfo + * + * List Vouchers + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $category Limit search results to vouchers within the specified category. (optional) + * @param string $campaignId Limit search results to vouchers within the specified campaign (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param string $campaign A unique campaign name, identifies the parent campaign. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code (optional) + * @param string[] $ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVouchers'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersListResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function listVouchersWithHttpInfo($limit = null, $page = null, $category = null, $campaignId = null, $customer = null, $campaign = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listVouchers'][0]) + { + $request = $this->listVouchersRequest($limit, $page, $category, $campaignId, $customer, $campaign, $createdAt, $updatedAt, $order, $code, $ids, $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\VouchersListResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersListResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersListResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersListResponseBody'; + 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\VouchersListResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listVouchersAsync + * + * List Vouchers + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $category Limit search results to vouchers within the specified category. (optional) + * @param string $campaignId Limit search results to vouchers within the specified campaign (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param string $campaign A unique campaign name, identifies the parent campaign. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code (optional) + * @param string[] $ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVouchers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listVouchersAsync($limit = null, $page = null, $category = null, $campaignId = null, $customer = null, $campaign = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listVouchers'][0]) + { + return $this->listVouchersAsyncWithHttpInfo($limit, $page, $category, $campaignId, $customer, $campaign, $createdAt, $updatedAt, $order, $code, $ids, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listVouchersAsyncWithHttpInfo + * + * List Vouchers + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $category Limit search results to vouchers within the specified category. (optional) + * @param string $campaignId Limit search results to vouchers within the specified campaign (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param string $campaign A unique campaign name, identifies the parent campaign. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code (optional) + * @param string[] $ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVouchers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listVouchersAsyncWithHttpInfo($limit = null, $page = null, $category = null, $campaignId = null, $customer = null, $campaign = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listVouchers'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersListResponseBody'; + $request = $this->listVouchersRequest($limit, $page, $category, $campaignId, $customer, $campaign, $createdAt, $updatedAt, $order, $code, $ids, $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 'listVouchers' + * + * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + * @param int $page Which page of results to return. The lowest value is 1. (optional) + * @param string $category Limit search results to vouchers within the specified category. (optional) + * @param string $campaignId Limit search results to vouchers within the specified campaign (optional) + * @param string $customer A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + * @param string $campaign A unique campaign name, identifies the parent campaign. (optional) + * @param ParameterCreatedBeforeAfter $createdAt A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterUpdatedBeforeAfter $updatedAt A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + * @param ParameterOrderVouchers $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + * @param string $code (optional) + * @param string[] $ids (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listVouchers'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listVouchersRequest($limit = null, $page = null, $category = null, $campaignId = null, $customer = null, $campaign = null, $createdAt = null, $updatedAt = null, $order = null, $code = null, $ids = null, string $contentType = self::contentTypes['listVouchers'][0]) + { + + if ($limit !== null && $limit > 100) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling VouchersApi.listVouchers, must be smaller than or equal to 100.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling VouchersApi.listVouchers, must be bigger than or equal to 1.'); + } + + if ($page !== null && $page > 100) { + throw new \InvalidArgumentException('invalid value for "$page" when calling VouchersApi.listVouchers, must be smaller than or equal to 100.'); + } + if ($page !== null && $page < 1) { + throw new \InvalidArgumentException('invalid value for "$page" when calling VouchersApi.listVouchers, must be bigger than or equal to 1.'); + } + + + + + + + + + + + + $resourcePath = '/v1/vouchers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $category, + 'category', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaignId, + 'campaign_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $customer, + 'customer', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaign, + 'campaign', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $createdAt, + 'created_at', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updatedAt, + 'updated_at', // param base name + 'object', // openApiType + 'deepObject', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $order, + 'order', // param base name + 'ParameterOrderVouchers', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $code, + 'code', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $ids, + 'ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation releaseValidationSession + * + * Release Validation Session + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. (required) + * @param string $sessionKey A unique session identifier. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['releaseValidationSession'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function releaseValidationSession($code, $sessionKey, string $contentType = self::contentTypes['releaseValidationSession'][0]) + { + $this->releaseValidationSessionWithHttpInfo($code, $sessionKey, $contentType); + } + + /** + * Operation releaseValidationSessionWithHttpInfo + * + * Release Validation Session + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. (required) + * @param string $sessionKey A unique session identifier. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['releaseValidationSession'] 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 releaseValidationSessionWithHttpInfo($code, $sessionKey, string $contentType = self::contentTypes['releaseValidationSession'][0]) + { + $request = $this->releaseValidationSessionRequest($code, $sessionKey, $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 releaseValidationSessionAsync + * + * Release Validation Session + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. (required) + * @param string $sessionKey A unique session identifier. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['releaseValidationSession'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function releaseValidationSessionAsync($code, $sessionKey, string $contentType = self::contentTypes['releaseValidationSession'][0]) + { + return $this->releaseValidationSessionAsyncWithHttpInfo($code, $sessionKey, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation releaseValidationSessionAsyncWithHttpInfo + * + * Release Validation Session + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. (required) + * @param string $sessionKey A unique session identifier. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['releaseValidationSession'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function releaseValidationSessionAsyncWithHttpInfo($code, $sessionKey, string $contentType = self::contentTypes['releaseValidationSession'][0]) + { + $returnType = ''; + $request = $this->releaseValidationSessionRequest($code, $sessionKey, $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 'releaseValidationSession' + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. (required) + * @param string $sessionKey A unique session identifier. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['releaseValidationSession'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function releaseValidationSessionRequest($code, $sessionKey, string $contentType = self::contentTypes['releaseValidationSession'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling releaseValidationSession' + ); + } + + // verify the required parameter 'sessionKey' is set + if ($sessionKey === null || (is_array($sessionKey) && count($sessionKey) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $sessionKey when calling releaseValidationSession' + ); + } + + + $resourcePath = '/v1/vouchers/{code}/sessions/{sessionKey}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + // path params + if ($sessionKey !== null) { + $resourcePath = str_replace( + '{' . 'sessionKey' . '}', + ObjectSerializer::toPathValue($sessionKey), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateVoucher + * + * Update Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersUpdateRequestBody $vouchersUpdateRequestBody Specify the parameters to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersUpdateResponseBody + */ + public function updateVoucher($code, $vouchersUpdateRequestBody, string $contentType = self::contentTypes['updateVoucher'][0]) + { + list($response) = $this->updateVoucherWithHttpInfo($code, $vouchersUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateVoucherWithHttpInfo + * + * Update Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersUpdateRequestBody $vouchersUpdateRequestBody Specify the parameters to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucher'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateVoucherWithHttpInfo($code, $vouchersUpdateRequestBody, string $contentType = self::contentTypes['updateVoucher'][0]) + { + $request = $this->updateVoucherRequest($code, $vouchersUpdateRequestBody, $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\VouchersUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersUpdateResponseBody'; + 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\VouchersUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateVoucherAsync + * + * Update Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersUpdateRequestBody $vouchersUpdateRequestBody Specify the parameters to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateVoucherAsync($code, $vouchersUpdateRequestBody, string $contentType = self::contentTypes['updateVoucher'][0]) + { + return $this->updateVoucherAsyncWithHttpInfo($code, $vouchersUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateVoucherAsyncWithHttpInfo + * + * Update Voucher + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersUpdateRequestBody $vouchersUpdateRequestBody Specify the parameters to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateVoucherAsyncWithHttpInfo($code, $vouchersUpdateRequestBody, string $contentType = self::contentTypes['updateVoucher'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersUpdateResponseBody'; + $request = $this->updateVoucherRequest($code, $vouchersUpdateRequestBody, $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 'updateVoucher' + * + * @param string $code A unique **code** that identifies the voucher. (required) + * @param \OpenAPI\Client\Model\VouchersUpdateRequestBody $vouchersUpdateRequestBody Specify the parameters to be updated. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucher'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateVoucherRequest($code, $vouchersUpdateRequestBody, string $contentType = self::contentTypes['updateVoucher'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling updateVoucher' + ); + } + + // verify the required parameter 'vouchersUpdateRequestBody' is set + if ($vouchersUpdateRequestBody === null || (is_array($vouchersUpdateRequestBody) && count($vouchersUpdateRequestBody) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $vouchersUpdateRequestBody when calling updateVoucher' + ); + } + + + $resourcePath = '/v1/vouchers/{code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($vouchersUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($vouchersUpdateRequestBody)); + } else { + $httpBody = $vouchersUpdateRequestBody; + } + } 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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateVoucherBalance + * + * Add or Remove Voucher Balance + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersBalanceUpdateRequestBody $vouchersBalanceUpdateRequestBody Provide the amount to be added to/subtracted from the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucherBalance'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersBalanceUpdateResponseBody + */ + public function updateVoucherBalance($code, $vouchersBalanceUpdateRequestBody, string $contentType = self::contentTypes['updateVoucherBalance'][0]) + { + list($response) = $this->updateVoucherBalanceWithHttpInfo($code, $vouchersBalanceUpdateRequestBody, $contentType); + return $response; + } + + /** + * Operation updateVoucherBalanceWithHttpInfo + * + * Add or Remove Voucher Balance + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersBalanceUpdateRequestBody $vouchersBalanceUpdateRequestBody Provide the amount to be added to/subtracted from the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucherBalance'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersBalanceUpdateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateVoucherBalanceWithHttpInfo($code, $vouchersBalanceUpdateRequestBody, string $contentType = self::contentTypes['updateVoucherBalance'][0]) + { + $request = $this->updateVoucherBalanceRequest($code, $vouchersBalanceUpdateRequestBody, $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\VouchersBalanceUpdateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersBalanceUpdateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersBalanceUpdateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersBalanceUpdateResponseBody'; + 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\VouchersBalanceUpdateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateVoucherBalanceAsync + * + * Add or Remove Voucher Balance + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersBalanceUpdateRequestBody $vouchersBalanceUpdateRequestBody Provide the amount to be added to/subtracted from the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucherBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateVoucherBalanceAsync($code, $vouchersBalanceUpdateRequestBody, string $contentType = self::contentTypes['updateVoucherBalance'][0]) + { + return $this->updateVoucherBalanceAsyncWithHttpInfo($code, $vouchersBalanceUpdateRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateVoucherBalanceAsyncWithHttpInfo + * + * Add or Remove Voucher Balance + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersBalanceUpdateRequestBody $vouchersBalanceUpdateRequestBody Provide the amount to be added to/subtracted from the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucherBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateVoucherBalanceAsyncWithHttpInfo($code, $vouchersBalanceUpdateRequestBody, string $contentType = self::contentTypes['updateVoucherBalance'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersBalanceUpdateResponseBody'; + $request = $this->updateVoucherBalanceRequest($code, $vouchersBalanceUpdateRequestBody, $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 'updateVoucherBalance' + * + * @param string $code A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + * @param \OpenAPI\Client\Model\VouchersBalanceUpdateRequestBody $vouchersBalanceUpdateRequestBody Provide the amount to be added to/subtracted from the voucher. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVoucherBalance'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateVoucherBalanceRequest($code, $vouchersBalanceUpdateRequestBody, string $contentType = self::contentTypes['updateVoucherBalance'][0]) + { + + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling updateVoucherBalance' + ); + } + + // verify the required parameter 'vouchersBalanceUpdateRequestBody' is set + if ($vouchersBalanceUpdateRequestBody === null || (is_array($vouchersBalanceUpdateRequestBody) && count($vouchersBalanceUpdateRequestBody) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $vouchersBalanceUpdateRequestBody when calling updateVoucherBalance' + ); + } + + + $resourcePath = '/v1/vouchers/{code}/balance'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($code !== null) { + $resourcePath = str_replace( + '{' . 'code' . '}', + ObjectSerializer::toPathValue($code), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($vouchersBalanceUpdateRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($vouchersBalanceUpdateRequestBody)); + } else { + $httpBody = $vouchersBalanceUpdateRequestBody; + } + } 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 updateVouchersInBulk + * + * Update Vouchers in Bulk + * + * @param \OpenAPI\Client\Model\VouchersUpdateInBulkItemRequestBody[] $vouchersUpdateInBulkItemRequestBody List the codes to be updated with the metadata key/value pairs for that code. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody + */ + public function updateVouchersInBulk($vouchersUpdateInBulkItemRequestBody, string $contentType = self::contentTypes['updateVouchersInBulk'][0]) + { + list($response) = $this->updateVouchersInBulkWithHttpInfo($vouchersUpdateInBulkItemRequestBody, $contentType); + return $response; + } + + /** + * Operation updateVouchersInBulkWithHttpInfo + * + * Update Vouchers in Bulk + * + * @param \OpenAPI\Client\Model\VouchersUpdateInBulkItemRequestBody[] $vouchersUpdateInBulkItemRequestBody List the codes to be updated with the metadata key/value pairs for that code. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateVouchersInBulkWithHttpInfo($vouchersUpdateInBulkItemRequestBody, string $contentType = self::contentTypes['updateVouchersInBulk'][0]) + { + $request = $this->updateVouchersInBulkRequest($vouchersUpdateInBulkItemRequestBody, $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 202: + if ('\OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateVouchersInBulkAsync + * + * Update Vouchers in Bulk + * + * @param \OpenAPI\Client\Model\VouchersUpdateInBulkItemRequestBody[] $vouchersUpdateInBulkItemRequestBody List the codes to be updated with the metadata key/value pairs for that code. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateVouchersInBulkAsync($vouchersUpdateInBulkItemRequestBody, string $contentType = self::contentTypes['updateVouchersInBulk'][0]) + { + return $this->updateVouchersInBulkAsyncWithHttpInfo($vouchersUpdateInBulkItemRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateVouchersInBulkAsyncWithHttpInfo + * + * Update Vouchers in Bulk + * + * @param \OpenAPI\Client\Model\VouchersUpdateInBulkItemRequestBody[] $vouchersUpdateInBulkItemRequestBody List the codes to be updated with the metadata key/value pairs for that code. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateVouchersInBulkAsyncWithHttpInfo($vouchersUpdateInBulkItemRequestBody, string $contentType = self::contentTypes['updateVouchersInBulk'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersUpdateInBulkResponseBody'; + $request = $this->updateVouchersInBulkRequest($vouchersUpdateInBulkItemRequestBody, $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 'updateVouchersInBulk' + * + * @param \OpenAPI\Client\Model\VouchersUpdateInBulkItemRequestBody[] $vouchersUpdateInBulkItemRequestBody List the codes to be updated with the metadata key/value pairs for that code. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateVouchersInBulkRequest($vouchersUpdateInBulkItemRequestBody, string $contentType = self::contentTypes['updateVouchersInBulk'][0]) + { + + // verify the required parameter 'vouchersUpdateInBulkItemRequestBody' is set + if ($vouchersUpdateInBulkItemRequestBody === null || (is_array($vouchersUpdateInBulkItemRequestBody) && count($vouchersUpdateInBulkItemRequestBody) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $vouchersUpdateInBulkItemRequestBody when calling updateVouchersInBulk' + ); + } + + + $resourcePath = '/v1/vouchers/bulk/async'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($vouchersUpdateInBulkItemRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($vouchersUpdateInBulkItemRequestBody)); + } else { + $httpBody = $vouchersUpdateInBulkItemRequestBody; + } + } 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 updateVouchersMetadataInBulk + * + * Update Vouchers' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkRequestBody $vouchersMetadataUpdateInBulkRequestBody List the codes of the vouchers you would like to update with the metadata key/value pairs. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersMetadataInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody + */ + public function updateVouchersMetadataInBulk($vouchersMetadataUpdateInBulkRequestBody, string $contentType = self::contentTypes['updateVouchersMetadataInBulk'][0]) + { + list($response) = $this->updateVouchersMetadataInBulkWithHttpInfo($vouchersMetadataUpdateInBulkRequestBody, $contentType); + return $response; + } + + /** + * Operation updateVouchersMetadataInBulkWithHttpInfo + * + * Update Vouchers' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkRequestBody $vouchersMetadataUpdateInBulkRequestBody List the codes of the vouchers you would like to update with the metadata key/value pairs. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersMetadataInBulk'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function updateVouchersMetadataInBulkWithHttpInfo($vouchersMetadataUpdateInBulkRequestBody, string $contentType = self::contentTypes['updateVouchersMetadataInBulk'][0]) + { + $request = $this->updateVouchersMetadataInBulkRequest($vouchersMetadataUpdateInBulkRequestBody, $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 202: + if ('\OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateVouchersMetadataInBulkAsync + * + * Update Vouchers' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkRequestBody $vouchersMetadataUpdateInBulkRequestBody List the codes of the vouchers you would like to update with the metadata key/value pairs. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateVouchersMetadataInBulkAsync($vouchersMetadataUpdateInBulkRequestBody, string $contentType = self::contentTypes['updateVouchersMetadataInBulk'][0]) + { + return $this->updateVouchersMetadataInBulkAsyncWithHttpInfo($vouchersMetadataUpdateInBulkRequestBody, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateVouchersMetadataInBulkAsyncWithHttpInfo + * + * Update Vouchers' Metadata in Bulk + * + * @param \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkRequestBody $vouchersMetadataUpdateInBulkRequestBody List the codes of the vouchers you would like to update with the metadata key/value pairs. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateVouchersMetadataInBulkAsyncWithHttpInfo($vouchersMetadataUpdateInBulkRequestBody, string $contentType = self::contentTypes['updateVouchersMetadataInBulk'][0]) + { + $returnType = '\OpenAPI\Client\Model\VouchersMetadataUpdateInBulkResponseBody'; + $request = $this->updateVouchersMetadataInBulkRequest($vouchersMetadataUpdateInBulkRequestBody, $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 'updateVouchersMetadataInBulk' + * + * @param \OpenAPI\Client\Model\VouchersMetadataUpdateInBulkRequestBody $vouchersMetadataUpdateInBulkRequestBody List the codes of the vouchers you would like to update with the metadata key/value pairs. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateVouchersMetadataInBulk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateVouchersMetadataInBulkRequest($vouchersMetadataUpdateInBulkRequestBody, string $contentType = self::contentTypes['updateVouchersMetadataInBulk'][0]) + { + + // verify the required parameter 'vouchersMetadataUpdateInBulkRequestBody' is set + if ($vouchersMetadataUpdateInBulkRequestBody === null || (is_array($vouchersMetadataUpdateInBulkRequestBody) && count($vouchersMetadataUpdateInBulkRequestBody) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $vouchersMetadataUpdateInBulkRequestBody when calling updateVouchersMetadataInBulk' + ); + } + + + $resourcePath = '/v1/vouchers/metadata/async'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($vouchersMetadataUpdateInBulkRequestBody)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($vouchersMetadataUpdateInBulkRequestBody)); + } else { + $httpBody = $vouchersMetadataUpdateInBulkRequestBody; + } + } 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/ApiClient.php b/src/ApiClient.php deleted file mode 100644 index 25d37e2..0000000 --- a/src/ApiClient.php +++ /dev/null @@ -1,251 +0,0 @@ -apiId = $apiId; - $this->apiKey = $apiKey; - - if (isset($apiUrl)) { - $this->basePath = $apiUrl; - } - - $this->setHeaders($apiVersion, $customHeaders); - } - - private function setHeaders($apiVersion, $customHeaders) { - $channel = "PHP-SDK"; - - $headers = [ - "content-type" => "application/json", - "x-app-id" => $this->apiId, - "x-app-token" => $this->apiKey, - "x-voucherify-channel" => $channel - ]; - - if (isset($apiVersion)) { - $headers["x-voucherify-api-version"] = $apiVersion; - } - if (isset($customHeaders)) { - if (!is_array($customHeaders) && !is_object($customHeaders)) { - throw new \Exception("CustomHeaders type not allowed. Must be an array or an object"); - } - foreach ($customHeaders as $key => $value) { - if (is_null($value)) { - continue; - } - $headers[strtolower($key)] = $value; - } - } - if (substr($headers["x-voucherify-channel"], 0, strlen($channel)) !== $channel) { - $headers["x-voucherify-channel"] = $channel . "-" . $headers["x-voucherify-channel"]; - } - $this->headers = array(); - - foreach ($headers as $key => $value) { - if (is_null($value)) { - continue; - } - $this->headers[] = $key . ": " . $value; - } - } - - private function encodeParams($params) - { - if (!is_array($params) && !is_object($params)) { - return $params; - } - - $result = array(); - foreach ($params as $key => $value) { - if (is_null($value)) { - continue; - } - $result[] = rawurlencode($key) . "=" . rawurlencode($value); - } - return implode("&", $result); - } - - private function getConnectionOption($name) - { - $hasValue = isset($this->options, $this->options[$name]); - - return $hasValue ? $this->options[$name] : null; - } - - /** - * @param string $method - * @param string $endpoint - * @param string|array|stdClass|null $params - * @param string|array|stdClass|null $body - * - * @throws \Voucherify\ClientException - */ - private function request($method, $endpoint, $params, $body) - { - $setParams = $params && in_array($method, ["GET", "POST", "DELETE"]); - $setBody = $body && in_array($method, ["POST", "PUT", "DELETE"]); - - $method = strtoupper($method); - $url = $this->basePath . "/v1" . $endpoint . ($setParams ? "?" . $this->encodeParams($params) : ""); - - $options = array(); - $options[CURLOPT_URL] = $url; - $options[CURLOPT_HTTPHEADER] = $this->headers; - $options[CURLOPT_RETURNTRANSFER] = true; - $options[CURLOPT_CUSTOMREQUEST] = $method; - $options[CURLOPT_POSTFIELDS] = $setBody ? json_encode($body) : null; - $options[CURLOPT_CONNECTTIMEOUT] = $this->getConnectionOption("connectTimeout"); - $options[CURLOPT_TIMEOUT_MS] = $this->getConnectionOption("timeout"); - - $curl = curl_init(); - - if (isset($this->logger)) { - $context = [ "options" => $options ]; - $this->logger->info("[ApiClient][Request] Curl request;", $context); - } - - curl_setopt_array($curl, $options); - - $result = curl_exec($curl); - $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); - $error = curl_error($curl); - - curl_close($curl); - - if (isset($this->logger)) { - $context = [ "result" => $result, "statusCode" => $statusCode, "error" => $error ]; - $this->logger->info("[ApiClient][Request] Curl response;", $context); - } - - if ($result === false) { - throw new ClientException($error); - } - elseif ($statusCode >= 400) { - $error = json_decode($result); - throw new ClientException($error, $statusCode); - } - - return json_decode($result); - } - - /** - * @param \Psr\Log\LoggerInterface $logger - */ - public function setLogger($logger) - { - $this->logger = $logger; - } - - /** - * @param array $options - */ - public function setConnectionOptions($options) - { - $this->options = $options; - } - - /** - * @param string $path - * @param string|array|stdClass|null $qs - */ - public function get($path, $qs = null) - { - return $this->request("GET", $path, $qs, null); - } - - /** - * @param string $path - * @param string|array|stdClass|null $body - * @param array|stdClass|null $options - */ - public function post($path, $body, $options = null) - { - $qs = null; - - if (is_array($options)) { - $qs = $options["qs"]; - } - elseif (is_object($options)) { - $qs = $options->qs; - } - - return $this->request("POST", $path, $qs, $body); - } - - /** - * @param string $path - * @param string|array|stdClass|null $body - * @param array|stdClass|null $options - */ - public function put($path, $body, $options = null) - { - return $this->request("PUT", $path, null, $body); - } - - /** - * @param string $path - * @param string|array|stdClass|null $body - * @param array|stdClass|null $options - */ - public function delete($path, $body = null, $options = null) - { - $qs = null; - - if (is_array($options)) { - $qs = $options["qs"]; - } - elseif (is_object($options)) { - $qs = $options->qs; - } - - return $this->request("DELETE", $path, $qs, $body); - } -} diff --git a/src/ApiException.php b/src/ApiException.php new file mode 100644 index 0000000..3e8c19d --- /dev/null +++ b/src/ApiException.php @@ -0,0 +1,120 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/src/AsyncActions.php b/src/AsyncActions.php deleted file mode 100644 index 811d623..0000000 --- a/src/AsyncActions.php +++ /dev/null @@ -1,46 +0,0 @@ -client = $client; - } - - /** - * @param string $id - * - * Get Async Action details. - * - * @throws \Voucherify\ClientException - */ - public function get($id) - { - return $this->client->get("/async-actions/" . rawurlencode($id), null); - } - - /** - * @param array|stdClass $filter - * - * Get a filtered list of Async Actions. The filter can include following properties: - * - limit - number - * - end_date - date in iso format - * - * @throws \Voucherify\ClientException - */ - public function getList($filter = null) - { - return $this->client->get("/async-actions/", $filter); - } - -} \ No newline at end of file diff --git a/src/Campaigns.php b/src/Campaigns.php deleted file mode 100644 index 2ae564b..0000000 --- a/src/Campaigns.php +++ /dev/null @@ -1,87 +0,0 @@ -client = $client; - } - - /** - * @param stdClass $campaign - * - * Create campaign. - * - * @throws \Voucherify\ClientException - */ - public function create($campaign) - { - return $this->client->post("/campaigns", $campaign); - } - - /** - * @param string $name - campaign name - * @param stdClass $params - * - * Add voucher to campaign. - * - * @throws \Voucherify\ClientException - */ - public function addVoucher($name, $params = null) - { - return $this->client->post("/campaigns/" . rawurlencode($name) . "/vouchers/", $params); - } - - /** - * @param string $name - campaign name - * @param string $code - voucher code - * @param stdClass $params - * - * Add voucher with certain code to campaign. - * - * @throws \Voucherify\ClientException - */ - public function addVoucherWithCode($name, $code, $params = null) - { - return $this->client->post("/campaigns/" . rawurlencode($name) . "/vouchers/" . rawurlencode($code), $params); - } - - /** - * @param string $name - campaign name - * @param stdClass[] $vouchers - * - * Imports vouchers to an existing campaign. - * - * @throws \Voucherify\ClientException - */ - public function importVouchers($name, $vouchers) - { - return $this->client->post("/campaigns/" . rawurlencode($name) . "/import", $vouchers); - } - - /** - * @param string $name - * @param boolean|null $force - * - * Delete campaign. - * - * @throws \Voucherify\ClientException - */ - public function delete($name, $force = null) - { - $options = (object)[]; - $options->qs = [ "force" => ($force ? "true" : "false") ]; - - return $this->client->delete("/campaigns/" . rawurlencode($name), null, $options); - } -} \ No newline at end of file diff --git a/src/ClientException.php b/src/ClientException.php deleted file mode 100644 index 0a302d6..0000000 --- a/src/ClientException.php +++ /dev/null @@ -1,85 +0,0 @@ -key) ? $message->key : null; - $details = isset($message->details) ? $message->details : null; - $code = isset($message->code) ? $message->code : $code; - $message = isset($message->message) ? $message->message : null; - } - else if (is_array($message)) { - $key = $message["key"]; - $details = $message["details"]; - $code = $message["code"] ? $message["code"] : $code; - $message = $message["message"]; - } - - // Initialize parent - parent::__construct($message, $code); - - $this->key = $key; - $this->details = $details; - } - - /** - * Get key - * - * @return {string} - */ - public function getKey() { - return $this->key; - } - - /** - * Get details - * - * @return {string} - */ - public function getDetails() { - return $this->details; - } - - /** - * Get client error data - * - * @return {stdClass} Client error data - */ - public function getError() { - return (object) [ - "code" => $this->getCode(), - "message" => $this->getMessage(), - "details" => $this->getDetails(), - "key" => $this->getKey() - ]; - } - - public function __toString() { - $statusCode = $this->code; - $error = json_encode($this->getError()); - - return __CLASS__ . ": Unexpected status code: " . $statusCode . " - Details: " . $error; - } -} diff --git a/src/Configuration.php b/src/Configuration.php new file mode 100644 index 0000000..d9522a1 --- /dev/null +++ b/src/Configuration.php @@ -0,0 +1,546 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormatForQueryString Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (OpenAPI\Client) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: v2018-08-01' . PHP_EOL; + $report .= ' SDK Package Version: 3.0.0' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://{cluster}.voucherify.io", + "description" => "Base URL", + "variables" => [ + "cluster" => [ + "description" => "No description provided", + "default_value" => "api", + "enum_values" => [ + "api", + "us1.api", + "as1.api", + "download", + "us1.download", + "as1.download" + ] + ] + ] + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings)); + } + + $host = $hostsSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/src/CustomEvents.php b/src/CustomEvents.php deleted file mode 100644 index 93ccd40..0000000 --- a/src/CustomEvents.php +++ /dev/null @@ -1,53 +0,0 @@ -client = $client; - } - - /** - * @param string $event - * @param array|stdClass $customer - * @param array|stdClass|null $metadata - * @param array|stdClass|null $referral - * @param array|stdClass|null $loyalty - * - * Track a custom event. - * - * @throws \Voucherify\ClientException - */ - - public function track($event, $customer, $metadata = null, $referral = null, $loyalty = null) - { - $params = [ - "event" => $event, - "customer" => $customer - ]; - - if ($metadata) { - $params["metadata"] = (object)$metadata; - } - - if ($referral) { - $params["referral"] = (object)$referral; - } - - if ($loyalty) { - $params["loyalty"] = (object)$loyalty; - } - - return $this->client->post("/events/", $params); - } -} diff --git a/src/CustomerBuilder.php b/src/CustomerBuilder.php deleted file mode 100644 index 49a5d3a..0000000 --- a/src/CustomerBuilder.php +++ /dev/null @@ -1,42 +0,0 @@ -_customer = (object)[]; - } - - public function setName($name) - { - $this->_customer->name = $name; - return $this; - } - - public function setEmail($email) - { - $this->_customer->email = $email; - return $this; - } - - public function setDescription($description) - { - $this->_customer->description = $description; - return $this; - } - - public function setMetadata($metadata) - { - $this->_customer->metadata = $metadata; - return $this; - } - - public function build() - { - return $this->_customer; - } -} diff --git a/src/Customers.php b/src/Customers.php deleted file mode 100644 index 09cead1..0000000 --- a/src/Customers.php +++ /dev/null @@ -1,93 +0,0 @@ -client = $client; - } - - /** - * @param stdClass $customer - * - * Create customer. - * - * @throws \Voucherify\ClientException - */ - public function create($customer) - { - return $this->client->post("/customers/", $customer, null); - } - - /** - * @param string $customerId - * - * Get customer details. - * - * @throws \Voucherify\ClientException - */ - public function get($customerId) - { - return $this->client->get("/customers/" . rawurlencode($customerId), null); - } - - /** - * @param array|stdClass $filter - * - * Get a filtered list of vouchers. The filter can include following properties: - * - limit - number (default 100) - * - page - number (default 1) - * - email - string - * - city - string - * - name - string - * - * @throws \Voucherify\ClientException - */ - public function getList($filter = null) - { - return $this->client->get("/customers/", $filter); - } - - /** - * @param array|stdClass $customer Object with customer fields for update - * - * Update customer. - * - * @throws \Voucherify\ClientException - */ - public function update($customer) - { - $customerId = ""; - - if (is_array($customer)) { - $customerId = $customer["id"]; - } - elseif (is_object($customer)) { - $customerId = $customer->id; - } - - return $this->client->put("/customers/" . rawurlencode($customerId), $customer, null); - } - - /** - * @param string $customerId Customer ID to delete - * - * Delete customer. - * - * @throws \Voucherify\ClientException - */ - public function delete($customerId) - { - return $this->client->delete("/customers/" . rawurlencode($customerId)); - } -} \ No newline at end of file diff --git a/src/Distributions.php b/src/Distributions.php deleted file mode 100644 index 90edf48..0000000 --- a/src/Distributions.php +++ /dev/null @@ -1,88 +0,0 @@ -client = $client; - } - - /** - * @param string|array|stdClass $params Campaign name or params object - * - * Publish voucher. - * - * @throws \Voucherify\ClientException - */ - public function publish($params) - { - $payload = null; - - if (is_string($params)) { - $payload = ["campaign" => $params]; - } - elseif (is_object($params) || is_array($params)) { - $payload = $params; - } - - return $this->client->post("/vouchers/publish", $payload, null); - } - - /** - * @param array|stdClass $params Export configuration - * - * Create export. - * - * @throws \Voucherify\ClientException - */ - public function createExport($params) - { - return $this->client->post("/exports/", $params); - } - - /** - * @param string $exportId - * - * Get export. - * - * @throws \Voucherify\ClientException - */ - public function getExport($exportId) - { - return $this->client->get("/exports/" . rawurlencode($exportId)); - } - - /** - * @param string $exportId - * - * Delete export. - * - * @throws \Voucherify\ClientException - */ - public function deleteExport($exportId) - { - return $this->client->delete("/exports/" . rawurlencode($exportId)); - } - - /** - * List publications. - * - * @param array|stdClass $params - * - * @throws \Voucherify\ClientException - */ - public function getPublications($params = null) - { - return $this->client->get("/publications", $params); - } -} \ No newline at end of file diff --git a/src/HeaderSelector.php b/src/HeaderSelector.php new file mode 100644 index 0000000..101446d --- /dev/null +++ b/src/HeaderSelector.php @@ -0,0 +1,246 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/src/Model/AccessSettingsCampaignAssignmentsList.php b/src/Model/AccessSettingsCampaignAssignmentsList.php new file mode 100644 index 0000000..69f9b92 --- /dev/null +++ b/src/Model/AccessSettingsCampaignAssignmentsList.php @@ -0,0 +1,614 @@ + + */ +class AccessSettingsCampaignAssignmentsList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AccessSettingsCampaignAssignmentsList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\AreaStoreCampaignAssignment[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['total']) && ($this->container['total'] < 0)) { + $invalidProperties[] = "invalid value for 'total', must be bigger than or equal to 0."; + } + + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `list`. This object stores information about campaign assignments to areas and stores + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of campaign assignments. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\AreaStoreCampaignAssignment[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\AreaStoreCampaignAssignment[]|null $data Contains an array of campaign assignments. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of areas and stores to which the campaign is assigned. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($total) && ($total < 0)) { + throw new \InvalidArgumentException('invalid value for $total when calling AccessSettingsCampaignAssignmentsList., must be bigger than or equal to 0.'); + } + + $this->container['total'] = $total; + + 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/ApplicableTo.php b/src/Model/ApplicableTo.php new file mode 100644 index 0000000..df6204e --- /dev/null +++ b/src/Model/ApplicableTo.php @@ -0,0 +1,1145 @@ + + */ +class ApplicableTo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ApplicableTo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'id' => 'string', + 'sourceId' => 'string', + 'productId' => 'string', + 'productSourceId' => 'string', + 'strict' => 'bool', + 'price' => 'float', + 'priceFormula' => 'float', + 'effect' => 'string', + 'quantityLimit' => 'int', + 'aggregatedQuantityLimit' => 'int', + 'amountLimit' => 'int', + 'aggregatedAmountLimit' => 'int', + 'orderItemIndices' => 'int[]', + 'repeat' => 'int', + 'skipInitially' => 'int', + 'target' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'id' => null, + 'sourceId' => null, + 'productId' => null, + 'productSourceId' => null, + 'strict' => null, + 'price' => null, + 'priceFormula' => null, + 'effect' => null, + 'quantityLimit' => null, + 'aggregatedQuantityLimit' => null, + 'amountLimit' => null, + 'aggregatedAmountLimit' => null, + 'orderItemIndices' => null, + 'repeat' => null, + 'skipInitially' => null, + 'target' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'id' => true, + 'sourceId' => true, + 'productId' => true, + 'productSourceId' => true, + 'strict' => true, + 'price' => true, + 'priceFormula' => true, + 'effect' => true, + 'quantityLimit' => true, + 'aggregatedQuantityLimit' => true, + 'amountLimit' => true, + 'aggregatedAmountLimit' => true, + 'orderItemIndices' => true, + 'repeat' => true, + 'skipInitially' => true, + 'target' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'id' => 'id', + 'sourceId' => 'source_id', + 'productId' => 'product_id', + 'productSourceId' => 'product_source_id', + 'strict' => 'strict', + 'price' => 'price', + 'priceFormula' => 'price_formula', + 'effect' => 'effect', + 'quantityLimit' => 'quantity_limit', + 'aggregatedQuantityLimit' => 'aggregated_quantity_limit', + 'amountLimit' => 'amount_limit', + 'aggregatedAmountLimit' => 'aggregated_amount_limit', + 'orderItemIndices' => 'order_item_indices', + 'repeat' => 'repeat', + 'skipInitially' => 'skip_initially', + 'target' => 'target' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'productId' => 'setProductId', + 'productSourceId' => 'setProductSourceId', + 'strict' => 'setStrict', + 'price' => 'setPrice', + 'priceFormula' => 'setPriceFormula', + 'effect' => 'setEffect', + 'quantityLimit' => 'setQuantityLimit', + 'aggregatedQuantityLimit' => 'setAggregatedQuantityLimit', + 'amountLimit' => 'setAmountLimit', + 'aggregatedAmountLimit' => 'setAggregatedAmountLimit', + 'orderItemIndices' => 'setOrderItemIndices', + 'repeat' => 'setRepeat', + 'skipInitially' => 'setSkipInitially', + 'target' => 'setTarget' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'productId' => 'getProductId', + 'productSourceId' => 'getProductSourceId', + 'strict' => 'getStrict', + 'price' => 'getPrice', + 'priceFormula' => 'getPriceFormula', + 'effect' => 'getEffect', + 'quantityLimit' => 'getQuantityLimit', + 'aggregatedQuantityLimit' => 'getAggregatedQuantityLimit', + 'amountLimit' => 'getAmountLimit', + 'aggregatedAmountLimit' => 'getAggregatedAmountLimit', + 'orderItemIndices' => 'getOrderItemIndices', + 'repeat' => 'getRepeat', + 'skipInitially' => 'getSkipInitially', + 'target' => 'getTarget' + ]; + + /** + * 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 OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + public const OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const EFFECT_EVERY = 'APPLY_TO_EVERY'; + public const EFFECT_CHEAPEST = 'APPLY_TO_CHEAPEST'; + public const EFFECT_MOST_EXPENSIVE = 'APPLY_TO_MOST_EXPENSIVE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + self::OBJECT_PRODUCTS_COLLECTION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_EVERY, + self::EFFECT_CHEAPEST, + self::EFFECT_MOST_EXPENSIVE, + ]; + } + + /** + * 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('object', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('productSourceId', $data ?? [], null); + $this->setIfExists('strict', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('priceFormula', $data ?? [], null); + $this->setIfExists('effect', $data ?? [], null); + $this->setIfExists('quantityLimit', $data ?? [], null); + $this->setIfExists('aggregatedQuantityLimit', $data ?? [], null); + $this->setIfExists('amountLimit', $data ?? [], null); + $this->setIfExists('aggregatedAmountLimit', $data ?? [], null); + $this->setIfExists('orderItemIndices', $data ?? [], null); + $this->setIfExists('repeat', $data ?? [], null); + $this->setIfExists('skipInitially', $data ?? [], null); + $this->setIfExists('target', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object This object stores information about the product collection. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product collection ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The source ID from your inventory system. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId Parent product's unique ID assigned by Voucherify. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets productSourceId + * + * @return string|null + */ + public function getProductSourceId() + { + return $this->container['productSourceId']; + } + + /** + * Sets productSourceId + * + * @param string|null $productSourceId Parent product's source ID from your inventory system. + * + * @return self + */ + public function setProductSourceId($productSourceId) + { + if (is_null($productSourceId)) { + array_push($this->openAPINullablesSetToNull, 'productSourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productSourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productSourceId'] = $productSourceId; + + return $this; + } + + /** + * Gets strict + * + * @return bool|null + */ + public function getStrict() + { + return $this->container['strict']; + } + + /** + * Sets strict + * + * @param bool|null $strict strict + * + * @return self + */ + public function setStrict($strict) + { + if (is_null($strict)) { + array_push($this->openAPINullablesSetToNull, 'strict'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('strict', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['strict'] = $strict; + + return $this; + } + + /** + * Gets price + * + * @return float|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float|null $price New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets priceFormula + * + * @return float|null + */ + public function getPriceFormula() + { + return $this->container['priceFormula']; + } + + /** + * Sets priceFormula + * + * @param float|null $priceFormula Formula used to calculate the discounted price of an item. + * + * @return self + */ + public function setPriceFormula($priceFormula) + { + if (is_null($priceFormula)) { + array_push($this->openAPINullablesSetToNull, 'priceFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('priceFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['priceFormula'] = $priceFormula; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect effect + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + return $this; + } + + /** + * Gets quantityLimit + * + * @return int|null + */ + public function getQuantityLimit() + { + return $this->container['quantityLimit']; + } + + /** + * Sets quantityLimit + * + * @param int|null $quantityLimit The maximum number of units allowed to be discounted per order line item. + * + * @return self + */ + public function setQuantityLimit($quantityLimit) + { + if (is_null($quantityLimit)) { + array_push($this->openAPINullablesSetToNull, 'quantityLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantityLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantityLimit'] = $quantityLimit; + + return $this; + } + + /** + * Gets aggregatedQuantityLimit + * + * @return int|null + */ + public function getAggregatedQuantityLimit() + { + return $this->container['aggregatedQuantityLimit']; + } + + /** + * Sets aggregatedQuantityLimit + * + * @param int|null $aggregatedQuantityLimit The maximum number of units allowed to be discounted combined across all matched order line items. + * + * @return self + */ + public function setAggregatedQuantityLimit($aggregatedQuantityLimit) + { + if (is_null($aggregatedQuantityLimit)) { + array_push($this->openAPINullablesSetToNull, 'aggregatedQuantityLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('aggregatedQuantityLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['aggregatedQuantityLimit'] = $aggregatedQuantityLimit; + + return $this; + } + + /** + * Gets amountLimit + * + * @return int|null + */ + public function getAmountLimit() + { + return $this->container['amountLimit']; + } + + /** + * Sets amountLimit + * + * @param int|null $amountLimit Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. + * + * @return self + */ + public function setAmountLimit($amountLimit) + { + if (is_null($amountLimit)) { + array_push($this->openAPINullablesSetToNull, 'amountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountLimit'] = $amountLimit; + + return $this; + } + + /** + * Gets aggregatedAmountLimit + * + * @return int|null + */ + public function getAggregatedAmountLimit() + { + return $this->container['aggregatedAmountLimit']; + } + + /** + * Sets aggregatedAmountLimit + * + * @param int|null $aggregatedAmountLimit Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value) + * + * @return self + */ + public function setAggregatedAmountLimit($aggregatedAmountLimit) + { + if (is_null($aggregatedAmountLimit)) { + array_push($this->openAPINullablesSetToNull, 'aggregatedAmountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('aggregatedAmountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['aggregatedAmountLimit'] = $aggregatedAmountLimit; + + return $this; + } + + /** + * Gets orderItemIndices + * + * @return int[]|null + */ + public function getOrderItemIndices() + { + return $this->container['orderItemIndices']; + } + + /** + * Sets orderItemIndices + * + * @param int[]|null $orderItemIndices orderItemIndices + * + * @return self + */ + public function setOrderItemIndices($orderItemIndices) + { + if (is_null($orderItemIndices)) { + array_push($this->openAPINullablesSetToNull, 'orderItemIndices'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItemIndices', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItemIndices'] = $orderItemIndices; + + return $this; + } + + /** + * Gets repeat + * + * @return int|null + */ + public function getRepeat() + { + return $this->container['repeat']; + } + + /** + * Sets repeat + * + * @param int|null $repeat repeat + * + * @return self + */ + public function setRepeat($repeat) + { + if (is_null($repeat)) { + array_push($this->openAPINullablesSetToNull, 'repeat'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('repeat', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['repeat'] = $repeat; + + return $this; + } + + /** + * Gets skipInitially + * + * @return int|null + */ + public function getSkipInitially() + { + return $this->container['skipInitially']; + } + + /** + * Sets skipInitially + * + * @param int|null $skipInitially skipInitially + * + * @return self + */ + public function setSkipInitially($skipInitially) + { + if (is_null($skipInitially)) { + array_push($this->openAPINullablesSetToNull, 'skipInitially'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skipInitially', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skipInitially'] = $skipInitially; + + return $this; + } + + /** + * Gets target + * + * @return string|null + */ + public function getTarget() + { + return $this->container['target']; + } + + /** + * Sets target + * + * @param string|null $target target + * + * @return self + */ + public function setTarget($target) + { + if (is_null($target)) { + array_push($this->openAPINullablesSetToNull, 'target'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('target', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['target'] = $target; + + 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/ApplicableToResultList.php b/src/Model/ApplicableToResultList.php new file mode 100644 index 0000000..9c40ee1 --- /dev/null +++ b/src/Model/ApplicableToResultList.php @@ -0,0 +1,613 @@ + + */ +class ApplicableToResultList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ApplicableToResultList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'total' => 'int', + 'object' => 'string', + 'dataRef' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'total' => null, + 'object' => null, + 'dataRef' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => true, + 'total' => true, + 'object' => true, + 'dataRef' => true + ]; + + /** + * 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 = [ + 'data' => 'data', + 'total' => 'total', + 'object' => 'object', + 'dataRef' => 'data_ref' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'total' => 'setTotal', + 'object' => 'setObject', + 'dataRef' => 'setDataRef' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'total' => 'getTotal', + 'object' => 'getObject', + 'dataRef' => 'getDataRef' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + } + + /** + * 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 = []; + + if (!is_null($this->container['total']) && ($this->container['total'] < 0)) { + $invalidProperties[] = "invalid value for 'total', must be bigger than or equal to 0."; + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 data + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $data Contains array of items to which the discount can apply. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of objects defining included products, SKUs, or product collections. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($total) && ($total < 0)) { + throw new \InvalidArgumentException('invalid value for $total when calling ApplicableToResultList., must be bigger than or equal to 0.'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef The type of the object represented by JSON. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + 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/AreaStoreCampaignAssignment.php b/src/Model/AreaStoreCampaignAssignment.php new file mode 100644 index 0000000..3f1357f --- /dev/null +++ b/src/Model/AreaStoreCampaignAssignment.php @@ -0,0 +1,614 @@ + + */ +class AreaStoreCampaignAssignment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AreaStoreCampaignAssignment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'areaId' => 'string', + 'areaStoreId' => 'string', + 'createdAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'areaId' => null, + 'areaStoreId' => null, + 'createdAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'areaId' => true, + 'areaStoreId' => true, + 'createdAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'areaId' => 'area_id', + 'areaStoreId' => 'area_store_id', + 'createdAt' => 'created_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'areaId' => 'setAreaId', + 'areaStoreId' => 'setAreaStoreId', + 'createdAt' => 'setCreatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'areaId' => 'getAreaId', + 'areaStoreId' => 'getAreaStoreId', + 'createdAt' => 'getCreatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_AREA_STORE_CAMPAIGN_ASSIGNMENT = 'area_store_campaign_assignment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_AREA_STORE_CAMPAIGN_ASSIGNMENT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('areaId', $data ?? [], null); + $this->setIfExists('areaStoreId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'area_store_campaign_assignment'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the campaign assignment. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets areaId + * + * @return string|null + */ + public function getAreaId() + { + return $this->container['areaId']; + } + + /** + * Sets areaId + * + * @param string|null $areaId Unique identifier of the area to which the campaign is assigned. + * + * @return self + */ + public function setAreaId($areaId) + { + if (is_null($areaId)) { + array_push($this->openAPINullablesSetToNull, 'areaId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('areaId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['areaId'] = $areaId; + + return $this; + } + + /** + * Gets areaStoreId + * + * @return string|null + */ + public function getAreaStoreId() + { + return $this->container['areaStoreId']; + } + + /** + * Sets areaStoreId + * + * @param string|null $areaStoreId Unique identifier of the store to which the campaign is assigned. + * + * @return self + */ + public function setAreaStoreId($areaStoreId) + { + if (is_null($areaStoreId)) { + array_push($this->openAPINullablesSetToNull, 'areaStoreId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('areaStoreId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['areaStoreId'] = $areaStoreId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Date and time when the assignment was made. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign assignment to areas or stores. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/AsyncActionBase.php b/src/Model/AsyncActionBase.php new file mode 100644 index 0000000..15a6e2e --- /dev/null +++ b/src/Model/AsyncActionBase.php @@ -0,0 +1,873 @@ + + */ +class AsyncActionBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AsyncActionBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'status' => 'string', + 'operationStatus' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'requestId' => 'string', + 'processingTime' => 'int', + 'progress' => 'int', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'status' => null, + 'operationStatus' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'requestId' => null, + 'processingTime' => null, + 'progress' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true, + 'status' => true, + 'operationStatus' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'requestId' => true, + 'processingTime' => true, + 'progress' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type', + 'status' => 'status', + 'operationStatus' => 'operation_status', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'requestId' => 'request_id', + 'processingTime' => 'processing_time', + 'progress' => 'progress', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'status' => 'setStatus', + 'operationStatus' => 'setOperationStatus', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'requestId' => 'setRequestId', + 'processingTime' => 'setProcessingTime', + 'progress' => 'setProgress', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'status' => 'getStatus', + 'operationStatus' => 'getOperationStatus', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'requestId' => 'getRequestId', + 'processingTime' => 'getProcessingTime', + 'progress' => 'getProgress', + 'object' => 'getObject' + ]; + + /** + * 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 STATUS_DONE = 'DONE'; + public const STATUS_ENQUEUED = 'ENQUEUED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const OBJECT_ASYNC_ACTION = 'async_action'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_DONE, + self::STATUS_ENQUEUED, + self::STATUS_FAILED, + self::STATUS_IN_PROGRESS, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ASYNC_ACTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('operationStatus', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('requestId', $data ?? [], null); + $this->setIfExists('processingTime', $data ?? [], null); + $this->setIfExists('progress', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'async_action'); + } + + /** + * 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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['progress']) && ($this->container['progress'] > 100)) { + $invalidProperties[] = "invalid value for 'progress', must be smaller than or equal to 100."; + } + + if (!is_null($this->container['progress']) && ($this->container['progress'] < 0)) { + $invalidProperties[] = "invalid value for 'progress', must be bigger than or equal to 0."; + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Async action unique ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of async action. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the async action. Informs you whether the async action has already been completed. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets operationStatus + * + * @return string|null + */ + public function getOperationStatus() + { + return $this->container['operationStatus']; + } + + /** + * Sets operationStatus + * + * @param string|null $operationStatus Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. + * + * @return self + */ + public function setOperationStatus($operationStatus) + { + if (is_null($operationStatus)) { + array_push($this->openAPINullablesSetToNull, 'operationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('operationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['operationStatus'] = $operationStatus; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets requestId + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['requestId']; + } + + /** + * Sets requestId + * + * @param string|null $requestId Unique request ID. + * + * @return self + */ + public function setRequestId($requestId) + { + if (is_null($requestId)) { + array_push($this->openAPINullablesSetToNull, 'requestId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('requestId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['requestId'] = $requestId; + + return $this; + } + + /** + * Gets processingTime + * + * @return int|null + */ + public function getProcessingTime() + { + return $this->container['processingTime']; + } + + /** + * Sets processingTime + * + * @param int|null $processingTime The length of time it took to process the request in milliseconds. + * + * @return self + */ + public function setProcessingTime($processingTime) + { + if (is_null($processingTime)) { + array_push($this->openAPINullablesSetToNull, 'processingTime'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('processingTime', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['processingTime'] = $processingTime; + + return $this; + } + + /** + * Gets progress + * + * @return int|null + */ + public function getProgress() + { + return $this->container['progress']; + } + + /** + * Sets progress + * + * @param int|null $progress % progress to completion of the asynchronous action. + * + * @return self + */ + public function setProgress($progress) + { + if (is_null($progress)) { + array_push($this->openAPINullablesSetToNull, 'progress'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('progress', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($progress) && ($progress > 100)) { + throw new \InvalidArgumentException('invalid value for $progress when calling AsyncActionBase., must be smaller than or equal to 100.'); + } + if (!is_null($progress) && ($progress < 0)) { + throw new \InvalidArgumentException('invalid value for $progress when calling AsyncActionBase., must be bigger than or equal to 0.'); + } + + $this->container['progress'] = $progress; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the `async_action`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/AsyncActionGetResponseBody.php b/src/Model/AsyncActionGetResponseBody.php new file mode 100644 index 0000000..753e7c5 --- /dev/null +++ b/src/Model/AsyncActionGetResponseBody.php @@ -0,0 +1,914 @@ + + */ +class AsyncActionGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AsyncActionGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'status' => 'string', + 'operationStatus' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'requestId' => 'string', + 'processingTime' => 'int', + 'progress' => 'int', + 'object' => 'string', + 'result' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'status' => null, + 'operationStatus' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'requestId' => null, + 'processingTime' => null, + 'progress' => null, + 'object' => null, + 'result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true, + 'status' => true, + 'operationStatus' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'requestId' => true, + 'processingTime' => true, + 'progress' => true, + 'object' => true, + 'result' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type', + 'status' => 'status', + 'operationStatus' => 'operation_status', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'requestId' => 'request_id', + 'processingTime' => 'processing_time', + 'progress' => 'progress', + 'object' => 'object', + 'result' => 'result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'status' => 'setStatus', + 'operationStatus' => 'setOperationStatus', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'requestId' => 'setRequestId', + 'processingTime' => 'setProcessingTime', + 'progress' => 'setProgress', + 'object' => 'setObject', + 'result' => 'setResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'status' => 'getStatus', + 'operationStatus' => 'getOperationStatus', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'requestId' => 'getRequestId', + 'processingTime' => 'getProcessingTime', + 'progress' => 'getProgress', + 'object' => 'getObject', + 'result' => 'getResult' + ]; + + /** + * 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 STATUS_DONE = 'DONE'; + public const STATUS_ENQUEUED = 'ENQUEUED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const OBJECT_ASYNC_ACTION = 'async_action'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_DONE, + self::STATUS_ENQUEUED, + self::STATUS_FAILED, + self::STATUS_IN_PROGRESS, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ASYNC_ACTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('operationStatus', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('requestId', $data ?? [], null); + $this->setIfExists('processingTime', $data ?? [], null); + $this->setIfExists('progress', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'async_action'); + $this->setIfExists('result', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['progress']) && ($this->container['progress'] > 100)) { + $invalidProperties[] = "invalid value for 'progress', must be smaller than or equal to 100."; + } + + if (!is_null($this->container['progress']) && ($this->container['progress'] < 0)) { + $invalidProperties[] = "invalid value for 'progress', must be bigger than or equal to 0."; + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Async action unique ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of async action. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the async action. Informs you whether the async action has already been completed. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets operationStatus + * + * @return string|null + */ + public function getOperationStatus() + { + return $this->container['operationStatus']; + } + + /** + * Sets operationStatus + * + * @param string|null $operationStatus Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. + * + * @return self + */ + public function setOperationStatus($operationStatus) + { + if (is_null($operationStatus)) { + array_push($this->openAPINullablesSetToNull, 'operationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('operationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['operationStatus'] = $operationStatus; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets requestId + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['requestId']; + } + + /** + * Sets requestId + * + * @param string|null $requestId Unique request ID. + * + * @return self + */ + public function setRequestId($requestId) + { + if (is_null($requestId)) { + array_push($this->openAPINullablesSetToNull, 'requestId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('requestId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['requestId'] = $requestId; + + return $this; + } + + /** + * Gets processingTime + * + * @return int|null + */ + public function getProcessingTime() + { + return $this->container['processingTime']; + } + + /** + * Sets processingTime + * + * @param int|null $processingTime The length of time it took to process the request in milliseconds. + * + * @return self + */ + public function setProcessingTime($processingTime) + { + if (is_null($processingTime)) { + array_push($this->openAPINullablesSetToNull, 'processingTime'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('processingTime', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['processingTime'] = $processingTime; + + return $this; + } + + /** + * Gets progress + * + * @return int|null + */ + public function getProgress() + { + return $this->container['progress']; + } + + /** + * Sets progress + * + * @param int|null $progress % progress to completion of the asynchronous action. + * + * @return self + */ + public function setProgress($progress) + { + if (is_null($progress)) { + array_push($this->openAPINullablesSetToNull, 'progress'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('progress', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($progress) && ($progress > 100)) { + throw new \InvalidArgumentException('invalid value for $progress when calling AsyncActionGetResponseBody., must be smaller than or equal to 100.'); + } + if (!is_null($progress) && ($progress < 0)) { + throw new \InvalidArgumentException('invalid value for $progress when calling AsyncActionGetResponseBody., must be bigger than or equal to 0.'); + } + + $this->container['progress'] = $progress; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the `async_action`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets result + * + * @return object|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param object|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + 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/AsyncActionsListResponseBody.php b/src/Model/AsyncActionsListResponseBody.php new file mode 100644 index 0000000..f57d0b4 --- /dev/null +++ b/src/Model/AsyncActionsListResponseBody.php @@ -0,0 +1,564 @@ + + */ +class AsyncActionsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AsyncActionsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'asyncActions' => '\OpenAPI\Client\Model\AsyncActionBase[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'asyncActions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'asyncActions' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'asyncActions' => 'async_actions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'asyncActions' => 'setAsyncActions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'asyncActions' => 'getAsyncActions' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_ASYNC_ACTIONS = 'async_actions'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_ASYNC_ACTIONS, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'async_actions'); + $this->setIfExists('asyncActions', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about asynchronous actions. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of asynchronous actions. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets asyncActions + * + * @return \OpenAPI\Client\Model\AsyncActionBase[]|null + */ + public function getAsyncActions() + { + return $this->container['asyncActions']; + } + + /** + * Sets asyncActions + * + * @param \OpenAPI\Client\Model\AsyncActionBase[]|null $asyncActions asyncActions + * + * @return self + */ + public function setAsyncActions($asyncActions) + { + if (is_null($asyncActions)) { + array_push($this->openAPINullablesSetToNull, 'asyncActions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActions'] = $asyncActions; + + 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/BusValRuleAssignment.php b/src/Model/BusValRuleAssignment.php new file mode 100644 index 0000000..5793ac5 --- /dev/null +++ b/src/Model/BusValRuleAssignment.php @@ -0,0 +1,814 @@ + + */ +class BusValRuleAssignment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BusValRuleAssignment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'ruleId' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'validationStatus' => 'string', + 'validationOmittedRules' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'ruleId' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'validationStatus' => null, + 'validationOmittedRules' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'ruleId' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'validationStatus' => true, + 'validationOmittedRules' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'ruleId' => 'rule_id', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'validationStatus' => 'validation_status', + 'validationOmittedRules' => 'validation_omitted_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'ruleId' => 'setRuleId', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'validationStatus' => 'setValidationStatus', + 'validationOmittedRules' => 'setValidationOmittedRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'ruleId' => 'getRuleId', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'validationStatus' => 'getValidationStatus', + 'validationOmittedRules' => 'getValidationOmittedRules' + ]; + + /** + * 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 OBJECT_VALIDATION_RULES_ASSIGNMENT = 'validation_rules_assignment'; + public const VALIDATION_STATUS_VALID = 'VALID'; + public const VALIDATION_STATUS_PARTIALLY_VALID = 'PARTIALLY_VALID'; + public const VALIDATION_STATUS_INVALID = 'INVALID'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VALIDATION_RULES_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidationStatusAllowableValues() + { + return [ + self::VALIDATION_STATUS_VALID, + self::VALIDATION_STATUS_PARTIALLY_VALID, + self::VALIDATION_STATUS_INVALID, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('ruleId', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'validation_rules_assignment'); + $this->setIfExists('validationStatus', $data ?? [], null); + $this->setIfExists('validationOmittedRules', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getValidationStatusAllowableValues(); + if (!is_null($this->container['validationStatus']) && !in_array($this->container['validationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'validationStatus', must be one of '%s'", + $this->container['validationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier for a assignment + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets ruleId + * + * @return string|null + */ + public function getRuleId() + { + return $this->container['ruleId']; + } + + /** + * Sets ruleId + * + * @param string|null $ruleId The unique identifier for a rule + * + * @return self + */ + public function setRuleId($ruleId) + { + if (is_null($ruleId)) { + array_push($this->openAPINullablesSetToNull, 'ruleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ruleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ruleId'] = $ruleId; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId The unique identifier for a related object + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType The type of related object + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the object was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationStatus + * + * @return string|null + */ + public function getValidationStatus() + { + return $this->container['validationStatus']; + } + + /** + * Sets validationStatus + * + * @param string|null $validationStatus The validation status of the assignment + * + * @return self + */ + public function setValidationStatus($validationStatus) + { + if (is_null($validationStatus)) { + array_push($this->openAPINullablesSetToNull, 'validationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidationStatusAllowableValues(); + if (!is_null($validationStatus) && !in_array($validationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'validationStatus', must be one of '%s'", + $validationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['validationStatus'] = $validationStatus; + + return $this; + } + + /** + * Gets validationOmittedRules + * + * @return string[]|null + */ + public function getValidationOmittedRules() + { + return $this->container['validationOmittedRules']; + } + + /** + * Sets validationOmittedRules + * + * @param string[]|null $validationOmittedRules The list of omitted rules + * + * @return self + */ + public function setValidationOmittedRules($validationOmittedRules) + { + if (is_null($validationOmittedRules)) { + array_push($this->openAPINullablesSetToNull, 'validationOmittedRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationOmittedRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationOmittedRules'] = $validationOmittedRules; + + 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/CampaignBase.php b/src/Model/CampaignBase.php new file mode 100644 index 0000000..e4545c3 --- /dev/null +++ b/src/Model/CampaignBase.php @@ -0,0 +1,1721 @@ + + */ +class CampaignBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'campaignType' => 'string', + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\CampaignVoucher', + 'autoJoin' => 'bool', + 'joinOnce' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'active' => 'bool', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'category' => 'string', + 'creationStatus' => 'string', + 'vouchersGenerationStatus' => 'string', + 'protected' => 'bool', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'object' => 'string', + 'referralProgram' => '\OpenAPI\Client\Model\ReferralProgram', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'description' => null, + 'campaignType' => null, + 'type' => null, + 'voucher' => null, + 'autoJoin' => null, + 'joinOnce' => null, + 'useVoucherMetadataSchema' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'active' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'category' => null, + 'creationStatus' => null, + 'vouchersGenerationStatus' => null, + 'protected' => null, + 'categoryId' => null, + 'categories' => null, + 'object' => null, + 'referralProgram' => null, + 'loyaltyTiersExpiration' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'description' => true, + 'campaignType' => true, + 'type' => true, + 'voucher' => false, + 'autoJoin' => true, + 'joinOnce' => true, + 'useVoucherMetadataSchema' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'active' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'category' => true, + 'creationStatus' => true, + 'vouchersGenerationStatus' => true, + 'protected' => true, + 'categoryId' => true, + 'categories' => true, + 'object' => true, + 'referralProgram' => false, + 'loyaltyTiersExpiration' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'campaignType' => 'campaign_type', + 'type' => 'type', + 'voucher' => 'voucher', + 'autoJoin' => 'auto_join', + 'joinOnce' => 'join_once', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'active' => 'active', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'category' => 'category', + 'creationStatus' => 'creation_status', + 'vouchersGenerationStatus' => 'vouchers_generation_status', + 'protected' => 'protected', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'object' => 'object', + 'referralProgram' => 'referral_program', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'campaignType' => 'setCampaignType', + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'autoJoin' => 'setAutoJoin', + 'joinOnce' => 'setJoinOnce', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'category' => 'setCategory', + 'creationStatus' => 'setCreationStatus', + 'vouchersGenerationStatus' => 'setVouchersGenerationStatus', + 'protected' => 'setProtected', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'object' => 'setObject', + 'referralProgram' => 'setReferralProgram', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'campaignType' => 'getCampaignType', + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'autoJoin' => 'getAutoJoin', + 'joinOnce' => 'getJoinOnce', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'category' => 'getCategory', + 'creationStatus' => 'getCreationStatus', + 'vouchersGenerationStatus' => 'getVouchersGenerationStatus', + 'protected' => 'getProtected', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'object' => 'getObject', + 'referralProgram' => 'getReferralProgram', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration' + ]; + + /** + * 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 CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const CAMPAIGN_TYPE_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const CAMPAIGN_TYPE_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const CAMPAIGN_TYPE_PROMOTION = 'PROMOTION'; + public const CAMPAIGN_TYPE_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const CAMPAIGN_TYPE_LUCKY_DRAW = 'LUCKY_DRAW'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CREATION_STATUS_DONE = 'DONE'; + public const CREATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const CREATION_STATUS_FAILED = 'FAILED'; + public const CREATION_STATUS_DRAFT = 'DRAFT'; + public const CREATION_STATUS_MODIFYING = 'MODIFYING'; + public const VOUCHERS_GENERATION_STATUS_DONE = 'DONE'; + public const VOUCHERS_GENERATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const VOUCHERS_GENERATION_STATUS_FAILED = 'FAILED'; + public const VOUCHERS_GENERATION_STATUS_DRAFT = 'DRAFT'; + public const VOUCHERS_GENERATION_STATUS_MODIFYING = 'MODIFYING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + self::CAMPAIGN_TYPE_GIFT_VOUCHERS, + self::CAMPAIGN_TYPE_DISCOUNT_COUPONS, + self::CAMPAIGN_TYPE_PROMOTION, + self::CAMPAIGN_TYPE_REFERRAL_PROGRAM, + self::CAMPAIGN_TYPE_LUCKY_DRAW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCreationStatusAllowableValues() + { + return [ + self::CREATION_STATUS_DONE, + self::CREATION_STATUS_IN_PROGRESS, + self::CREATION_STATUS_FAILED, + self::CREATION_STATUS_DRAFT, + self::CREATION_STATUS_MODIFYING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVouchersGenerationStatusAllowableValues() + { + return [ + self::VOUCHERS_GENERATION_STATUS_DONE, + self::VOUCHERS_GENERATION_STATUS_IN_PROGRESS, + self::VOUCHERS_GENERATION_STATUS_FAILED, + self::VOUCHERS_GENERATION_STATUS_DRAFT, + self::VOUCHERS_GENERATION_STATUS_MODIFYING, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('creationStatus', $data ?? [], null); + $this->setIfExists('vouchersGenerationStatus', $data ?? [], null); + $this->setIfExists('protected', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + $this->setIfExists('referralProgram', $data ?? [], null); + $this->setIfExists('loyaltyTiersExpiration', $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->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($this->container['creationStatus']) && !in_array($this->container['creationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'creationStatus', must be one of '%s'", + $this->container['creationStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($this->container['vouchersGenerationStatus']) && !in_array($this->container['vouchersGenerationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $this->container['vouchersGenerationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\CampaignVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\CampaignVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign. + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Unique category name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets creationStatus + * + * @return string|null + */ + public function getCreationStatus() + { + return $this->container['creationStatus']; + } + + /** + * Sets creationStatus + * + * @param string|null $creationStatus Indicates the status of the campaign creation. + * + * @return self + */ + public function setCreationStatus($creationStatus) + { + if (is_null($creationStatus)) { + array_push($this->openAPINullablesSetToNull, 'creationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($creationStatus) && !in_array($creationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'creationStatus', must be one of '%s'", + $creationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['creationStatus'] = $creationStatus; + + return $this; + } + + /** + * Gets vouchersGenerationStatus + * + * @return string|null + */ + public function getVouchersGenerationStatus() + { + return $this->container['vouchersGenerationStatus']; + } + + /** + * Sets vouchersGenerationStatus + * + * @param string|null $vouchersGenerationStatus Indicates the status of the campaign's voucher generation. + * + * @return self + */ + public function setVouchersGenerationStatus($vouchersGenerationStatus) + { + if (is_null($vouchersGenerationStatus)) { + array_push($this->openAPINullablesSetToNull, 'vouchersGenerationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersGenerationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($vouchersGenerationStatus) && !in_array($vouchersGenerationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $vouchersGenerationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['vouchersGenerationStatus'] = $vouchersGenerationStatus; + + return $this; + } + + /** + * Gets protected + * + * @return bool|null + */ + public function getProtected() + { + return $this->container['protected']; + } + + /** + * Sets protected + * + * @param bool|null $protected Indicates whether the resource can be deleted. + * + * @return self + */ + public function setProtected($protected) + { + if (is_null($protected)) { + array_push($this->openAPINullablesSetToNull, 'protected'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('protected', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['protected'] = $protected; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets referralProgram + * + * @return \OpenAPI\Client\Model\ReferralProgram|null + */ + public function getReferralProgram() + { + return $this->container['referralProgram']; + } + + /** + * Sets referralProgram + * + * @param \OpenAPI\Client\Model\ReferralProgram|null $referralProgram referralProgram + * + * @return self + */ + public function setReferralProgram($referralProgram) + { + if (is_null($referralProgram)) { + throw new \InvalidArgumentException('non-nullable referralProgram cannot be null'); + } + $this->container['referralProgram'] = $referralProgram; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + 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/CampaignLoyaltyCard.php b/src/Model/CampaignLoyaltyCard.php new file mode 100644 index 0000000..71489d6 --- /dev/null +++ b/src/Model/CampaignLoyaltyCard.php @@ -0,0 +1,459 @@ + + */ +class CampaignLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'expirationRules' => '\OpenAPI\Client\Model\CampaignLoyaltyCardExpirationRules' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'expirationRules' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'expirationRules' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'expirationRules' => 'expiration_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'expirationRules' => 'setExpirationRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'expirationRules' => 'getExpirationRules' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('expirationRules', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets expirationRules + * + * @return \OpenAPI\Client\Model\CampaignLoyaltyCardExpirationRules|null + */ + public function getExpirationRules() + { + return $this->container['expirationRules']; + } + + /** + * Sets expirationRules + * + * @param \OpenAPI\Client\Model\CampaignLoyaltyCardExpirationRules|null $expirationRules expirationRules + * + * @return self + */ + public function setExpirationRules($expirationRules) + { + if (is_null($expirationRules)) { + array_push($this->openAPINullablesSetToNull, 'expirationRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationRules'] = $expirationRules; + + 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/CampaignLoyaltyCardExpirationRules.php b/src/Model/CampaignLoyaltyCardExpirationRules.php new file mode 100644 index 0000000..6684fe8 --- /dev/null +++ b/src/Model/CampaignLoyaltyCardExpirationRules.php @@ -0,0 +1,612 @@ + + */ +class CampaignLoyaltyCardExpirationRules implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignLoyaltyCardExpirationRules'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'periodType' => 'string', + 'periodValue' => 'int', + 'roundingType' => 'string', + 'roundingValue' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'periodType' => null, + 'periodValue' => null, + 'roundingType' => null, + 'roundingValue' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'periodType' => true, + 'periodValue' => true, + 'roundingType' => true, + 'roundingValue' => true + ]; + + /** + * 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 = [ + 'periodType' => 'period_type', + 'periodValue' => 'period_value', + 'roundingType' => 'rounding_type', + 'roundingValue' => 'rounding_value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'periodType' => 'setPeriodType', + 'periodValue' => 'setPeriodValue', + 'roundingType' => 'setRoundingType', + 'roundingValue' => 'setRoundingValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'periodType' => 'getPeriodType', + 'periodValue' => 'getPeriodValue', + 'roundingType' => 'getRoundingType', + 'roundingValue' => 'getRoundingValue' + ]; + + /** + * 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 PERIOD_TYPE_MONTH = 'MONTH'; + public const ROUNDING_TYPE_END_OF_MONTH = 'END_OF_MONTH'; + public const ROUNDING_TYPE_END_OF_QUARTER = 'END_OF_QUARTER'; + public const ROUNDING_TYPE_END_OF_HALF_YEAR = 'END_OF_HALF_YEAR'; + public const ROUNDING_TYPE_END_OF_YEAR = 'END_OF_YEAR'; + public const ROUNDING_TYPE_PARTICULAR_MONTH = 'PARTICULAR_MONTH'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getPeriodTypeAllowableValues() + { + return [ + self::PERIOD_TYPE_MONTH, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRoundingTypeAllowableValues() + { + return [ + self::ROUNDING_TYPE_END_OF_MONTH, + self::ROUNDING_TYPE_END_OF_QUARTER, + self::ROUNDING_TYPE_END_OF_HALF_YEAR, + self::ROUNDING_TYPE_END_OF_YEAR, + self::ROUNDING_TYPE_PARTICULAR_MONTH, + ]; + } + + /** + * 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('periodType', $data ?? [], 'MONTH'); + $this->setIfExists('periodValue', $data ?? [], null); + $this->setIfExists('roundingType', $data ?? [], null); + $this->setIfExists('roundingValue', $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->getPeriodTypeAllowableValues(); + if (!is_null($this->container['periodType']) && !in_array($this->container['periodType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'periodType', must be one of '%s'", + $this->container['periodType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRoundingTypeAllowableValues(); + if (!is_null($this->container['roundingType']) && !in_array($this->container['roundingType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'roundingType', must be one of '%s'", + $this->container['roundingType'], + 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 periodType + * + * @return string|null + */ + public function getPeriodType() + { + return $this->container['periodType']; + } + + /** + * Sets periodType + * + * @param string|null $periodType Type of period + * + * @return self + */ + public function setPeriodType($periodType) + { + if (is_null($periodType)) { + array_push($this->openAPINullablesSetToNull, 'periodType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('periodType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getPeriodTypeAllowableValues(); + if (!is_null($periodType) && !in_array($periodType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'periodType', must be one of '%s'", + $periodType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['periodType'] = $periodType; + + return $this; + } + + /** + * Gets periodValue + * + * @return int|null + */ + public function getPeriodValue() + { + return $this->container['periodValue']; + } + + /** + * Sets periodValue + * + * @param int|null $periodValue Value of the period + * + * @return self + */ + public function setPeriodValue($periodValue) + { + if (is_null($periodValue)) { + array_push($this->openAPINullablesSetToNull, 'periodValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('periodValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['periodValue'] = $periodValue; + + return $this; + } + + /** + * Gets roundingType + * + * @return string|null + */ + public function getRoundingType() + { + return $this->container['roundingType']; + } + + /** + * Sets roundingType + * + * @param string|null $roundingType Type of rounding + * + * @return self + */ + public function setRoundingType($roundingType) + { + if (is_null($roundingType)) { + array_push($this->openAPINullablesSetToNull, 'roundingType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('roundingType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRoundingTypeAllowableValues(); + if (!is_null($roundingType) && !in_array($roundingType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'roundingType', must be one of '%s'", + $roundingType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['roundingType'] = $roundingType; + + return $this; + } + + /** + * Gets roundingValue + * + * @return int|null + */ + public function getRoundingValue() + { + return $this->container['roundingValue']; + } + + /** + * Sets roundingValue + * + * @param int|null $roundingValue Value of rounding + * + * @return self + */ + public function setRoundingValue($roundingValue) + { + if (is_null($roundingValue)) { + array_push($this->openAPINullablesSetToNull, 'roundingValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('roundingValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['roundingValue'] = $roundingValue; + + 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/CampaignLoyaltyVoucher.php b/src/Model/CampaignLoyaltyVoucher.php new file mode 100644 index 0000000..3eccca2 --- /dev/null +++ b/src/Model/CampaignLoyaltyVoucher.php @@ -0,0 +1,562 @@ + + */ +class CampaignLoyaltyVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignLoyaltyVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'loyaltyCard' => '\OpenAPI\Client\Model\CampaignLoyaltyCard', + 'redemption' => '\OpenAPI\Client\Model\CampaignLoyaltyVoucherRedemption', + 'codeConfig' => '\OpenAPI\Client\Model\CodeConfig' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'loyaltyCard' => null, + 'redemption' => null, + 'codeConfig' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'loyaltyCard' => false, + 'redemption' => true, + 'codeConfig' => 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 = [ + 'type' => 'type', + 'loyaltyCard' => 'loyalty_card', + 'redemption' => 'redemption', + 'codeConfig' => 'code_config' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'loyaltyCard' => 'setLoyaltyCard', + 'redemption' => 'setRedemption', + 'codeConfig' => 'setCodeConfig' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'loyaltyCard' => 'getLoyaltyCard', + 'redemption' => 'getRedemption', + 'codeConfig' => 'getCodeConfig' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * 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('type', $data ?? [], 'LOYALTY_CARD'); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('codeConfig', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['loyaltyCard'] === null) { + $invalidProperties[] = "'loyaltyCard' can't be null"; + } + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\CampaignLoyaltyCard + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\CampaignLoyaltyCard $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\CampaignLoyaltyVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\CampaignLoyaltyVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets codeConfig + * + * @return \OpenAPI\Client\Model\CodeConfig|null + */ + public function getCodeConfig() + { + return $this->container['codeConfig']; + } + + /** + * Sets codeConfig + * + * @param \OpenAPI\Client\Model\CodeConfig|null $codeConfig codeConfig + * + * @return self + */ + public function setCodeConfig($codeConfig) + { + if (is_null($codeConfig)) { + throw new \InvalidArgumentException('non-nullable codeConfig cannot be null'); + } + $this->container['codeConfig'] = $codeConfig; + + 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/CampaignLoyaltyVoucherRedemption.php b/src/Model/CampaignLoyaltyVoucherRedemption.php new file mode 100644 index 0000000..f33c110 --- /dev/null +++ b/src/Model/CampaignLoyaltyVoucherRedemption.php @@ -0,0 +1,418 @@ + + */ +class CampaignLoyaltyVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignLoyaltyVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/CampaignVoucher.php b/src/Model/CampaignVoucher.php new file mode 100644 index 0000000..5deb372 --- /dev/null +++ b/src/Model/CampaignVoucher.php @@ -0,0 +1,864 @@ + + */ +class CampaignVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'loyaltyCard' => '\OpenAPI\Client\Model\CampaignLoyaltyCard', + 'redemption' => '\OpenAPI\Client\Model\CampaignVoucherRedemption', + 'codeConfig' => '\OpenAPI\Client\Model\CodeConfig', + 'isReferralCode' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'redemption' => null, + 'codeConfig' => null, + 'isReferralCode' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'discount' => false, + 'gift' => false, + 'loyaltyCard' => false, + 'redemption' => true, + 'codeConfig' => false, + 'isReferralCode' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => 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 = [ + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'redemption' => 'redemption', + 'codeConfig' => 'code_config', + 'isReferralCode' => 'is_referral_code', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'redemption' => 'setRedemption', + 'codeConfig' => 'setCodeConfig', + 'isReferralCode' => 'setIsReferralCode', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'redemption' => 'getRedemption', + 'codeConfig' => 'getCodeConfig', + 'isReferralCode' => 'getIsReferralCode', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('codeConfig', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $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 = []; + + if ($this->container['codeConfig'] === null) { + $invalidProperties[] = "'codeConfig' can't be null"; + } + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\CampaignLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\CampaignLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\CampaignVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\CampaignVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets codeConfig + * + * @return \OpenAPI\Client\Model\CodeConfig + */ + public function getCodeConfig() + { + return $this->container['codeConfig']; + } + + /** + * Sets codeConfig + * + * @param \OpenAPI\Client\Model\CodeConfig $codeConfig codeConfig + * + * @return self + */ + public function setCodeConfig($codeConfig) + { + if (is_null($codeConfig)) { + throw new \InvalidArgumentException('non-nullable codeConfig cannot be null'); + } + $this->container['codeConfig'] = $codeConfig; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + 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/CampaignVoucherRedemption.php b/src/Model/CampaignVoucherRedemption.php new file mode 100644 index 0000000..8393af8 --- /dev/null +++ b/src/Model/CampaignVoucherRedemption.php @@ -0,0 +1,418 @@ + + */ +class CampaignVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/CampaignsCreateRequestBody.php b/src/Model/CampaignsCreateRequestBody.php new file mode 100644 index 0000000..60dfcbd --- /dev/null +++ b/src/Model/CampaignsCreateRequestBody.php @@ -0,0 +1,1368 @@ + + */ +class CampaignsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'type' => 'string', + 'joinOnce' => 'bool', + 'autoJoin' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'validationRules' => 'string[]', + 'categoryId' => 'string', + 'category' => 'string', + 'metadata' => 'object', + 'campaignType' => 'string', + 'voucher' => '\OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucher', + 'referralProgram' => '\OpenAPI\Client\Model\ReferralProgram', + 'promotion' => '\OpenAPI\Client\Model\CampaignsCreateRequestBodyPromotion', + 'luckyDraw' => '\OpenAPI\Client\Model\LuckyDraw' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'type' => null, + 'joinOnce' => null, + 'autoJoin' => null, + 'useVoucherMetadataSchema' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'validationRules' => null, + 'categoryId' => null, + 'category' => null, + 'metadata' => null, + 'campaignType' => null, + 'voucher' => null, + 'referralProgram' => null, + 'promotion' => null, + 'luckyDraw' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'description' => true, + 'type' => true, + 'joinOnce' => true, + 'autoJoin' => true, + 'useVoucherMetadataSchema' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'validationRules' => true, + 'categoryId' => true, + 'category' => true, + 'metadata' => true, + 'campaignType' => true, + 'voucher' => true, + 'referralProgram' => false, + 'promotion' => true, + 'luckyDraw' => 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 = [ + 'name' => 'name', + 'description' => 'description', + 'type' => 'type', + 'joinOnce' => 'join_once', + 'autoJoin' => 'auto_join', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'validationRules' => 'validation_rules', + 'categoryId' => 'category_id', + 'category' => 'category', + 'metadata' => 'metadata', + 'campaignType' => 'campaign_type', + 'voucher' => 'voucher', + 'referralProgram' => 'referral_program', + 'promotion' => 'promotion', + 'luckyDraw' => 'lucky_draw' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'type' => 'setType', + 'joinOnce' => 'setJoinOnce', + 'autoJoin' => 'setAutoJoin', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'validationRules' => 'setValidationRules', + 'categoryId' => 'setCategoryId', + 'category' => 'setCategory', + 'metadata' => 'setMetadata', + 'campaignType' => 'setCampaignType', + 'voucher' => 'setVoucher', + 'referralProgram' => 'setReferralProgram', + 'promotion' => 'setPromotion', + 'luckyDraw' => 'setLuckyDraw' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'type' => 'getType', + 'joinOnce' => 'getJoinOnce', + 'autoJoin' => 'getAutoJoin', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'validationRules' => 'getValidationRules', + 'categoryId' => 'getCategoryId', + 'category' => 'getCategory', + 'metadata' => 'getMetadata', + 'campaignType' => 'getCampaignType', + 'voucher' => 'getVoucher', + 'referralProgram' => 'getReferralProgram', + 'promotion' => 'getPromotion', + 'luckyDraw' => 'getLuckyDraw' + ]; + + /** + * 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 TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + 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_PROGRAM = 'LOYALTY_PROGRAM'; + public const CAMPAIGN_TYPE_PROMOTION = 'PROMOTION'; + public const CAMPAIGN_TYPE_LUCKY_DRAW = 'LUCKY_DRAW'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_DISCOUNT_COUPONS, + self::CAMPAIGN_TYPE_REFERRAL_PROGRAM, + self::CAMPAIGN_TYPE_GIFT_VOUCHERS, + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + self::CAMPAIGN_TYPE_PROMOTION, + self::CAMPAIGN_TYPE_LUCKY_DRAW, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('validationRules', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('referralProgram', $data ?? [], null); + $this->setIfExists('promotion', $data ?? [], null); + $this->setIfExists('luckyDraw', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['validationRules']) && (count($this->container['validationRules']) > 1)) { + $invalidProperties[] = "invalid value for 'validationRules', number of items must be less than or equal to 1."; + } + + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign (size of campaign). + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets validationRules + * + * @return string[]|null + */ + public function getValidationRules() + { + return $this->container['validationRules']; + } + + /** + * Sets validationRules + * + * @param string[]|null $validationRules Array containing the ID of the validation rule associated with the promotion tier. + * + * @return self + */ + public function setValidationRules($validationRules) + { + if (is_null($validationRules)) { + array_push($this->openAPINullablesSetToNull, 'validationRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($validationRules) && (count($validationRules) > 1)) { + throw new \InvalidArgumentException('invalid value for $validationRules when calling CampaignsCreateRequestBody., number of items must be less than or equal to 1.'); + } + $this->container['validationRules'] = $validationRules; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The category assigned to the campaign. Either pass this parameter OR the `category_id`. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType campaignType + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + array_push($this->openAPINullablesSetToNull, 'voucher'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucher', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets referralProgram + * + * @return \OpenAPI\Client\Model\ReferralProgram|null + */ + public function getReferralProgram() + { + return $this->container['referralProgram']; + } + + /** + * Sets referralProgram + * + * @param \OpenAPI\Client\Model\ReferralProgram|null $referralProgram referralProgram + * + * @return self + */ + public function setReferralProgram($referralProgram) + { + if (is_null($referralProgram)) { + throw new \InvalidArgumentException('non-nullable referralProgram cannot be null'); + } + $this->container['referralProgram'] = $referralProgram; + + return $this; + } + + /** + * Gets promotion + * + * @return \OpenAPI\Client\Model\CampaignsCreateRequestBodyPromotion|null + */ + public function getPromotion() + { + return $this->container['promotion']; + } + + /** + * Sets promotion + * + * @param \OpenAPI\Client\Model\CampaignsCreateRequestBodyPromotion|null $promotion promotion + * + * @return self + */ + public function setPromotion($promotion) + { + if (is_null($promotion)) { + array_push($this->openAPINullablesSetToNull, 'promotion'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotion', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotion'] = $promotion; + + return $this; + } + + /** + * Gets luckyDraw + * + * @return \OpenAPI\Client\Model\LuckyDraw|null + */ + public function getLuckyDraw() + { + return $this->container['luckyDraw']; + } + + /** + * Sets luckyDraw + * + * @param \OpenAPI\Client\Model\LuckyDraw|null $luckyDraw luckyDraw + * + * @return self + */ + public function setLuckyDraw($luckyDraw) + { + if (is_null($luckyDraw)) { + throw new \InvalidArgumentException('non-nullable luckyDraw cannot be null'); + } + $this->container['luckyDraw'] = $luckyDraw; + + 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/CampaignsCreateRequestBodyPromotion.php b/src/Model/CampaignsCreateRequestBodyPromotion.php new file mode 100644 index 0000000..ac19cc5 --- /dev/null +++ b/src/Model/CampaignsCreateRequestBodyPromotion.php @@ -0,0 +1,417 @@ + + */ +class CampaignsCreateRequestBodyPromotion implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsCreateRequestBodyPromotion'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'tiers' => '\OpenAPI\Client\Model\PromotionTierCreateParams[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'tiers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'tiers' => true + ]; + + /** + * 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 = [ + 'tiers' => 'tiers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'tiers' => 'setTiers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'tiers' => 'getTiers' + ]; + + /** + * 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('tiers', $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 tiers + * + * @return \OpenAPI\Client\Model\PromotionTierCreateParams[]|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionTierCreateParams[]|null $tiers tiers + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + 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/CampaignsCreateRequestBodyVoucher.php b/src/Model/CampaignsCreateRequestBodyVoucher.php new file mode 100644 index 0000000..9b8ed55 --- /dev/null +++ b/src/Model/CampaignsCreateRequestBodyVoucher.php @@ -0,0 +1,671 @@ + + */ +class CampaignsCreateRequestBodyVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsCreateRequestBodyVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'codeConfig' => '\OpenAPI\Client\Model\CodeConfig', + 'redemption' => '\OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucherRedemption', + 'isReferralCode' => 'bool', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'loyaltyCard' => '\OpenAPI\Client\Model\CampaignLoyaltyCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'discount' => null, + 'codeConfig' => null, + 'redemption' => null, + 'isReferralCode' => null, + 'gift' => null, + 'loyaltyCard' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'discount' => false, + 'codeConfig' => false, + 'redemption' => true, + 'isReferralCode' => true, + 'gift' => false, + 'loyaltyCard' => 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 = [ + 'type' => 'type', + 'discount' => 'discount', + 'codeConfig' => 'code_config', + 'redemption' => 'redemption', + 'isReferralCode' => 'is_referral_code', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'discount' => 'setDiscount', + 'codeConfig' => 'setCodeConfig', + 'redemption' => 'setRedemption', + 'isReferralCode' => 'setIsReferralCode', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'discount' => 'getDiscount', + 'codeConfig' => 'getCodeConfig', + 'redemption' => 'getRedemption', + 'isReferralCode' => 'getIsReferralCode', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard' + ]; + + /** + * 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 TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_GIFT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('codeConfig', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets codeConfig + * + * @return \OpenAPI\Client\Model\CodeConfig|null + */ + public function getCodeConfig() + { + return $this->container['codeConfig']; + } + + /** + * Sets codeConfig + * + * @param \OpenAPI\Client\Model\CodeConfig|null $codeConfig codeConfig + * + * @return self + */ + public function setCodeConfig($codeConfig) + { + if (is_null($codeConfig)) { + throw new \InvalidArgumentException('non-nullable codeConfig cannot be null'); + } + $this->container['codeConfig'] = $codeConfig; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\CampaignsCreateRequestBodyVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\CampaignLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\CampaignLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + 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/CampaignsCreateRequestBodyVoucherRedemption.php b/src/Model/CampaignsCreateRequestBodyVoucherRedemption.php new file mode 100644 index 0000000..e3eaef1 --- /dev/null +++ b/src/Model/CampaignsCreateRequestBodyVoucherRedemption.php @@ -0,0 +1,417 @@ + + */ +class CampaignsCreateRequestBodyVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsCreateRequestBodyVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/CampaignsCreateResponseBody.php b/src/Model/CampaignsCreateResponseBody.php new file mode 100644 index 0000000..e2d0d60 --- /dev/null +++ b/src/Model/CampaignsCreateResponseBody.php @@ -0,0 +1,1823 @@ + + */ +class CampaignsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'campaignType' => 'string', + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\CampaignVoucher', + 'autoJoin' => 'bool', + 'joinOnce' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'active' => 'bool', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'category' => 'string', + 'creationStatus' => 'string', + 'vouchersGenerationStatus' => 'string', + 'protected' => 'bool', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'object' => 'string', + 'referralProgram' => '\OpenAPI\Client\Model\ReferralProgram', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'promotion' => '\OpenAPI\Client\Model\PromotionTiersList', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'accessSettingsAssignments' => '\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'description' => null, + 'campaignType' => null, + 'type' => null, + 'voucher' => null, + 'autoJoin' => null, + 'joinOnce' => null, + 'useVoucherMetadataSchema' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'active' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'category' => null, + 'creationStatus' => null, + 'vouchersGenerationStatus' => null, + 'protected' => null, + 'categoryId' => null, + 'categories' => null, + 'object' => null, + 'referralProgram' => null, + 'loyaltyTiersExpiration' => null, + 'promotion' => null, + 'validationRulesAssignments' => null, + 'accessSettingsAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'description' => true, + 'campaignType' => true, + 'type' => true, + 'voucher' => false, + 'autoJoin' => true, + 'joinOnce' => true, + 'useVoucherMetadataSchema' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'active' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'category' => true, + 'creationStatus' => true, + 'vouchersGenerationStatus' => true, + 'protected' => true, + 'categoryId' => true, + 'categories' => true, + 'object' => true, + 'referralProgram' => false, + 'loyaltyTiersExpiration' => false, + 'promotion' => false, + 'validationRulesAssignments' => false, + 'accessSettingsAssignments' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'campaignType' => 'campaign_type', + 'type' => 'type', + 'voucher' => 'voucher', + 'autoJoin' => 'auto_join', + 'joinOnce' => 'join_once', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'active' => 'active', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'category' => 'category', + 'creationStatus' => 'creation_status', + 'vouchersGenerationStatus' => 'vouchers_generation_status', + 'protected' => 'protected', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'object' => 'object', + 'referralProgram' => 'referral_program', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'promotion' => 'promotion', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'accessSettingsAssignments' => 'access_settings_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'campaignType' => 'setCampaignType', + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'autoJoin' => 'setAutoJoin', + 'joinOnce' => 'setJoinOnce', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'category' => 'setCategory', + 'creationStatus' => 'setCreationStatus', + 'vouchersGenerationStatus' => 'setVouchersGenerationStatus', + 'protected' => 'setProtected', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'object' => 'setObject', + 'referralProgram' => 'setReferralProgram', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'promotion' => 'setPromotion', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'accessSettingsAssignments' => 'setAccessSettingsAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'campaignType' => 'getCampaignType', + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'autoJoin' => 'getAutoJoin', + 'joinOnce' => 'getJoinOnce', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'category' => 'getCategory', + 'creationStatus' => 'getCreationStatus', + 'vouchersGenerationStatus' => 'getVouchersGenerationStatus', + 'protected' => 'getProtected', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'object' => 'getObject', + 'referralProgram' => 'getReferralProgram', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'promotion' => 'getPromotion', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'accessSettingsAssignments' => 'getAccessSettingsAssignments' + ]; + + /** + * 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 CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const CAMPAIGN_TYPE_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const CAMPAIGN_TYPE_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const CAMPAIGN_TYPE_PROMOTION = 'PROMOTION'; + public const CAMPAIGN_TYPE_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const CAMPAIGN_TYPE_LUCKY_DRAW = 'LUCKY_DRAW'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CREATION_STATUS_DONE = 'DONE'; + public const CREATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const CREATION_STATUS_FAILED = 'FAILED'; + public const CREATION_STATUS_DRAFT = 'DRAFT'; + public const CREATION_STATUS_MODIFYING = 'MODIFYING'; + public const VOUCHERS_GENERATION_STATUS_DONE = 'DONE'; + public const VOUCHERS_GENERATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const VOUCHERS_GENERATION_STATUS_FAILED = 'FAILED'; + public const VOUCHERS_GENERATION_STATUS_DRAFT = 'DRAFT'; + public const VOUCHERS_GENERATION_STATUS_MODIFYING = 'MODIFYING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + self::CAMPAIGN_TYPE_GIFT_VOUCHERS, + self::CAMPAIGN_TYPE_DISCOUNT_COUPONS, + self::CAMPAIGN_TYPE_PROMOTION, + self::CAMPAIGN_TYPE_REFERRAL_PROGRAM, + self::CAMPAIGN_TYPE_LUCKY_DRAW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCreationStatusAllowableValues() + { + return [ + self::CREATION_STATUS_DONE, + self::CREATION_STATUS_IN_PROGRESS, + self::CREATION_STATUS_FAILED, + self::CREATION_STATUS_DRAFT, + self::CREATION_STATUS_MODIFYING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVouchersGenerationStatusAllowableValues() + { + return [ + self::VOUCHERS_GENERATION_STATUS_DONE, + self::VOUCHERS_GENERATION_STATUS_IN_PROGRESS, + self::VOUCHERS_GENERATION_STATUS_FAILED, + self::VOUCHERS_GENERATION_STATUS_DRAFT, + self::VOUCHERS_GENERATION_STATUS_MODIFYING, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('creationStatus', $data ?? [], null); + $this->setIfExists('vouchersGenerationStatus', $data ?? [], null); + $this->setIfExists('protected', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + $this->setIfExists('referralProgram', $data ?? [], null); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('promotion', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('accessSettingsAssignments', $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->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($this->container['creationStatus']) && !in_array($this->container['creationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'creationStatus', must be one of '%s'", + $this->container['creationStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($this->container['vouchersGenerationStatus']) && !in_array($this->container['vouchersGenerationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $this->container['vouchersGenerationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\CampaignVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\CampaignVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign. + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Unique category name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets creationStatus + * + * @return string|null + */ + public function getCreationStatus() + { + return $this->container['creationStatus']; + } + + /** + * Sets creationStatus + * + * @param string|null $creationStatus Indicates the status of the campaign creation. + * + * @return self + */ + public function setCreationStatus($creationStatus) + { + if (is_null($creationStatus)) { + array_push($this->openAPINullablesSetToNull, 'creationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($creationStatus) && !in_array($creationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'creationStatus', must be one of '%s'", + $creationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['creationStatus'] = $creationStatus; + + return $this; + } + + /** + * Gets vouchersGenerationStatus + * + * @return string|null + */ + public function getVouchersGenerationStatus() + { + return $this->container['vouchersGenerationStatus']; + } + + /** + * Sets vouchersGenerationStatus + * + * @param string|null $vouchersGenerationStatus Indicates the status of the campaign's voucher generation. + * + * @return self + */ + public function setVouchersGenerationStatus($vouchersGenerationStatus) + { + if (is_null($vouchersGenerationStatus)) { + array_push($this->openAPINullablesSetToNull, 'vouchersGenerationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersGenerationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($vouchersGenerationStatus) && !in_array($vouchersGenerationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $vouchersGenerationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['vouchersGenerationStatus'] = $vouchersGenerationStatus; + + return $this; + } + + /** + * Gets protected + * + * @return bool|null + */ + public function getProtected() + { + return $this->container['protected']; + } + + /** + * Sets protected + * + * @param bool|null $protected Indicates whether the resource can be deleted. + * + * @return self + */ + public function setProtected($protected) + { + if (is_null($protected)) { + array_push($this->openAPINullablesSetToNull, 'protected'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('protected', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['protected'] = $protected; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets referralProgram + * + * @return \OpenAPI\Client\Model\ReferralProgram|null + */ + public function getReferralProgram() + { + return $this->container['referralProgram']; + } + + /** + * Sets referralProgram + * + * @param \OpenAPI\Client\Model\ReferralProgram|null $referralProgram referralProgram + * + * @return self + */ + public function setReferralProgram($referralProgram) + { + if (is_null($referralProgram)) { + throw new \InvalidArgumentException('non-nullable referralProgram cannot be null'); + } + $this->container['referralProgram'] = $referralProgram; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets promotion + * + * @return \OpenAPI\Client\Model\PromotionTiersList|null + */ + public function getPromotion() + { + return $this->container['promotion']; + } + + /** + * Sets promotion + * + * @param \OpenAPI\Client\Model\PromotionTiersList|null $promotion promotion + * + * @return self + */ + public function setPromotion($promotion) + { + if (is_null($promotion)) { + throw new \InvalidArgumentException('non-nullable promotion cannot be null'); + } + $this->container['promotion'] = $promotion; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets accessSettingsAssignments + * + * @return \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null + */ + public function getAccessSettingsAssignments() + { + return $this->container['accessSettingsAssignments']; + } + + /** + * Sets accessSettingsAssignments + * + * @param \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null $accessSettingsAssignments accessSettingsAssignments + * + * @return self + */ + public function setAccessSettingsAssignments($accessSettingsAssignments) + { + if (is_null($accessSettingsAssignments)) { + throw new \InvalidArgumentException('non-nullable accessSettingsAssignments cannot be null'); + } + $this->container['accessSettingsAssignments'] = $accessSettingsAssignments; + + 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/CampaignsDeleteResponseBody.php b/src/Model/CampaignsDeleteResponseBody.php new file mode 100644 index 0000000..9e35f82 --- /dev/null +++ b/src/Model/CampaignsDeleteResponseBody.php @@ -0,0 +1,418 @@ + + */ +class CampaignsDeleteResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsDeleteResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/CampaignsGetResponseBody.php b/src/Model/CampaignsGetResponseBody.php new file mode 100644 index 0000000..cdfcbd6 --- /dev/null +++ b/src/Model/CampaignsGetResponseBody.php @@ -0,0 +1,1823 @@ + + */ +class CampaignsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'campaignType' => 'string', + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\CampaignVoucher', + 'autoJoin' => 'bool', + 'joinOnce' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'active' => 'bool', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'category' => 'string', + 'creationStatus' => 'string', + 'vouchersGenerationStatus' => 'string', + 'protected' => 'bool', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'object' => 'string', + 'referralProgram' => '\OpenAPI\Client\Model\ReferralProgram', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'promotion' => '\OpenAPI\Client\Model\PromotionTiersList', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'accessSettingsAssignments' => '\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'description' => null, + 'campaignType' => null, + 'type' => null, + 'voucher' => null, + 'autoJoin' => null, + 'joinOnce' => null, + 'useVoucherMetadataSchema' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'active' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'category' => null, + 'creationStatus' => null, + 'vouchersGenerationStatus' => null, + 'protected' => null, + 'categoryId' => null, + 'categories' => null, + 'object' => null, + 'referralProgram' => null, + 'loyaltyTiersExpiration' => null, + 'promotion' => null, + 'validationRulesAssignments' => null, + 'accessSettingsAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'description' => true, + 'campaignType' => true, + 'type' => true, + 'voucher' => false, + 'autoJoin' => true, + 'joinOnce' => true, + 'useVoucherMetadataSchema' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'active' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'category' => true, + 'creationStatus' => true, + 'vouchersGenerationStatus' => true, + 'protected' => true, + 'categoryId' => true, + 'categories' => true, + 'object' => true, + 'referralProgram' => false, + 'loyaltyTiersExpiration' => false, + 'promotion' => false, + 'validationRulesAssignments' => false, + 'accessSettingsAssignments' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'campaignType' => 'campaign_type', + 'type' => 'type', + 'voucher' => 'voucher', + 'autoJoin' => 'auto_join', + 'joinOnce' => 'join_once', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'active' => 'active', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'category' => 'category', + 'creationStatus' => 'creation_status', + 'vouchersGenerationStatus' => 'vouchers_generation_status', + 'protected' => 'protected', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'object' => 'object', + 'referralProgram' => 'referral_program', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'promotion' => 'promotion', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'accessSettingsAssignments' => 'access_settings_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'campaignType' => 'setCampaignType', + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'autoJoin' => 'setAutoJoin', + 'joinOnce' => 'setJoinOnce', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'category' => 'setCategory', + 'creationStatus' => 'setCreationStatus', + 'vouchersGenerationStatus' => 'setVouchersGenerationStatus', + 'protected' => 'setProtected', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'object' => 'setObject', + 'referralProgram' => 'setReferralProgram', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'promotion' => 'setPromotion', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'accessSettingsAssignments' => 'setAccessSettingsAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'campaignType' => 'getCampaignType', + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'autoJoin' => 'getAutoJoin', + 'joinOnce' => 'getJoinOnce', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'category' => 'getCategory', + 'creationStatus' => 'getCreationStatus', + 'vouchersGenerationStatus' => 'getVouchersGenerationStatus', + 'protected' => 'getProtected', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'object' => 'getObject', + 'referralProgram' => 'getReferralProgram', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'promotion' => 'getPromotion', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'accessSettingsAssignments' => 'getAccessSettingsAssignments' + ]; + + /** + * 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 CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const CAMPAIGN_TYPE_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const CAMPAIGN_TYPE_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const CAMPAIGN_TYPE_PROMOTION = 'PROMOTION'; + public const CAMPAIGN_TYPE_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const CAMPAIGN_TYPE_LUCKY_DRAW = 'LUCKY_DRAW'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CREATION_STATUS_DONE = 'DONE'; + public const CREATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const CREATION_STATUS_FAILED = 'FAILED'; + public const CREATION_STATUS_DRAFT = 'DRAFT'; + public const CREATION_STATUS_MODIFYING = 'MODIFYING'; + public const VOUCHERS_GENERATION_STATUS_DONE = 'DONE'; + public const VOUCHERS_GENERATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const VOUCHERS_GENERATION_STATUS_FAILED = 'FAILED'; + public const VOUCHERS_GENERATION_STATUS_DRAFT = 'DRAFT'; + public const VOUCHERS_GENERATION_STATUS_MODIFYING = 'MODIFYING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + self::CAMPAIGN_TYPE_GIFT_VOUCHERS, + self::CAMPAIGN_TYPE_DISCOUNT_COUPONS, + self::CAMPAIGN_TYPE_PROMOTION, + self::CAMPAIGN_TYPE_REFERRAL_PROGRAM, + self::CAMPAIGN_TYPE_LUCKY_DRAW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCreationStatusAllowableValues() + { + return [ + self::CREATION_STATUS_DONE, + self::CREATION_STATUS_IN_PROGRESS, + self::CREATION_STATUS_FAILED, + self::CREATION_STATUS_DRAFT, + self::CREATION_STATUS_MODIFYING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVouchersGenerationStatusAllowableValues() + { + return [ + self::VOUCHERS_GENERATION_STATUS_DONE, + self::VOUCHERS_GENERATION_STATUS_IN_PROGRESS, + self::VOUCHERS_GENERATION_STATUS_FAILED, + self::VOUCHERS_GENERATION_STATUS_DRAFT, + self::VOUCHERS_GENERATION_STATUS_MODIFYING, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('creationStatus', $data ?? [], null); + $this->setIfExists('vouchersGenerationStatus', $data ?? [], null); + $this->setIfExists('protected', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + $this->setIfExists('referralProgram', $data ?? [], null); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('promotion', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('accessSettingsAssignments', $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->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($this->container['creationStatus']) && !in_array($this->container['creationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'creationStatus', must be one of '%s'", + $this->container['creationStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($this->container['vouchersGenerationStatus']) && !in_array($this->container['vouchersGenerationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $this->container['vouchersGenerationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\CampaignVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\CampaignVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign. + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Unique category name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets creationStatus + * + * @return string|null + */ + public function getCreationStatus() + { + return $this->container['creationStatus']; + } + + /** + * Sets creationStatus + * + * @param string|null $creationStatus Indicates the status of the campaign creation. + * + * @return self + */ + public function setCreationStatus($creationStatus) + { + if (is_null($creationStatus)) { + array_push($this->openAPINullablesSetToNull, 'creationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($creationStatus) && !in_array($creationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'creationStatus', must be one of '%s'", + $creationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['creationStatus'] = $creationStatus; + + return $this; + } + + /** + * Gets vouchersGenerationStatus + * + * @return string|null + */ + public function getVouchersGenerationStatus() + { + return $this->container['vouchersGenerationStatus']; + } + + /** + * Sets vouchersGenerationStatus + * + * @param string|null $vouchersGenerationStatus Indicates the status of the campaign's voucher generation. + * + * @return self + */ + public function setVouchersGenerationStatus($vouchersGenerationStatus) + { + if (is_null($vouchersGenerationStatus)) { + array_push($this->openAPINullablesSetToNull, 'vouchersGenerationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersGenerationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($vouchersGenerationStatus) && !in_array($vouchersGenerationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $vouchersGenerationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['vouchersGenerationStatus'] = $vouchersGenerationStatus; + + return $this; + } + + /** + * Gets protected + * + * @return bool|null + */ + public function getProtected() + { + return $this->container['protected']; + } + + /** + * Sets protected + * + * @param bool|null $protected Indicates whether the resource can be deleted. + * + * @return self + */ + public function setProtected($protected) + { + if (is_null($protected)) { + array_push($this->openAPINullablesSetToNull, 'protected'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('protected', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['protected'] = $protected; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets referralProgram + * + * @return \OpenAPI\Client\Model\ReferralProgram|null + */ + public function getReferralProgram() + { + return $this->container['referralProgram']; + } + + /** + * Sets referralProgram + * + * @param \OpenAPI\Client\Model\ReferralProgram|null $referralProgram referralProgram + * + * @return self + */ + public function setReferralProgram($referralProgram) + { + if (is_null($referralProgram)) { + throw new \InvalidArgumentException('non-nullable referralProgram cannot be null'); + } + $this->container['referralProgram'] = $referralProgram; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets promotion + * + * @return \OpenAPI\Client\Model\PromotionTiersList|null + */ + public function getPromotion() + { + return $this->container['promotion']; + } + + /** + * Sets promotion + * + * @param \OpenAPI\Client\Model\PromotionTiersList|null $promotion promotion + * + * @return self + */ + public function setPromotion($promotion) + { + if (is_null($promotion)) { + throw new \InvalidArgumentException('non-nullable promotion cannot be null'); + } + $this->container['promotion'] = $promotion; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets accessSettingsAssignments + * + * @return \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null + */ + public function getAccessSettingsAssignments() + { + return $this->container['accessSettingsAssignments']; + } + + /** + * Sets accessSettingsAssignments + * + * @param \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null $accessSettingsAssignments accessSettingsAssignments + * + * @return self + */ + public function setAccessSettingsAssignments($accessSettingsAssignments) + { + if (is_null($accessSettingsAssignments)) { + throw new \InvalidArgumentException('non-nullable accessSettingsAssignments cannot be null'); + } + $this->container['accessSettingsAssignments'] = $accessSettingsAssignments; + + 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/CampaignsImportCreateResponseBody.php b/src/Model/CampaignsImportCreateResponseBody.php new file mode 100644 index 0000000..86c7e07 --- /dev/null +++ b/src/Model/CampaignsImportCreateResponseBody.php @@ -0,0 +1,418 @@ + + */ +class CampaignsImportCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsImportCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/CampaignsImportCsvCreateResponseBody.php b/src/Model/CampaignsImportCsvCreateResponseBody.php new file mode 100644 index 0000000..48d0689 --- /dev/null +++ b/src/Model/CampaignsImportCsvCreateResponseBody.php @@ -0,0 +1,418 @@ + + */ +class CampaignsImportCsvCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsImportCsvCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/CampaignsImportVoucherItem.php b/src/Model/CampaignsImportVoucherItem.php new file mode 100644 index 0000000..5bd3baf --- /dev/null +++ b/src/Model/CampaignsImportVoucherItem.php @@ -0,0 +1,992 @@ + + */ +class CampaignsImportVoucherItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsImportVoucherItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'redemption' => '\OpenAPI\Client\Model\CampaignsImportVoucherItemRedemption', + 'active' => 'bool', + 'metadata' => 'object', + 'category' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'additionalInfo' => 'string', + 'type' => 'string', + 'loyaltyCard' => '\OpenAPI\Client\Model\SimpleLoyaltyCard', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'redemption' => null, + 'active' => null, + 'metadata' => null, + 'category' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'additionalInfo' => null, + 'type' => null, + 'loyaltyCard' => null, + 'gift' => null, + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'redemption' => true, + 'active' => true, + 'metadata' => true, + 'category' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'additionalInfo' => true, + 'type' => true, + 'loyaltyCard' => false, + 'gift' => false, + 'discount' => 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 = [ + 'code' => 'code', + 'redemption' => 'redemption', + 'active' => 'active', + 'metadata' => 'metadata', + 'category' => 'category', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'additionalInfo' => 'additional_info', + 'type' => 'type', + 'loyaltyCard' => 'loyalty_card', + 'gift' => 'gift', + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'redemption' => 'setRedemption', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'category' => 'setCategory', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'additionalInfo' => 'setAdditionalInfo', + 'type' => 'setType', + 'loyaltyCard' => 'setLoyaltyCard', + 'gift' => 'setGift', + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'redemption' => 'getRedemption', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'category' => 'getCategory', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'additionalInfo' => 'getAdditionalInfo', + 'type' => 'getType', + 'loyaltyCard' => 'getLoyaltyCard', + 'gift' => 'getGift', + 'discount' => 'getDiscount' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + ]; + } + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('discount', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Value representing the imported code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\CampaignsImportVoucherItemRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\CampaignsImportVoucherItemRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\SimpleLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\SimpleLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/CampaignsImportVoucherItemRedemption.php b/src/Model/CampaignsImportVoucherItemRedemption.php new file mode 100644 index 0000000..aeb419d --- /dev/null +++ b/src/Model/CampaignsImportVoucherItemRedemption.php @@ -0,0 +1,417 @@ + + */ +class CampaignsImportVoucherItemRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsImportVoucherItemRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/CampaignsListResponseBody.php b/src/Model/CampaignsListResponseBody.php new file mode 100644 index 0000000..8f4579f --- /dev/null +++ b/src/Model/CampaignsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class CampaignsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'campaigns' => '\OpenAPI\Client\Model\CampaignBase[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'campaigns' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'campaigns' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'campaigns' => 'campaigns', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'campaigns' => 'setCampaigns', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'campaigns' => 'getCampaigns', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'campaigns'); + $this->setIfExists('campaigns', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about campaigns in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of campaign objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets campaigns + * + * @return \OpenAPI\Client\Model\CampaignBase[]|null + */ + public function getCampaigns() + { + return $this->container['campaigns']; + } + + /** + * Sets campaigns + * + * @param \OpenAPI\Client\Model\CampaignBase[]|null $campaigns Contains array of campaign objects. + * + * @return self + */ + public function setCampaigns($campaigns) + { + if (is_null($campaigns)) { + array_push($this->openAPINullablesSetToNull, 'campaigns'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaigns', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaigns'] = $campaigns; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of campaigns. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/CampaignsUpdateRequestBody.php b/src/Model/CampaignsUpdateRequestBody.php new file mode 100644 index 0000000..8fe8d13 --- /dev/null +++ b/src/Model/CampaignsUpdateRequestBody.php @@ -0,0 +1,1313 @@ + + */ +class CampaignsUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'description' => 'string', + 'category' => 'string', + 'metadata' => 'object', + 'unsetMetadataFields' => 'string[]', + 'categoryId' => 'string', + 'activityDurationAfterPublishing' => 'string', + 'joinOnce' => 'bool', + 'autoJoin' => 'bool', + 'type' => 'string', + 'discount' => 'object', + 'referralProgram' => '\OpenAPI\Client\Model\ReferralProgram', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'options' => '\OpenAPI\Client\Model\CampaignsUpdateRequestBodyOptions', + 'winnersCount' => 'string', + 'uniqueWinnersPerDraw' => 'string', + 'uniqueWinners' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'description' => null, + 'category' => null, + 'metadata' => null, + 'unsetMetadataFields' => null, + 'categoryId' => null, + 'activityDurationAfterPublishing' => null, + 'joinOnce' => null, + 'autoJoin' => null, + 'type' => null, + 'discount' => null, + 'referralProgram' => null, + 'gift' => null, + 'loyaltyTiersExpiration' => null, + 'options' => null, + 'winnersCount' => null, + 'uniqueWinnersPerDraw' => null, + 'uniqueWinners' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'description' => true, + 'category' => true, + 'metadata' => true, + 'unsetMetadataFields' => true, + 'categoryId' => true, + 'activityDurationAfterPublishing' => true, + 'joinOnce' => true, + 'autoJoin' => true, + 'type' => true, + 'discount' => true, + 'referralProgram' => false, + 'gift' => false, + 'loyaltyTiersExpiration' => false, + 'options' => true, + 'winnersCount' => true, + 'uniqueWinnersPerDraw' => true, + 'uniqueWinners' => true + ]; + + /** + * 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 = [ + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'description' => 'description', + 'category' => 'category', + 'metadata' => 'metadata', + 'unsetMetadataFields' => 'unset_metadata_fields', + 'categoryId' => 'category_id', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'joinOnce' => 'join_once', + 'autoJoin' => 'auto_join', + 'type' => 'type', + 'discount' => 'discount', + 'referralProgram' => 'referral_program', + 'gift' => 'gift', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'options' => 'options', + 'winnersCount' => 'winners_count', + 'uniqueWinnersPerDraw' => 'unique_winners_per_draw', + 'uniqueWinners' => 'unique_winners' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'description' => 'setDescription', + 'category' => 'setCategory', + 'metadata' => 'setMetadata', + 'unsetMetadataFields' => 'setUnsetMetadataFields', + 'categoryId' => 'setCategoryId', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'joinOnce' => 'setJoinOnce', + 'autoJoin' => 'setAutoJoin', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'referralProgram' => 'setReferralProgram', + 'gift' => 'setGift', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'options' => 'setOptions', + 'winnersCount' => 'setWinnersCount', + 'uniqueWinnersPerDraw' => 'setUniqueWinnersPerDraw', + 'uniqueWinners' => 'setUniqueWinners' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'description' => 'getDescription', + 'category' => 'getCategory', + 'metadata' => 'getMetadata', + 'unsetMetadataFields' => 'getUnsetMetadataFields', + 'categoryId' => 'getCategoryId', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'joinOnce' => 'getJoinOnce', + 'autoJoin' => 'getAutoJoin', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'referralProgram' => 'getReferralProgram', + 'gift' => 'getGift', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'options' => 'getOptions', + 'winnersCount' => 'getWinnersCount', + 'uniqueWinnersPerDraw' => 'getUniqueWinnersPerDraw', + 'uniqueWinners' => 'getUniqueWinners' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * 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('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('unsetMetadataFields', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('referralProgram', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('winnersCount', $data ?? [], null); + $this->setIfExists('uniqueWinnersPerDraw', $data ?? [], null); + $this->setIfExists('uniqueWinners', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The category assigned to the campaign. Either pass this parameter OR the `category_id`. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets unsetMetadataFields + * + * @return string[]|null + */ + public function getUnsetMetadataFields() + { + return $this->container['unsetMetadataFields']; + } + + /** + * Sets unsetMetadataFields + * + * @param string[]|null $unsetMetadataFields Determine which metadata should be removed from campaign. + * + * @return self + */ + public function setUnsetMetadataFields($unsetMetadataFields) + { + if (is_null($unsetMetadataFields)) { + array_push($this->openAPINullablesSetToNull, 'unsetMetadataFields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unsetMetadataFields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unsetMetadataFields'] = $unsetMetadataFields; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return object|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param object|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + array_push($this->openAPINullablesSetToNull, 'discount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets referralProgram + * + * @return \OpenAPI\Client\Model\ReferralProgram|null + */ + public function getReferralProgram() + { + return $this->container['referralProgram']; + } + + /** + * Sets referralProgram + * + * @param \OpenAPI\Client\Model\ReferralProgram|null $referralProgram referralProgram + * + * @return self + */ + public function setReferralProgram($referralProgram) + { + if (is_null($referralProgram)) { + throw new \InvalidArgumentException('non-nullable referralProgram cannot be null'); + } + $this->container['referralProgram'] = $referralProgram; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets options + * + * @return \OpenAPI\Client\Model\CampaignsUpdateRequestBodyOptions|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \OpenAPI\Client\Model\CampaignsUpdateRequestBodyOptions|null $options options + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + array_push($this->openAPINullablesSetToNull, 'options'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('options', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets winnersCount + * + * @return string|null + */ + public function getWinnersCount() + { + return $this->container['winnersCount']; + } + + /** + * Sets winnersCount + * + * @param string|null $winnersCount It represents the total number of winners in a lucky draw. + * + * @return self + */ + public function setWinnersCount($winnersCount) + { + if (is_null($winnersCount)) { + array_push($this->openAPINullablesSetToNull, 'winnersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('winnersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + + $this->container['winnersCount'] = $winnersCount; + + return $this; + } + + /** + * Gets uniqueWinnersPerDraw + * + * @return string|null + */ + public function getUniqueWinnersPerDraw() + { + return $this->container['uniqueWinnersPerDraw']; + } + + /** + * Sets uniqueWinnersPerDraw + * + * @param string|null $uniqueWinnersPerDraw It indicates whether each winner in a draw is unique or not. + * + * @return self + */ + public function setUniqueWinnersPerDraw($uniqueWinnersPerDraw) + { + if (is_null($uniqueWinnersPerDraw)) { + array_push($this->openAPINullablesSetToNull, 'uniqueWinnersPerDraw'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('uniqueWinnersPerDraw', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['uniqueWinnersPerDraw'] = $uniqueWinnersPerDraw; + + return $this; + } + + /** + * Gets uniqueWinners + * + * @return string|null + */ + public function getUniqueWinners() + { + return $this->container['uniqueWinners']; + } + + /** + * Sets uniqueWinners + * + * @param string|null $uniqueWinners Specifies whether each participant can win only once across multiple draws. + * + * @return self + */ + public function setUniqueWinners($uniqueWinners) + { + if (is_null($uniqueWinners)) { + array_push($this->openAPINullablesSetToNull, 'uniqueWinners'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('uniqueWinners', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['uniqueWinners'] = $uniqueWinners; + + 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/CampaignsUpdateRequestBodyOptions.php b/src/Model/CampaignsUpdateRequestBodyOptions.php new file mode 100644 index 0000000..8957381 --- /dev/null +++ b/src/Model/CampaignsUpdateRequestBodyOptions.php @@ -0,0 +1,417 @@ + + */ +class CampaignsUpdateRequestBodyOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsUpdateRequestBodyOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'recalculateTiers' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'recalculateTiers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'recalculateTiers' => true + ]; + + /** + * 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 = [ + 'recalculateTiers' => 'recalculate_tiers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'recalculateTiers' => 'setRecalculateTiers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'recalculateTiers' => 'getRecalculateTiers' + ]; + + /** + * 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('recalculateTiers', $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 recalculateTiers + * + * @return bool|null + */ + public function getRecalculateTiers() + { + return $this->container['recalculateTiers']; + } + + /** + * Sets recalculateTiers + * + * @param bool|null $recalculateTiers Determine if tiers should be recalculated or no. + * + * @return self + */ + public function setRecalculateTiers($recalculateTiers) + { + if (is_null($recalculateTiers)) { + array_push($this->openAPINullablesSetToNull, 'recalculateTiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('recalculateTiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['recalculateTiers'] = $recalculateTiers; + + 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/CampaignsUpdateResponseBody.php b/src/Model/CampaignsUpdateResponseBody.php new file mode 100644 index 0000000..f2948e4 --- /dev/null +++ b/src/Model/CampaignsUpdateResponseBody.php @@ -0,0 +1,1823 @@ + + */ +class CampaignsUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'campaignType' => 'string', + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\CampaignVoucher', + 'autoJoin' => 'bool', + 'joinOnce' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'active' => 'bool', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'category' => 'string', + 'creationStatus' => 'string', + 'vouchersGenerationStatus' => 'string', + 'protected' => 'bool', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'object' => 'string', + 'referralProgram' => '\OpenAPI\Client\Model\ReferralProgram', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'promotion' => '\OpenAPI\Client\Model\PromotionTiersList', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'accessSettingsAssignments' => '\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'description' => null, + 'campaignType' => null, + 'type' => null, + 'voucher' => null, + 'autoJoin' => null, + 'joinOnce' => null, + 'useVoucherMetadataSchema' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'active' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'category' => null, + 'creationStatus' => null, + 'vouchersGenerationStatus' => null, + 'protected' => null, + 'categoryId' => null, + 'categories' => null, + 'object' => null, + 'referralProgram' => null, + 'loyaltyTiersExpiration' => null, + 'promotion' => null, + 'validationRulesAssignments' => null, + 'accessSettingsAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'description' => true, + 'campaignType' => true, + 'type' => true, + 'voucher' => false, + 'autoJoin' => true, + 'joinOnce' => true, + 'useVoucherMetadataSchema' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'active' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'category' => true, + 'creationStatus' => true, + 'vouchersGenerationStatus' => true, + 'protected' => true, + 'categoryId' => true, + 'categories' => true, + 'object' => true, + 'referralProgram' => false, + 'loyaltyTiersExpiration' => false, + 'promotion' => false, + 'validationRulesAssignments' => false, + 'accessSettingsAssignments' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'campaignType' => 'campaign_type', + 'type' => 'type', + 'voucher' => 'voucher', + 'autoJoin' => 'auto_join', + 'joinOnce' => 'join_once', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'active' => 'active', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'category' => 'category', + 'creationStatus' => 'creation_status', + 'vouchersGenerationStatus' => 'vouchers_generation_status', + 'protected' => 'protected', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'object' => 'object', + 'referralProgram' => 'referral_program', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'promotion' => 'promotion', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'accessSettingsAssignments' => 'access_settings_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'campaignType' => 'setCampaignType', + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'autoJoin' => 'setAutoJoin', + 'joinOnce' => 'setJoinOnce', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'category' => 'setCategory', + 'creationStatus' => 'setCreationStatus', + 'vouchersGenerationStatus' => 'setVouchersGenerationStatus', + 'protected' => 'setProtected', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'object' => 'setObject', + 'referralProgram' => 'setReferralProgram', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'promotion' => 'setPromotion', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'accessSettingsAssignments' => 'setAccessSettingsAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'campaignType' => 'getCampaignType', + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'autoJoin' => 'getAutoJoin', + 'joinOnce' => 'getJoinOnce', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'category' => 'getCategory', + 'creationStatus' => 'getCreationStatus', + 'vouchersGenerationStatus' => 'getVouchersGenerationStatus', + 'protected' => 'getProtected', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'object' => 'getObject', + 'referralProgram' => 'getReferralProgram', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'promotion' => 'getPromotion', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'accessSettingsAssignments' => 'getAccessSettingsAssignments' + ]; + + /** + * 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 CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const CAMPAIGN_TYPE_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const CAMPAIGN_TYPE_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const CAMPAIGN_TYPE_PROMOTION = 'PROMOTION'; + public const CAMPAIGN_TYPE_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const CAMPAIGN_TYPE_LUCKY_DRAW = 'LUCKY_DRAW'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CREATION_STATUS_DONE = 'DONE'; + public const CREATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const CREATION_STATUS_FAILED = 'FAILED'; + public const CREATION_STATUS_DRAFT = 'DRAFT'; + public const CREATION_STATUS_MODIFYING = 'MODIFYING'; + public const VOUCHERS_GENERATION_STATUS_DONE = 'DONE'; + public const VOUCHERS_GENERATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const VOUCHERS_GENERATION_STATUS_FAILED = 'FAILED'; + public const VOUCHERS_GENERATION_STATUS_DRAFT = 'DRAFT'; + public const VOUCHERS_GENERATION_STATUS_MODIFYING = 'MODIFYING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + self::CAMPAIGN_TYPE_GIFT_VOUCHERS, + self::CAMPAIGN_TYPE_DISCOUNT_COUPONS, + self::CAMPAIGN_TYPE_PROMOTION, + self::CAMPAIGN_TYPE_REFERRAL_PROGRAM, + self::CAMPAIGN_TYPE_LUCKY_DRAW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCreationStatusAllowableValues() + { + return [ + self::CREATION_STATUS_DONE, + self::CREATION_STATUS_IN_PROGRESS, + self::CREATION_STATUS_FAILED, + self::CREATION_STATUS_DRAFT, + self::CREATION_STATUS_MODIFYING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVouchersGenerationStatusAllowableValues() + { + return [ + self::VOUCHERS_GENERATION_STATUS_DONE, + self::VOUCHERS_GENERATION_STATUS_IN_PROGRESS, + self::VOUCHERS_GENERATION_STATUS_FAILED, + self::VOUCHERS_GENERATION_STATUS_DRAFT, + self::VOUCHERS_GENERATION_STATUS_MODIFYING, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('creationStatus', $data ?? [], null); + $this->setIfExists('vouchersGenerationStatus', $data ?? [], null); + $this->setIfExists('protected', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + $this->setIfExists('referralProgram', $data ?? [], null); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('promotion', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('accessSettingsAssignments', $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->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($this->container['creationStatus']) && !in_array($this->container['creationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'creationStatus', must be one of '%s'", + $this->container['creationStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($this->container['vouchersGenerationStatus']) && !in_array($this->container['vouchersGenerationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $this->container['vouchersGenerationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\CampaignVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\CampaignVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign. + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Unique category name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets creationStatus + * + * @return string|null + */ + public function getCreationStatus() + { + return $this->container['creationStatus']; + } + + /** + * Sets creationStatus + * + * @param string|null $creationStatus Indicates the status of the campaign creation. + * + * @return self + */ + public function setCreationStatus($creationStatus) + { + if (is_null($creationStatus)) { + array_push($this->openAPINullablesSetToNull, 'creationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($creationStatus) && !in_array($creationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'creationStatus', must be one of '%s'", + $creationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['creationStatus'] = $creationStatus; + + return $this; + } + + /** + * Gets vouchersGenerationStatus + * + * @return string|null + */ + public function getVouchersGenerationStatus() + { + return $this->container['vouchersGenerationStatus']; + } + + /** + * Sets vouchersGenerationStatus + * + * @param string|null $vouchersGenerationStatus Indicates the status of the campaign's voucher generation. + * + * @return self + */ + public function setVouchersGenerationStatus($vouchersGenerationStatus) + { + if (is_null($vouchersGenerationStatus)) { + array_push($this->openAPINullablesSetToNull, 'vouchersGenerationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersGenerationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($vouchersGenerationStatus) && !in_array($vouchersGenerationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $vouchersGenerationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['vouchersGenerationStatus'] = $vouchersGenerationStatus; + + return $this; + } + + /** + * Gets protected + * + * @return bool|null + */ + public function getProtected() + { + return $this->container['protected']; + } + + /** + * Sets protected + * + * @param bool|null $protected Indicates whether the resource can be deleted. + * + * @return self + */ + public function setProtected($protected) + { + if (is_null($protected)) { + array_push($this->openAPINullablesSetToNull, 'protected'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('protected', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['protected'] = $protected; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets referralProgram + * + * @return \OpenAPI\Client\Model\ReferralProgram|null + */ + public function getReferralProgram() + { + return $this->container['referralProgram']; + } + + /** + * Sets referralProgram + * + * @param \OpenAPI\Client\Model\ReferralProgram|null $referralProgram referralProgram + * + * @return self + */ + public function setReferralProgram($referralProgram) + { + if (is_null($referralProgram)) { + throw new \InvalidArgumentException('non-nullable referralProgram cannot be null'); + } + $this->container['referralProgram'] = $referralProgram; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets promotion + * + * @return \OpenAPI\Client\Model\PromotionTiersList|null + */ + public function getPromotion() + { + return $this->container['promotion']; + } + + /** + * Sets promotion + * + * @param \OpenAPI\Client\Model\PromotionTiersList|null $promotion promotion + * + * @return self + */ + public function setPromotion($promotion) + { + if (is_null($promotion)) { + throw new \InvalidArgumentException('non-nullable promotion cannot be null'); + } + $this->container['promotion'] = $promotion; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets accessSettingsAssignments + * + * @return \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null + */ + public function getAccessSettingsAssignments() + { + return $this->container['accessSettingsAssignments']; + } + + /** + * Sets accessSettingsAssignments + * + * @param \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null $accessSettingsAssignments accessSettingsAssignments + * + * @return self + */ + public function setAccessSettingsAssignments($accessSettingsAssignments) + { + if (is_null($accessSettingsAssignments)) { + throw new \InvalidArgumentException('non-nullable accessSettingsAssignments cannot be null'); + } + $this->container['accessSettingsAssignments'] = $accessSettingsAssignments; + + 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/CampaignsVouchersCreateCombinedResponseBody.php b/src/Model/CampaignsVouchersCreateCombinedResponseBody.php new file mode 100644 index 0000000..4a76aa1 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateCombinedResponseBody.php @@ -0,0 +1,1641 @@ + + */ +class CampaignsVouchersCreateCombinedResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateCombinedResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null, + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => false, + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('asyncActionId', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateCombinedResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/CampaignsVouchersCreateCombinedResponseBodyGift.php b/src/Model/CampaignsVouchersCreateCombinedResponseBodyGift.php new file mode 100644 index 0000000..4e1c0fc --- /dev/null +++ b/src/Model/CampaignsVouchersCreateCombinedResponseBodyGift.php @@ -0,0 +1,534 @@ + + */ +class CampaignsVouchersCreateCombinedResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateCombinedResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.php b/src/Model/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..3dde27a --- /dev/null +++ b/src/Model/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/CampaignsVouchersCreateCombinedResponseBodyPublish.php b/src/Model/CampaignsVouchersCreateCombinedResponseBodyPublish.php new file mode 100644 index 0000000..f671b51 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateCombinedResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class CampaignsVouchersCreateCombinedResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateCombinedResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/CampaignsVouchersCreateCombinedResponseBodyRedemption.php b/src/Model/CampaignsVouchersCreateCombinedResponseBodyRedemption.php new file mode 100644 index 0000000..7a3fc4b --- /dev/null +++ b/src/Model/CampaignsVouchersCreateCombinedResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class CampaignsVouchersCreateCombinedResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateCombinedResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/CampaignsVouchersCreateInBulkRequestBody.php b/src/Model/CampaignsVouchersCreateInBulkRequestBody.php new file mode 100644 index 0000000..d71b163 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateInBulkRequestBody.php @@ -0,0 +1,698 @@ + + */ +class CampaignsVouchersCreateInBulkRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateInBulkRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'codeConfig' => '\OpenAPI\Client\Model\CodeConfig', + 'category' => 'string', + 'metadata' => 'object', + 'redemption' => '\OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBodyRedemption', + 'additionalInfo' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'codeConfig' => null, + 'category' => null, + 'metadata' => null, + 'redemption' => null, + 'additionalInfo' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'codeConfig' => false, + 'category' => true, + 'metadata' => true, + 'redemption' => true, + 'additionalInfo' => true, + 'startDate' => true, + 'expirationDate' => true + ]; + + /** + * 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 = [ + 'code' => 'code', + 'codeConfig' => 'code_config', + 'category' => 'category', + 'metadata' => 'metadata', + 'redemption' => 'redemption', + 'additionalInfo' => 'additional_info', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'codeConfig' => 'setCodeConfig', + 'category' => 'setCategory', + 'metadata' => 'setMetadata', + 'redemption' => 'setRedemption', + 'additionalInfo' => 'setAdditionalInfo', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'codeConfig' => 'getCodeConfig', + 'category' => 'getCategory', + 'metadata' => 'getMetadata', + 'redemption' => 'getRedemption', + 'additionalInfo' => 'getAdditionalInfo', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate' + ]; + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('codeConfig', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Unique voucher code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets codeConfig + * + * @return \OpenAPI\Client\Model\CodeConfig|null + */ + public function getCodeConfig() + { + return $this->container['codeConfig']; + } + + /** + * Sets codeConfig + * + * @param \OpenAPI\Client\Model\CodeConfig|null $codeConfig codeConfig + * + * @return self + */ + public function setCodeConfig($codeConfig) + { + if (is_null($codeConfig)) { + throw new \InvalidArgumentException('non-nullable codeConfig cannot be null'); + } + $this->container['codeConfig'] = $codeConfig; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The category assigned to the campaign. Either pass this parameter OR the `category_id`. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateInBulkRequestBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + 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/CampaignsVouchersCreateInBulkRequestBodyRedemption.php b/src/Model/CampaignsVouchersCreateInBulkRequestBodyRedemption.php new file mode 100644 index 0000000..a0a2112 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateInBulkRequestBodyRedemption.php @@ -0,0 +1,418 @@ + + */ +class CampaignsVouchersCreateInBulkRequestBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateInBulkRequestBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/CampaignsVouchersCreateRequestBody.php b/src/Model/CampaignsVouchersCreateRequestBody.php new file mode 100644 index 0000000..a1066d2 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateRequestBody.php @@ -0,0 +1,623 @@ + + */ +class CampaignsVouchersCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'metadata' => 'object', + 'redemption' => '\OpenAPI\Client\Model\CampaignsVouchersCreateRequestBodyRedemption', + 'additionalInfo' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'metadata' => null, + 'redemption' => null, + 'additionalInfo' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'category' => true, + 'metadata' => true, + 'redemption' => true, + 'additionalInfo' => true, + 'startDate' => true, + 'expirationDate' => true + ]; + + /** + * 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 = [ + 'category' => 'category', + 'metadata' => 'metadata', + 'redemption' => 'redemption', + 'additionalInfo' => 'additional_info', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'metadata' => 'setMetadata', + 'redemption' => 'setRedemption', + 'additionalInfo' => 'setAdditionalInfo', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'metadata' => 'getMetadata', + 'redemption' => 'getRedemption', + 'additionalInfo' => 'getAdditionalInfo', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate' + ]; + + /** + * 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('category', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $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 category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The category assigned to the campaign. Either pass this parameter OR the `category_id`. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateRequestBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateRequestBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + 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/CampaignsVouchersCreateRequestBodyRedemption.php b/src/Model/CampaignsVouchersCreateRequestBodyRedemption.php new file mode 100644 index 0000000..2ff17e3 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateRequestBodyRedemption.php @@ -0,0 +1,418 @@ + + */ +class CampaignsVouchersCreateRequestBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateRequestBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/CampaignsVouchersCreateResponseBody.php b/src/Model/CampaignsVouchersCreateResponseBody.php new file mode 100644 index 0000000..e31fb33 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateResponseBody.php @@ -0,0 +1,1601 @@ + + */ +class CampaignsVouchersCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\CampaignsVouchersCreateResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + 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/CampaignsVouchersCreateResponseBodyGift.php b/src/Model/CampaignsVouchersCreateResponseBodyGift.php new file mode 100644 index 0000000..f7a4159 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateResponseBodyGift.php @@ -0,0 +1,534 @@ + + */ +class CampaignsVouchersCreateResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/CampaignsVouchersCreateResponseBodyLoyaltyCard.php b/src/Model/CampaignsVouchersCreateResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..9e9e6a0 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class CampaignsVouchersCreateResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/CampaignsVouchersCreateResponseBodyPublish.php b/src/Model/CampaignsVouchersCreateResponseBodyPublish.php new file mode 100644 index 0000000..18ee957 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class CampaignsVouchersCreateResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/CampaignsVouchersCreateResponseBodyRedemption.php b/src/Model/CampaignsVouchersCreateResponseBodyRedemption.php new file mode 100644 index 0000000..300e8a5 --- /dev/null +++ b/src/Model/CampaignsVouchersCreateResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class CampaignsVouchersCreateResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CampaignsVouchersCreateResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/CategoriesCreateRequestBody.php b/src/Model/CategoriesCreateRequestBody.php new file mode 100644 index 0000000..d628009 --- /dev/null +++ b/src/Model/CategoriesCreateRequestBody.php @@ -0,0 +1,459 @@ + + */ +class CategoriesCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoriesCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'hierarchy' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'hierarchy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'hierarchy' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'hierarchy' => 'hierarchy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'hierarchy' => 'setHierarchy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'hierarchy' => 'getHierarchy' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('hierarchy', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Category name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy Category hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + 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/CategoriesCreateResponseBody.php b/src/Model/CategoriesCreateResponseBody.php new file mode 100644 index 0000000..0b080ee --- /dev/null +++ b/src/Model/CategoriesCreateResponseBody.php @@ -0,0 +1,614 @@ + + */ +class CategoriesCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoriesCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'hierarchy' => 'int', + 'object' => 'string', + 'createdAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'hierarchy' => null, + 'object' => null, + 'createdAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'hierarchy' => true, + 'object' => true, + 'createdAt' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'hierarchy' => 'hierarchy', + 'object' => 'object', + 'createdAt' => 'created_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'hierarchy' => 'setHierarchy', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'hierarchy' => 'getHierarchy', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * 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 OBJECT_CATEGORY = 'category'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CATEGORY, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'category'); + $this->setIfExists('createdAt', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Category name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy Category hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + 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/CategoriesGetResponseBody.php b/src/Model/CategoriesGetResponseBody.php new file mode 100644 index 0000000..09c261f --- /dev/null +++ b/src/Model/CategoriesGetResponseBody.php @@ -0,0 +1,730 @@ + + */ +class CategoriesGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoriesGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'hierarchy' => 'int', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'stackingRulesType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'hierarchy' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'stackingRulesType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'hierarchy' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'stackingRulesType' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'hierarchy' => 'hierarchy', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'stackingRulesType' => 'stacking_rules_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'hierarchy' => 'setHierarchy', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'stackingRulesType' => 'setStackingRulesType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'hierarchy' => 'getHierarchy', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'stackingRulesType' => 'getStackingRulesType' + ]; + + /** + * 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 OBJECT_CATEGORY = 'category'; + public const STACKING_RULES_TYPE_JOINT = 'JOINT'; + public const STACKING_RULES_TYPE_EXCLUSIVE = 'EXCLUSIVE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CATEGORY, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStackingRulesTypeAllowableValues() + { + return [ + self::STACKING_RULES_TYPE_JOINT, + self::STACKING_RULES_TYPE_EXCLUSIVE, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'category'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('stackingRulesType', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStackingRulesTypeAllowableValues(); + if (!is_null($this->container['stackingRulesType']) && !in_array($this->container['stackingRulesType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'stackingRulesType', must be one of '%s'", + $this->container['stackingRulesType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Category name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy Category hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the category. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets stackingRulesType + * + * @return string|null + */ + public function getStackingRulesType() + { + return $this->container['stackingRulesType']; + } + + /** + * Sets stackingRulesType + * + * @param string|null $stackingRulesType The type of the stacking rule eligibility. + * + * @return self + */ + public function setStackingRulesType($stackingRulesType) + { + if (is_null($stackingRulesType)) { + array_push($this->openAPINullablesSetToNull, 'stackingRulesType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stackingRulesType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStackingRulesTypeAllowableValues(); + if (!is_null($stackingRulesType) && !in_array($stackingRulesType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'stackingRulesType', must be one of '%s'", + $stackingRulesType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['stackingRulesType'] = $stackingRulesType; + + 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/CategoriesListResponseBody.php b/src/Model/CategoriesListResponseBody.php new file mode 100644 index 0000000..259fb83 --- /dev/null +++ b/src/Model/CategoriesListResponseBody.php @@ -0,0 +1,605 @@ + + */ +class CategoriesListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoriesListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\Category[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about categories in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of category objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\Category[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of categories. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/CategoriesUpdateRequestBody.php b/src/Model/CategoriesUpdateRequestBody.php new file mode 100644 index 0000000..d9e3de9 --- /dev/null +++ b/src/Model/CategoriesUpdateRequestBody.php @@ -0,0 +1,459 @@ + + */ +class CategoriesUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoriesUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'hierarchy' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'hierarchy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'hierarchy' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'hierarchy' => 'hierarchy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'hierarchy' => 'setHierarchy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'hierarchy' => 'getHierarchy' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('hierarchy', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Category name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy Category hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + 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/CategoriesUpdateResponseBody.php b/src/Model/CategoriesUpdateResponseBody.php new file mode 100644 index 0000000..4d348ec --- /dev/null +++ b/src/Model/CategoriesUpdateResponseBody.php @@ -0,0 +1,655 @@ + + */ +class CategoriesUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoriesUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'hierarchy' => 'int', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'hierarchy' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'hierarchy' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'hierarchy' => 'hierarchy', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'hierarchy' => 'setHierarchy', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'hierarchy' => 'getHierarchy', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * 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 OBJECT_CATEGORY = 'category'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CATEGORY, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'category'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Category name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy Category hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + 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/Category.php b/src/Model/Category.php new file mode 100644 index 0000000..d21674b --- /dev/null +++ b/src/Model/Category.php @@ -0,0 +1,730 @@ + + */ +class Category implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Category'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'hierarchy' => 'int', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'stackingRulesType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'hierarchy' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'stackingRulesType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'hierarchy' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'stackingRulesType' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'hierarchy' => 'hierarchy', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'stackingRulesType' => 'stacking_rules_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'hierarchy' => 'setHierarchy', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'stackingRulesType' => 'setStackingRulesType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'hierarchy' => 'getHierarchy', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'stackingRulesType' => 'getStackingRulesType' + ]; + + /** + * 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 OBJECT_CATEGORY = 'category'; + public const STACKING_RULES_TYPE_JOINT = 'JOINT'; + public const STACKING_RULES_TYPE_EXCLUSIVE = 'EXCLUSIVE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CATEGORY, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStackingRulesTypeAllowableValues() + { + return [ + self::STACKING_RULES_TYPE_JOINT, + self::STACKING_RULES_TYPE_EXCLUSIVE, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'category'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('stackingRulesType', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStackingRulesTypeAllowableValues(); + if (!is_null($this->container['stackingRulesType']) && !in_array($this->container['stackingRulesType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'stackingRulesType', must be one of '%s'", + $this->container['stackingRulesType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Category name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy Category hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the category. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets stackingRulesType + * + * @return string|null + */ + public function getStackingRulesType() + { + return $this->container['stackingRulesType']; + } + + /** + * Sets stackingRulesType + * + * @param string|null $stackingRulesType The type of the stacking rule eligibility. + * + * @return self + */ + public function setStackingRulesType($stackingRulesType) + { + if (is_null($stackingRulesType)) { + array_push($this->openAPINullablesSetToNull, 'stackingRulesType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stackingRulesType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStackingRulesTypeAllowableValues(); + if (!is_null($stackingRulesType) && !in_array($stackingRulesType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'stackingRulesType', must be one of '%s'", + $stackingRulesType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['stackingRulesType'] = $stackingRulesType; + + 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/ClientEventsCreateRequestBody.php b/src/Model/ClientEventsCreateRequestBody.php new file mode 100644 index 0000000..ab9d3c2 --- /dev/null +++ b/src/Model/ClientEventsCreateRequestBody.php @@ -0,0 +1,593 @@ + + */ +class ClientEventsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientEventsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event' => 'string', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'referral' => '\OpenAPI\Client\Model\ClientEventsCreateRequestBodyReferral', + 'loyalty' => '\OpenAPI\Client\Model\ClientEventsCreateRequestBodyLoyalty', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event' => null, + 'customer' => null, + 'referral' => null, + 'loyalty' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event' => true, + 'customer' => false, + 'referral' => true, + 'loyalty' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'event' => 'event', + 'customer' => 'customer', + 'referral' => 'referral', + 'loyalty' => 'loyalty', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event' => 'setEvent', + 'customer' => 'setCustomer', + 'referral' => 'setReferral', + 'loyalty' => 'setLoyalty', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event' => 'getEvent', + 'customer' => 'getCustomer', + 'referral' => 'getReferral', + 'loyalty' => 'getLoyalty', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('event', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referral', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('metadata', $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 = []; + + if (!is_null($this->container['event']) && (mb_strlen($this->container['event']) > 300)) { + $invalidProperties[] = "invalid value for 'event', the character length must be smaller than or equal to 300."; + } + + if (!is_null($this->container['event']) && (mb_strlen($this->container['event']) < 1)) { + $invalidProperties[] = "invalid value for 'event', the character length must be bigger than or equal to 1."; + } + + if ($this->container['customer'] === null) { + $invalidProperties[] = "'customer' can't be null"; + } + 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 event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($event) && (mb_strlen($event) > 300)) { + throw new \InvalidArgumentException('invalid length for $event when calling ClientEventsCreateRequestBody., must be smaller than or equal to 300.'); + } + if (!is_null($event) && (mb_strlen($event) < 1)) { + throw new \InvalidArgumentException('invalid length for $event when calling ClientEventsCreateRequestBody., must be bigger than or equal to 1.'); + } + + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referral + * + * @return \OpenAPI\Client\Model\ClientEventsCreateRequestBodyReferral|null + */ + public function getReferral() + { + return $this->container['referral']; + } + + /** + * Sets referral + * + * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBodyReferral|null $referral referral + * + * @return self + */ + public function setReferral($referral) + { + if (is_null($referral)) { + array_push($this->openAPINullablesSetToNull, 'referral'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referral', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referral'] = $referral; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\ClientEventsCreateRequestBodyLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBodyLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ClientEventsCreateRequestBodyLoyalty.php b/src/Model/ClientEventsCreateRequestBodyLoyalty.php new file mode 100644 index 0000000..1df6a90 --- /dev/null +++ b/src/Model/ClientEventsCreateRequestBodyLoyalty.php @@ -0,0 +1,418 @@ + + */ +class ClientEventsCreateRequestBodyLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientEventsCreateRequestBodyLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true + ]; + + /** + * 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 = [ + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode' + ]; + + /** + * 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('code', $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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + 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/ClientEventsCreateRequestBodyReferral.php b/src/Model/ClientEventsCreateRequestBodyReferral.php new file mode 100644 index 0000000..d3a9059 --- /dev/null +++ b/src/Model/ClientEventsCreateRequestBodyReferral.php @@ -0,0 +1,459 @@ + + */ +class ClientEventsCreateRequestBodyReferral implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientEventsCreateRequestBodyReferral'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'referrerId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'referrerId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'referrerId' => true + ]; + + /** + * 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 = [ + 'code' => 'code', + 'referrerId' => 'referrer_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'referrerId' => 'setReferrerId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'referrerId' => 'getReferrerId' + ]; + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('referrerId', $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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code through which a new visitor has been referred to a service. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique ID of the referring person - it is optional and not required if the referral **code** is provided. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + 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/ClientEventsCreateResponseBody.php b/src/Model/ClientEventsCreateResponseBody.php new file mode 100644 index 0000000..3f4b466 --- /dev/null +++ b/src/Model/ClientEventsCreateResponseBody.php @@ -0,0 +1,651 @@ + + */ +class ClientEventsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientEventsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'type' => 'string', + 'customer' => '\OpenAPI\Client\Model\SimpleCustomerRequiredObjectType', + 'referral' => 'object', + 'loyalty' => 'object', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'type' => null, + 'customer' => null, + 'referral' => null, + 'loyalty' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'type' => true, + 'customer' => false, + 'referral' => true, + 'loyalty' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'type' => 'type', + 'customer' => 'customer', + 'referral' => 'referral', + 'loyalty' => 'loyalty', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'type' => 'setType', + 'customer' => 'setCustomer', + 'referral' => 'setReferral', + 'loyalty' => 'setLoyalty', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'type' => 'getType', + 'customer' => 'getCustomer', + 'referral' => 'getReferral', + 'loyalty' => 'getLoyalty', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 OBJECT_EVENT = 'event'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EVENT, + ]; + } + + /** + * 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('object', $data ?? [], 'event'); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referral', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('metadata', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['customer'] === null) { + $invalidProperties[] = "'customer' can't be null"; + } + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The object represented is an `event`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The event name. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\SimpleCustomerRequiredObjectType + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\SimpleCustomerRequiredObjectType $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referral + * + * @return object|null + */ + public function getReferral() + { + return $this->container['referral']; + } + + /** + * Sets referral + * + * @param object|null $referral A `null` referral object. + * + * @return self + */ + public function setReferral($referral) + { + if (is_null($referral)) { + array_push($this->openAPINullablesSetToNull, 'referral'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referral', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referral'] = $referral; + + return $this; + } + + /** + * Gets loyalty + * + * @return object|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param object|null $loyalty A `null` loyalty object. + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ClientPromotionsTiersListResponseBody.php b/src/Model/ClientPromotionsTiersListResponseBody.php new file mode 100644 index 0000000..4561b91 --- /dev/null +++ b/src/Model/ClientPromotionsTiersListResponseBody.php @@ -0,0 +1,582 @@ + + */ +class ClientPromotionsTiersListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientPromotionsTiersListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionTier[]', + 'total' => 'int', + 'hasMore' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'tiers' => null, + 'total' => null, + 'hasMore' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'tiers' => true, + 'total' => true, + 'hasMore' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'tiers' => 'tiers', + 'total' => 'total', + 'hasMore' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'tiers' => 'setTiers', + 'total' => 'setTotal', + 'hasMore' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'tiers' => 'getTiers', + 'total' => 'getTotal', + 'hasMore' => 'getHasMore' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'tiers'); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('hasMore', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of promotion tier objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionTier[]|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionTier[]|null $tiers Contains array of promotion tier objects. + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of promotion tiers. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + 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/ClientQualificationsCheckEligibilityRequestBody.php b/src/Model/ClientQualificationsCheckEligibilityRequestBody.php new file mode 100644 index 0000000..7a78fa2 --- /dev/null +++ b/src/Model/ClientQualificationsCheckEligibilityRequestBody.php @@ -0,0 +1,648 @@ + + */ +class ClientQualificationsCheckEligibilityRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientQualificationsCheckEligibilityRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customer' => '\OpenAPI\Client\Model\Customer', + 'order' => '\OpenAPI\Client\Model\Order', + 'trackingId' => 'string', + 'scenario' => 'string', + 'options' => '\OpenAPI\Client\Model\QualificationsOption', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customer' => null, + 'order' => null, + 'trackingId' => null, + 'scenario' => null, + 'options' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customer' => false, + 'order' => false, + 'trackingId' => true, + 'scenario' => true, + 'options' => false, + 'metadata' => true + ]; + + /** + * 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 = [ + 'customer' => 'customer', + 'order' => 'order', + 'trackingId' => 'tracking_id', + 'scenario' => 'scenario', + 'options' => 'options', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customer' => 'setCustomer', + 'order' => 'setOrder', + 'trackingId' => 'setTrackingId', + 'scenario' => 'setScenario', + 'options' => 'setOptions', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customer' => 'getCustomer', + 'order' => 'getOrder', + 'trackingId' => 'getTrackingId', + 'scenario' => 'getScenario', + 'options' => 'getOptions', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 SCENARIO_ALL = 'ALL'; + public const SCENARIO_CUSTOMER_WALLET = 'CUSTOMER_WALLET'; + public const SCENARIO_AUDIENCE_ONLY = 'AUDIENCE_ONLY'; + public const SCENARIO_PRODUCTS = 'PRODUCTS'; + public const SCENARIO_PRODUCTS_DISCOUNT = 'PRODUCTS_DISCOUNT'; + public const SCENARIO_PROMOTION_STACKS = 'PROMOTION_STACKS'; + public const SCENARIO_PRODUCTS_BY_CUSTOMER = 'PRODUCTS_BY_CUSTOMER'; + public const SCENARIO_PRODUCTS_DISCOUNT_BY_CUSTOMER = 'PRODUCTS_DISCOUNT_BY_CUSTOMER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getScenarioAllowableValues() + { + return [ + self::SCENARIO_ALL, + self::SCENARIO_CUSTOMER_WALLET, + self::SCENARIO_AUDIENCE_ONLY, + self::SCENARIO_PRODUCTS, + self::SCENARIO_PRODUCTS_DISCOUNT, + self::SCENARIO_PROMOTION_STACKS, + self::SCENARIO_PRODUCTS_BY_CUSTOMER, + self::SCENARIO_PRODUCTS_DISCOUNT_BY_CUSTOMER, + ]; + } + + /** + * 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('customer', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('scenario', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('metadata', $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->getScenarioAllowableValues(); + if (!is_null($this->container['scenario']) && !in_array($this->container['scenario'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'scenario', must be one of '%s'", + $this->container['scenario'], + 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 customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Is correspondent to Customer's source_id + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets scenario + * + * @return string|null + */ + public function getScenario() + { + return $this->container['scenario']; + } + + /** + * Sets scenario + * + * @param string|null $scenario Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). + * + * @return self + */ + public function setScenario($scenario) + { + if (is_null($scenario)) { + array_push($this->openAPINullablesSetToNull, 'scenario'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('scenario', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getScenarioAllowableValues(); + if (!is_null($scenario) && !in_array($scenario, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'scenario', must be one of '%s'", + $scenario, + implode("', '", $allowedValues) + ) + ); + } + $this->container['scenario'] = $scenario; + + return $this; + } + + /** + * Gets options + * + * @return \OpenAPI\Client\Model\QualificationsOption|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \OpenAPI\Client\Model\QualificationsOption|null $options options + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Advanced_ → _Redemption metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ClientQualificationsCheckEligibilityResponseBody.php b/src/Model/ClientQualificationsCheckEligibilityResponseBody.php new file mode 100644 index 0000000..8c6eb1e --- /dev/null +++ b/src/Model/ClientQualificationsCheckEligibilityResponseBody.php @@ -0,0 +1,520 @@ + + */ +class ClientQualificationsCheckEligibilityResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientQualificationsCheckEligibilityResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redeemables' => '\OpenAPI\Client\Model\QualificationsRedeemables', + 'trackingId' => 'string', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'stackingRules' => '\OpenAPI\Client\Model\StackingRules' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redeemables' => null, + 'trackingId' => null, + 'order' => null, + 'stackingRules' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redeemables' => false, + 'trackingId' => true, + 'order' => false, + 'stackingRules' => 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 = [ + 'redeemables' => 'redeemables', + 'trackingId' => 'tracking_id', + 'order' => 'order', + 'stackingRules' => 'stacking_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redeemables' => 'setRedeemables', + 'trackingId' => 'setTrackingId', + 'order' => 'setOrder', + 'stackingRules' => 'setStackingRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redeemables' => 'getRedeemables', + 'trackingId' => 'getTrackingId', + 'order' => 'getOrder', + 'stackingRules' => 'getStackingRules' + ]; + + /** + * 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('redeemables', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('stackingRules', $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 redeemables + * + * @return \OpenAPI\Client\Model\QualificationsRedeemables|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\QualificationsRedeemables|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + throw new \InvalidArgumentException('non-nullable redeemables cannot be null'); + } + $this->container['redeemables'] = $redeemables; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets stackingRules + * + * @return \OpenAPI\Client\Model\StackingRules|null + */ + public function getStackingRules() + { + return $this->container['stackingRules']; + } + + /** + * Sets stackingRules + * + * @param \OpenAPI\Client\Model\StackingRules|null $stackingRules stackingRules + * + * @return self + */ + public function setStackingRules($stackingRules) + { + if (is_null($stackingRules)) { + throw new \InvalidArgumentException('non-nullable stackingRules cannot be null'); + } + $this->container['stackingRules'] = $stackingRules; + + 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/ClientRedemptionsRedeemRequestBody.php b/src/Model/ClientRedemptionsRedeemRequestBody.php new file mode 100644 index 0000000..7fe6e53 --- /dev/null +++ b/src/Model/ClientRedemptionsRedeemRequestBody.php @@ -0,0 +1,643 @@ + + */ +class ClientRedemptionsRedeemRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientRedemptionsRedeemRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'options' => '\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyOptions', + 'redeemables' => '\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItem[]', + 'order' => '\OpenAPI\Client\Model\Order', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'session' => '\OpenAPI\Client\Model\Session', + 'trackingId' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'options' => null, + 'redeemables' => null, + 'order' => null, + 'customer' => null, + 'session' => null, + 'trackingId' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'options' => true, + 'redeemables' => true, + 'order' => false, + 'customer' => false, + 'session' => false, + 'trackingId' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'options' => 'options', + 'redeemables' => 'redeemables', + 'order' => 'order', + 'customer' => 'customer', + 'session' => 'session', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'options' => 'setOptions', + 'redeemables' => 'setRedeemables', + 'order' => 'setOrder', + 'customer' => 'setCustomer', + 'session' => 'setSession', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'options' => 'getOptions', + 'redeemables' => 'getRedeemables', + 'order' => 'getOrder', + 'customer' => 'getCustomer', + 'session' => 'getSession', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('options', $data ?? [], null); + $this->setIfExists('redeemables', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('session', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $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 options + * + * @return \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyOptions|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyOptions|null $options options + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + array_push($this->openAPINullablesSetToNull, 'options'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('options', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets redeemables + * + * @return \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItem[]|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItem[]|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + array_push($this->openAPINullablesSetToNull, 'redeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemables'] = $redeemables; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets session + * + * @return \OpenAPI\Client\Model\Session|null + */ + public function getSession() + { + return $this->container['session']; + } + + /** + * Sets session + * + * @param \OpenAPI\Client\Model\Session|null $session session + * + * @return self + */ + public function setSession($session) + { + if (is_null($session)) { + throw new \InvalidArgumentException('non-nullable session cannot be null'); + } + $this->container['session'] = $session; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Is correspondent to Customer's source_id + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ClientRedemptionsRedeemRequestBodyOptions.php b/src/Model/ClientRedemptionsRedeemRequestBodyOptions.php new file mode 100644 index 0000000..22523cb --- /dev/null +++ b/src/Model/ClientRedemptionsRedeemRequestBodyOptions.php @@ -0,0 +1,446 @@ + + */ +class ClientRedemptionsRedeemRequestBodyOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientRedemptionsRedeemRequestBodyOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'expand' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'expand' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expand' => true + ]; + + /** + * 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 = [ + 'expand' => 'expand' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'expand' => 'setExpand' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'expand' => 'getExpand' + ]; + + /** + * 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 EXPAND_ORDER = 'order'; + public const EXPAND_REDEMPTION = 'redemption'; + public const EXPAND_REDEEMABLE = 'redeemable'; + public const EXPAND_CATEGORY = 'category'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExpandAllowableValues() + { + return [ + self::EXPAND_ORDER, + self::EXPAND_REDEMPTION, + self::EXPAND_REDEEMABLE, + self::EXPAND_CATEGORY, + ]; + } + + /** + * 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('expand', $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 expand + * + * @return string[]|null + */ + public function getExpand() + { + return $this->container['expand']; + } + + /** + * Sets expand + * + * @param string[]|null $expand Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. | + * + * @return self + */ + public function setExpand($expand) + { + if (is_null($expand)) { + array_push($this->openAPINullablesSetToNull, 'expand'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expand', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExpandAllowableValues(); + if (!is_null($expand) && array_diff($expand, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'expand', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['expand'] = $expand; + + 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/ClientRedemptionsRedeemRequestBodyRedeemablesItem.php b/src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItem.php new file mode 100644 index 0000000..f74dec1 --- /dev/null +++ b/src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItem.php @@ -0,0 +1,562 @@ + + */ +class ClientRedemptionsRedeemRequestBodyRedeemablesItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientRedemptionsRedeemRequestBodyRedeemablesItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'id' => 'string', + 'gift' => '\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItemGift', + 'reward' => '\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItemReward' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'id' => null, + 'gift' => null, + 'reward' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => false, + 'id' => false, + 'gift' => true, + 'reward' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'id' => 'id', + 'gift' => 'gift', + 'reward' => 'reward' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'id' => 'setId', + 'gift' => 'setGift', + 'reward' => 'setReward' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'id' => 'getId', + 'gift' => 'getGift', + 'reward' => 'getReward' + ]; + + /** + * 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 OBJECT_VOUCHER = 'voucher'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + public const OBJECT_PROMOTION_STACK = 'promotion_stack'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + self::OBJECT_PROMOTION_TIER, + self::OBJECT_PROMOTION_STACK, + ]; + } + + /** + * 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('object', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('reward', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItemGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItemGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItemReward|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBodyRedeemablesItemReward|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + array_push($this->openAPINullablesSetToNull, 'reward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reward'] = $reward; + + 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/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.php b/src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.php new file mode 100644 index 0000000..317f807 --- /dev/null +++ b/src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.php @@ -0,0 +1,418 @@ + + */ +class ClientRedemptionsRedeemRequestBodyRedeemablesItemGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientRedemptionsRedeemRequestBodyRedeemablesItemGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'credits' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'credits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'credits' => true + ]; + + /** + * 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 = [ + 'credits' => 'credits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'credits' => 'setCredits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'credits' => 'getCredits' + ]; + + /** + * 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('credits', $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 credits + * + * @return int|null + */ + public function getCredits() + { + return $this->container['credits']; + } + + /** + * Sets credits + * + * @param int|null $credits The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setCredits($credits) + { + if (is_null($credits)) { + array_push($this->openAPINullablesSetToNull, 'credits'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('credits', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['credits'] = $credits; + + 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/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.php b/src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.php new file mode 100644 index 0000000..a9f35ff --- /dev/null +++ b/src/Model/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.php @@ -0,0 +1,459 @@ + + */ +class ClientRedemptionsRedeemRequestBodyRedeemablesItemReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientRedemptionsRedeemRequestBodyRedeemablesItemReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'points' => 'getPoints' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('points', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/ClientRedemptionsRedeemResponseBody.php b/src/Model/ClientRedemptionsRedeemResponseBody.php new file mode 100644 index 0000000..7609e18 --- /dev/null +++ b/src/Model/ClientRedemptionsRedeemResponseBody.php @@ -0,0 +1,568 @@ + + */ +class ClientRedemptionsRedeemResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientRedemptionsRedeemResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\Redemption[]', + 'parentRedemption' => '\OpenAPI\Client\Model\Redemption', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'inapplicableRedeemables' => '\OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]', + 'skippedRedeemables' => '\OpenAPI\Client\Model\ValidationsRedeemableSkipped[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'parentRedemption' => null, + 'order' => null, + 'inapplicableRedeemables' => null, + 'skippedRedeemables' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'parentRedemption' => false, + 'order' => false, + 'inapplicableRedeemables' => true, + 'skippedRedeemables' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'parentRedemption' => 'parent_redemption', + 'order' => 'order', + 'inapplicableRedeemables' => 'inapplicable_redeemables', + 'skippedRedeemables' => 'skipped_redeemables' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'parentRedemption' => 'setParentRedemption', + 'order' => 'setOrder', + 'inapplicableRedeemables' => 'setInapplicableRedeemables', + 'skippedRedeemables' => 'setSkippedRedeemables' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'parentRedemption' => 'getParentRedemption', + 'order' => 'getOrder', + 'inapplicableRedeemables' => 'getInapplicableRedeemables', + 'skippedRedeemables' => 'getSkippedRedeemables' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('parentRedemption', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('inapplicableRedeemables', $data ?? [], null); + $this->setIfExists('skippedRedeemables', $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 redemptions + * + * @return \OpenAPI\Client\Model\Redemption[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\Redemption[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets parentRedemption + * + * @return \OpenAPI\Client\Model\Redemption|null + */ + public function getParentRedemption() + { + return $this->container['parentRedemption']; + } + + /** + * Sets parentRedemption + * + * @param \OpenAPI\Client\Model\Redemption|null $parentRedemption parentRedemption + * + * @return self + */ + public function setParentRedemption($parentRedemption) + { + if (is_null($parentRedemption)) { + throw new \InvalidArgumentException('non-nullable parentRedemption cannot be null'); + } + $this->container['parentRedemption'] = $parentRedemption; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets inapplicableRedeemables + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]|null + */ + public function getInapplicableRedeemables() + { + return $this->container['inapplicableRedeemables']; + } + + /** + * Sets inapplicableRedeemables + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]|null $inapplicableRedeemables Lists validation results of each inapplicable redeemable. + * + * @return self + */ + public function setInapplicableRedeemables($inapplicableRedeemables) + { + if (is_null($inapplicableRedeemables)) { + array_push($this->openAPINullablesSetToNull, 'inapplicableRedeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inapplicableRedeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['inapplicableRedeemables'] = $inapplicableRedeemables; + + return $this; + } + + /** + * Gets skippedRedeemables + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableSkipped[]|null + */ + public function getSkippedRedeemables() + { + return $this->container['skippedRedeemables']; + } + + /** + * Sets skippedRedeemables + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableSkipped[]|null $skippedRedeemables Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`. + * + * @return self + */ + public function setSkippedRedeemables($skippedRedeemables) + { + if (is_null($skippedRedeemables)) { + array_push($this->openAPINullablesSetToNull, 'skippedRedeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skippedRedeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skippedRedeemables'] = $skippedRedeemables; + + 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/ClientValidationsValidateRequestBody.php b/src/Model/ClientValidationsValidateRequestBody.php new file mode 100644 index 0000000..6bccb98 --- /dev/null +++ b/src/Model/ClientValidationsValidateRequestBody.php @@ -0,0 +1,643 @@ + + */ +class ClientValidationsValidateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'options' => '\OpenAPI\Client\Model\ClientValidationsValidateRequestBodyOptions', + 'redeemables' => '\OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItem[]', + 'order' => '\OpenAPI\Client\Model\Order', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'session' => '\OpenAPI\Client\Model\Session', + 'trackingId' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'options' => null, + 'redeemables' => null, + 'order' => null, + 'customer' => null, + 'session' => null, + 'trackingId' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'options' => true, + 'redeemables' => true, + 'order' => false, + 'customer' => false, + 'session' => false, + 'trackingId' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'options' => 'options', + 'redeemables' => 'redeemables', + 'order' => 'order', + 'customer' => 'customer', + 'session' => 'session', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'options' => 'setOptions', + 'redeemables' => 'setRedeemables', + 'order' => 'setOrder', + 'customer' => 'setCustomer', + 'session' => 'setSession', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'options' => 'getOptions', + 'redeemables' => 'getRedeemables', + 'order' => 'getOrder', + 'customer' => 'getCustomer', + 'session' => 'getSession', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('options', $data ?? [], null); + $this->setIfExists('redeemables', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('session', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $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 options + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateRequestBodyOptions|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBodyOptions|null $options options + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + array_push($this->openAPINullablesSetToNull, 'options'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('options', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets redeemables + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItem[]|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItem[]|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + array_push($this->openAPINullablesSetToNull, 'redeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemables'] = $redeemables; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets session + * + * @return \OpenAPI\Client\Model\Session|null + */ + public function getSession() + { + return $this->container['session']; + } + + /** + * Sets session + * + * @param \OpenAPI\Client\Model\Session|null $session session + * + * @return self + */ + public function setSession($session) + { + if (is_null($session)) { + throw new \InvalidArgumentException('non-nullable session cannot be null'); + } + $this->container['session'] = $session; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Is correspondent to Customer's source_id + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ClientValidationsValidateRequestBodyOptions.php b/src/Model/ClientValidationsValidateRequestBodyOptions.php new file mode 100644 index 0000000..a01e2f0 --- /dev/null +++ b/src/Model/ClientValidationsValidateRequestBodyOptions.php @@ -0,0 +1,446 @@ + + */ +class ClientValidationsValidateRequestBodyOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateRequestBodyOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'expand' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'expand' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expand' => true + ]; + + /** + * 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 = [ + 'expand' => 'expand' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'expand' => 'setExpand' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'expand' => 'getExpand' + ]; + + /** + * 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 EXPAND_ORDER = 'order'; + public const EXPAND_REDEMPTION = 'redemption'; + public const EXPAND_REDEEMABLE = 'redeemable'; + public const EXPAND_CATEGORY = 'category'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExpandAllowableValues() + { + return [ + self::EXPAND_ORDER, + self::EXPAND_REDEMPTION, + self::EXPAND_REDEEMABLE, + self::EXPAND_CATEGORY, + ]; + } + + /** + * 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('expand', $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 expand + * + * @return string[]|null + */ + public function getExpand() + { + return $this->container['expand']; + } + + /** + * Sets expand + * + * @param string[]|null $expand The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | + * + * @return self + */ + public function setExpand($expand) + { + if (is_null($expand)) { + array_push($this->openAPINullablesSetToNull, 'expand'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expand', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExpandAllowableValues(); + if (!is_null($expand) && array_diff($expand, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'expand', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['expand'] = $expand; + + 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/ClientValidationsValidateRequestBodyRedeemablesItem.php b/src/Model/ClientValidationsValidateRequestBodyRedeemablesItem.php new file mode 100644 index 0000000..677e580 --- /dev/null +++ b/src/Model/ClientValidationsValidateRequestBodyRedeemablesItem.php @@ -0,0 +1,562 @@ + + */ +class ClientValidationsValidateRequestBodyRedeemablesItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateRequestBodyRedeemablesItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'id' => 'string', + 'gift' => '\OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItemGift', + 'reward' => '\OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItemReward' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'id' => null, + 'gift' => null, + 'reward' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => false, + 'id' => false, + 'gift' => true, + 'reward' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'id' => 'id', + 'gift' => 'gift', + 'reward' => 'reward' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'id' => 'setId', + 'gift' => 'setGift', + 'reward' => 'setReward' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'id' => 'getId', + 'gift' => 'getGift', + 'reward' => 'getReward' + ]; + + /** + * 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 OBJECT_VOUCHER = 'voucher'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + public const OBJECT_PROMOTION_STACK = 'promotion_stack'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + self::OBJECT_PROMOTION_TIER, + self::OBJECT_PROMOTION_STACK, + ]; + } + + /** + * 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('object', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('reward', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItemGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItemGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItemReward|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateRequestBodyRedeemablesItemReward|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + array_push($this->openAPINullablesSetToNull, 'reward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reward'] = $reward; + + 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/ClientValidationsValidateRequestBodyRedeemablesItemGift.php b/src/Model/ClientValidationsValidateRequestBodyRedeemablesItemGift.php new file mode 100644 index 0000000..c00b6f0 --- /dev/null +++ b/src/Model/ClientValidationsValidateRequestBodyRedeemablesItemGift.php @@ -0,0 +1,418 @@ + + */ +class ClientValidationsValidateRequestBodyRedeemablesItemGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateRequestBodyRedeemablesItemGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'credits' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'credits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'credits' => true + ]; + + /** + * 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 = [ + 'credits' => 'credits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'credits' => 'setCredits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'credits' => 'getCredits' + ]; + + /** + * 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('credits', $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 credits + * + * @return int|null + */ + public function getCredits() + { + return $this->container['credits']; + } + + /** + * Sets credits + * + * @param int|null $credits The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setCredits($credits) + { + if (is_null($credits)) { + array_push($this->openAPINullablesSetToNull, 'credits'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('credits', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['credits'] = $credits; + + 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/ClientValidationsValidateRequestBodyRedeemablesItemReward.php b/src/Model/ClientValidationsValidateRequestBodyRedeemablesItemReward.php new file mode 100644 index 0000000..f92f6d9 --- /dev/null +++ b/src/Model/ClientValidationsValidateRequestBodyRedeemablesItemReward.php @@ -0,0 +1,459 @@ + + */ +class ClientValidationsValidateRequestBodyRedeemablesItemReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateRequestBodyRedeemablesItemReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'points' => 'getPoints' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('points', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/ClientValidationsValidateResponseBody.php b/src/Model/ClientValidationsValidateResponseBody.php new file mode 100644 index 0000000..15b2b2d --- /dev/null +++ b/src/Model/ClientValidationsValidateResponseBody.php @@ -0,0 +1,687 @@ + + */ +class ClientValidationsValidateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'valid' => 'bool', + 'redeemables' => '\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItem[]', + 'skippedRedeemables' => '\OpenAPI\Client\Model\ValidationsRedeemableSkipped[]', + 'inapplicableRedeemables' => '\OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'trackingId' => 'string', + 'session' => '\OpenAPI\Client\Model\Session', + 'stackingRules' => '\OpenAPI\Client\Model\StackingRules' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'valid' => null, + 'redeemables' => null, + 'skippedRedeemables' => null, + 'inapplicableRedeemables' => null, + 'order' => null, + 'trackingId' => null, + 'session' => null, + 'stackingRules' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'valid' => true, + 'redeemables' => true, + 'skippedRedeemables' => true, + 'inapplicableRedeemables' => true, + 'order' => false, + 'trackingId' => true, + 'session' => false, + 'stackingRules' => 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 = [ + 'valid' => 'valid', + 'redeemables' => 'redeemables', + 'skippedRedeemables' => 'skipped_redeemables', + 'inapplicableRedeemables' => 'inapplicable_redeemables', + 'order' => 'order', + 'trackingId' => 'tracking_id', + 'session' => 'session', + 'stackingRules' => 'stacking_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'valid' => 'setValid', + 'redeemables' => 'setRedeemables', + 'skippedRedeemables' => 'setSkippedRedeemables', + 'inapplicableRedeemables' => 'setInapplicableRedeemables', + 'order' => 'setOrder', + 'trackingId' => 'setTrackingId', + 'session' => 'setSession', + 'stackingRules' => 'setStackingRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'valid' => 'getValid', + 'redeemables' => 'getRedeemables', + 'skippedRedeemables' => 'getSkippedRedeemables', + 'inapplicableRedeemables' => 'getInapplicableRedeemables', + 'order' => 'getOrder', + 'trackingId' => 'getTrackingId', + 'session' => 'getSession', + 'stackingRules' => 'getStackingRules' + ]; + + /** + * 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('valid', $data ?? [], null); + $this->setIfExists('redeemables', $data ?? [], null); + $this->setIfExists('skippedRedeemables', $data ?? [], null); + $this->setIfExists('inapplicableRedeemables', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('session', $data ?? [], null); + $this->setIfExists('stackingRules', $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 = []; + + if ($this->container['stackingRules'] === null) { + $invalidProperties[] = "'stackingRules' can't be null"; + } + 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 valid + * + * @return bool|null + */ + public function getValid() + { + return $this->container['valid']; + } + + /** + * Sets valid + * + * @param bool|null $valid The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. + * + * @return self + */ + public function setValid($valid) + { + if (is_null($valid)) { + array_push($this->openAPINullablesSetToNull, 'valid'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('valid', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['valid'] = $valid; + + return $this; + } + + /** + * Gets redeemables + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItem[]|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItem[]|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + array_push($this->openAPINullablesSetToNull, 'redeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemables'] = $redeemables; + + return $this; + } + + /** + * Gets skippedRedeemables + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableSkipped[]|null + */ + public function getSkippedRedeemables() + { + return $this->container['skippedRedeemables']; + } + + /** + * Sets skippedRedeemables + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableSkipped[]|null $skippedRedeemables Lists validation results of each skipped redeemable. + * + * @return self + */ + public function setSkippedRedeemables($skippedRedeemables) + { + if (is_null($skippedRedeemables)) { + array_push($this->openAPINullablesSetToNull, 'skippedRedeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skippedRedeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skippedRedeemables'] = $skippedRedeemables; + + return $this; + } + + /** + * Gets inapplicableRedeemables + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]|null + */ + public function getInapplicableRedeemables() + { + return $this->container['inapplicableRedeemables']; + } + + /** + * Sets inapplicableRedeemables + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]|null $inapplicableRedeemables Lists validation results of each inapplicable redeemable. + * + * @return self + */ + public function setInapplicableRedeemables($inapplicableRedeemables) + { + if (is_null($inapplicableRedeemables)) { + array_push($this->openAPINullablesSetToNull, 'inapplicableRedeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inapplicableRedeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['inapplicableRedeemables'] = $inapplicableRedeemables; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets session + * + * @return \OpenAPI\Client\Model\Session|null + */ + public function getSession() + { + return $this->container['session']; + } + + /** + * Sets session + * + * @param \OpenAPI\Client\Model\Session|null $session session + * + * @return self + */ + public function setSession($session) + { + if (is_null($session)) { + throw new \InvalidArgumentException('non-nullable session cannot be null'); + } + $this->container['session'] = $session; + + return $this; + } + + /** + * Gets stackingRules + * + * @return \OpenAPI\Client\Model\StackingRules + */ + public function getStackingRules() + { + return $this->container['stackingRules']; + } + + /** + * Sets stackingRules + * + * @param \OpenAPI\Client\Model\StackingRules $stackingRules stackingRules + * + * @return self + */ + public function setStackingRules($stackingRules) + { + if (is_null($stackingRules)) { + throw new \InvalidArgumentException('non-nullable stackingRules cannot be null'); + } + $this->container['stackingRules'] = $stackingRules; + + 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/ClientValidationsValidateResponseBodyRedeemablesItem.php b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItem.php new file mode 100644 index 0000000..2ea3d56 --- /dev/null +++ b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItem.php @@ -0,0 +1,773 @@ + + */ +class ClientValidationsValidateResponseBodyRedeemablesItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateResponseBodyRedeemablesItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'id' => 'string', + 'object' => 'string', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'applicableTo' => '\OpenAPI\Client\Model\ApplicableToResultList', + 'inapplicableTo' => '\OpenAPI\Client\Model\InapplicableToResultList', + 'result' => '\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResult', + 'metadata' => 'object', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'id' => null, + 'object' => null, + 'order' => null, + 'applicableTo' => null, + 'inapplicableTo' => null, + 'result' => null, + 'metadata' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'id' => true, + 'object' => true, + 'order' => false, + 'applicableTo' => false, + 'inapplicableTo' => false, + 'result' => false, + 'metadata' => false, + 'categories' => true + ]; + + /** + * 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 = [ + 'status' => 'status', + 'id' => 'id', + 'object' => 'object', + 'order' => 'order', + 'applicableTo' => 'applicable_to', + 'inapplicableTo' => 'inapplicable_to', + 'result' => 'result', + 'metadata' => 'metadata', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'id' => 'setId', + 'object' => 'setObject', + 'order' => 'setOrder', + 'applicableTo' => 'setApplicableTo', + 'inapplicableTo' => 'setInapplicableTo', + 'result' => 'setResult', + 'metadata' => 'setMetadata', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'id' => 'getId', + 'object' => 'getObject', + 'order' => 'getOrder', + 'applicableTo' => 'getApplicableTo', + 'inapplicableTo' => 'getInapplicableTo', + 'result' => 'getResult', + 'metadata' => 'getMetadata', + 'categories' => 'getCategories' + ]; + + /** + * 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 STATUS_APPLICABLE = 'APPLICABLE'; + public const STATUS_INAPPLICABLE = 'INAPPLICABLE'; + public const STATUS_SKIPPED = 'SKIPPED'; + public const OBJECT_VOUCHER = 'voucher'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_APPLICABLE, + self::STATUS_INAPPLICABLE, + self::STATUS_SKIPPED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + self::OBJECT_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('status', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('inapplicableTo', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('categories', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Redeemable ID, i.e. the voucher code. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Redeemable's object type. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ApplicableToResultList|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ApplicableToResultList|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + throw new \InvalidArgumentException('non-nullable applicableTo cannot be null'); + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets inapplicableTo + * + * @return \OpenAPI\Client\Model\InapplicableToResultList|null + */ + public function getInapplicableTo() + { + return $this->container['inapplicableTo']; + } + + /** + * Sets inapplicableTo + * + * @param \OpenAPI\Client\Model\InapplicableToResultList|null $inapplicableTo inapplicableTo + * + * @return self + */ + public function setInapplicableTo($inapplicableTo) + { + if (is_null($inapplicableTo)) { + throw new \InvalidArgumentException('non-nullable inapplicableTo cannot be null'); + } + $this->container['inapplicableTo'] = $inapplicableTo; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/ClientValidationsValidateResponseBodyRedeemablesItemResult.php b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResult.php new file mode 100644 index 0000000..bca064a --- /dev/null +++ b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResult.php @@ -0,0 +1,553 @@ + + */ +class ClientValidationsValidateResponseBodyRedeemablesItemResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateResponseBodyRedeemablesItemResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount', + 'gift' => '\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard', + 'error' => '\OpenAPI\Client\Model\Error', + 'details' => '\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDetails' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'error' => null, + 'details' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => false, + 'error' => false, + 'details' => 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 = [ + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'error' => 'error', + 'details' => 'details' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'error' => 'setError', + 'details' => 'setDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'error' => 'getError', + 'details' => 'getDetails' + ]; + + /** + * 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('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('details', $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 discount + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\Error|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\Error|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets details + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDetails|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDetails|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } + $this->container['details'] = $details; + + 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/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.php b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.php new file mode 100644 index 0000000..e1977ad --- /dev/null +++ b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.php @@ -0,0 +1,444 @@ + + */ +class ClientValidationsValidateResponseBodyRedeemablesItemResultDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateResponseBodyRedeemablesItemResultDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key' => false, + 'message' => 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 = [ + 'key' => 'key', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'message' => 'getMessage' + ]; + + /** + * 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('key', $data ?? [], null); + $this->setIfExists('message', $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 key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key key + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + throw new \InvalidArgumentException('non-nullable key cannot be null'); + } + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + 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/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.php b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.php new file mode 100644 index 0000000..a53f348 --- /dev/null +++ b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.php @@ -0,0 +1,1129 @@ + + */ +class ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'amountOff' => 'float', + 'amountOffFormula' => 'string', + 'aggregatedAmountLimit' => 'int', + 'effect' => 'string', + 'isDynamic' => 'bool', + 'unitOff' => 'int', + 'unitOffFormula' => 'string', + 'unitType' => 'string', + 'product' => '\OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct', + 'sku' => '\OpenAPI\Client\Model\SimpleSkuDiscountUnit', + 'units' => '\OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]', + 'percentOff' => 'float', + 'percentOffFormula' => 'string', + 'amountLimit' => 'float', + 'fixedAmount' => 'float', + 'fixedAmountFormula' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'amountOff' => null, + 'amountOffFormula' => null, + 'aggregatedAmountLimit' => null, + 'effect' => null, + 'isDynamic' => null, + 'unitOff' => null, + 'unitOffFormula' => null, + 'unitType' => null, + 'product' => null, + 'sku' => null, + 'units' => null, + 'percentOff' => null, + 'percentOffFormula' => null, + 'amountLimit' => null, + 'fixedAmount' => null, + 'fixedAmountFormula' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'amountOff' => true, + 'amountOffFormula' => true, + 'aggregatedAmountLimit' => true, + 'effect' => false, + 'isDynamic' => true, + 'unitOff' => true, + 'unitOffFormula' => true, + 'unitType' => true, + 'product' => false, + 'sku' => false, + 'units' => true, + 'percentOff' => true, + 'percentOffFormula' => true, + 'amountLimit' => true, + 'fixedAmount' => true, + 'fixedAmountFormula' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'amountOff' => 'amount_off', + 'amountOffFormula' => 'amount_off_formula', + 'aggregatedAmountLimit' => 'aggregated_amount_limit', + 'effect' => 'effect', + 'isDynamic' => 'is_dynamic', + 'unitOff' => 'unit_off', + 'unitOffFormula' => 'unit_off_formula', + 'unitType' => 'unit_type', + 'product' => 'product', + 'sku' => 'sku', + 'units' => 'units', + 'percentOff' => 'percent_off', + 'percentOffFormula' => 'percent_off_formula', + 'amountLimit' => 'amount_limit', + 'fixedAmount' => 'fixed_amount', + 'fixedAmountFormula' => 'fixed_amount_formula' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'amountOff' => 'setAmountOff', + 'amountOffFormula' => 'setAmountOffFormula', + 'aggregatedAmountLimit' => 'setAggregatedAmountLimit', + 'effect' => 'setEffect', + 'isDynamic' => 'setIsDynamic', + 'unitOff' => 'setUnitOff', + 'unitOffFormula' => 'setUnitOffFormula', + 'unitType' => 'setUnitType', + 'product' => 'setProduct', + 'sku' => 'setSku', + 'units' => 'setUnits', + 'percentOff' => 'setPercentOff', + 'percentOffFormula' => 'setPercentOffFormula', + 'amountLimit' => 'setAmountLimit', + 'fixedAmount' => 'setFixedAmount', + 'fixedAmountFormula' => 'setFixedAmountFormula' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'amountOff' => 'getAmountOff', + 'amountOffFormula' => 'getAmountOffFormula', + 'aggregatedAmountLimit' => 'getAggregatedAmountLimit', + 'effect' => 'getEffect', + 'isDynamic' => 'getIsDynamic', + 'unitOff' => 'getUnitOff', + 'unitOffFormula' => 'getUnitOffFormula', + 'unitType' => 'getUnitType', + 'product' => 'getProduct', + 'sku' => 'getSku', + 'units' => 'getUnits', + 'percentOff' => 'getPercentOff', + 'percentOffFormula' => 'getPercentOffFormula', + 'amountLimit' => 'getAmountLimit', + 'fixedAmount' => 'getFixedAmount', + 'fixedAmountFormula' => 'getFixedAmountFormula' + ]; + + /** + * 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 TYPE_AMOUNT = 'AMOUNT'; + public const TYPE_UNIT = 'UNIT'; + public const TYPE_PERCENT = 'PERCENT'; + public const TYPE_FIXED = 'FIXED'; + public const EFFECT_APPLY_TO_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_APPLY_TO_ITEMS = 'APPLY_TO_ITEMS'; + public const EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY = 'APPLY_TO_ITEMS_PROPORTIONALLY'; + public const EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY'; + public const EFFECT_APPLY_TO_ITEMS_BY_QUANTITY = 'APPLY_TO_ITEMS_BY_QUANTITY'; + public const EFFECT_ADD_MISSING_ITEMS = 'ADD_MISSING_ITEMS'; + public const EFFECT_ADD_NEW_ITEMS = 'ADD_NEW_ITEMS'; + public const EFFECT_ADD_MANY_ITEMS = 'ADD_MANY_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AMOUNT, + self::TYPE_UNIT, + self::TYPE_PERCENT, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_APPLY_TO_ORDER, + self::EFFECT_APPLY_TO_ITEMS, + self::EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::EFFECT_APPLY_TO_ITEMS_BY_QUANTITY, + self::EFFECT_ADD_MISSING_ITEMS, + self::EFFECT_ADD_NEW_ITEMS, + self::EFFECT_ADD_MANY_ITEMS, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('amountOff', $data ?? [], null); + $this->setIfExists('amountOffFormula', $data ?? [], null); + $this->setIfExists('aggregatedAmountLimit', $data ?? [], null); + $this->setIfExists('effect', $data ?? [], null); + $this->setIfExists('isDynamic', $data ?? [], null); + $this->setIfExists('unitOff', $data ?? [], null); + $this->setIfExists('unitOffFormula', $data ?? [], null); + $this->setIfExists('unitType', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('percentOff', $data ?? [], null); + $this->setIfExists('percentOffFormula', $data ?? [], null); + $this->setIfExists('amountLimit', $data ?? [], null); + $this->setIfExists('fixedAmount', $data ?? [], null); + $this->setIfExists('fixedAmountFormula', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets amountOff + * + * @return float|null + */ + public function getAmountOff() + { + return $this->container['amountOff']; + } + + /** + * Sets amountOff + * + * @param float|null $amountOff Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. + * + * @return self + */ + public function setAmountOff($amountOff) + { + if (is_null($amountOff)) { + array_push($this->openAPINullablesSetToNull, 'amountOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountOff'] = $amountOff; + + return $this; + } + + /** + * Gets amountOffFormula + * + * @return string|null + */ + public function getAmountOffFormula() + { + return $this->container['amountOffFormula']; + } + + /** + * Sets amountOffFormula + * + * @param string|null $amountOffFormula amountOffFormula + * + * @return self + */ + public function setAmountOffFormula($amountOffFormula) + { + if (is_null($amountOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'amountOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountOffFormula'] = $amountOffFormula; + + return $this; + } + + /** + * Gets aggregatedAmountLimit + * + * @return int|null + */ + public function getAggregatedAmountLimit() + { + return $this->container['aggregatedAmountLimit']; + } + + /** + * Sets aggregatedAmountLimit + * + * @param int|null $aggregatedAmountLimit Maximum discount amount per order. + * + * @return self + */ + public function setAggregatedAmountLimit($aggregatedAmountLimit) + { + if (is_null($aggregatedAmountLimit)) { + array_push($this->openAPINullablesSetToNull, 'aggregatedAmountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('aggregatedAmountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['aggregatedAmountLimit'] = $aggregatedAmountLimit; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect effect + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + throw new \InvalidArgumentException('non-nullable effect cannot be null'); + } + $allowedValues = $this->getEffectAllowableValues(); + if (!in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + return $this; + } + + /** + * Gets isDynamic + * + * @return bool|null + */ + public function getIsDynamic() + { + return $this->container['isDynamic']; + } + + /** + * Sets isDynamic + * + * @param bool|null $isDynamic Flag indicating whether the discount was calculated using a formula. + * + * @return self + */ + public function setIsDynamic($isDynamic) + { + if (is_null($isDynamic)) { + array_push($this->openAPINullablesSetToNull, 'isDynamic'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isDynamic', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isDynamic'] = $isDynamic; + + return $this; + } + + /** + * Gets unitOff + * + * @return int|null + */ + public function getUnitOff() + { + return $this->container['unitOff']; + } + + /** + * Sets unitOff + * + * @param int|null $unitOff Number of units to be granted a full value discount. + * + * @return self + */ + public function setUnitOff($unitOff) + { + if (is_null($unitOff)) { + array_push($this->openAPINullablesSetToNull, 'unitOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitOff'] = $unitOff; + + return $this; + } + + /** + * Gets unitOffFormula + * + * @return string|null + */ + public function getUnitOffFormula() + { + return $this->container['unitOffFormula']; + } + + /** + * Sets unitOffFormula + * + * @param string|null $unitOffFormula unitOffFormula + * + * @return self + */ + public function setUnitOffFormula($unitOffFormula) + { + if (is_null($unitOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'unitOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitOffFormula'] = $unitOffFormula; + + return $this; + } + + /** + * Gets unitType + * + * @return string|null + */ + public function getUnitType() + { + return $this->container['unitType']; + } + + /** + * Sets unitType + * + * @param string|null $unitType The product deemed as free, chosen from product inventory (e.g. time, items). + * + * @return self + */ + public function setUnitType($unitType) + { + if (is_null($unitType)) { + array_push($this->openAPINullablesSetToNull, 'unitType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitType'] = $unitType; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + throw new \InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets sku + * + * @return \OpenAPI\Client\Model\SimpleSkuDiscountUnit|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param \OpenAPI\Client\Model\SimpleSkuDiscountUnit|null $sku sku + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + throw new \InvalidArgumentException('non-nullable sku cannot be null'); + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets units + * + * @return \OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]|null + */ + public function getUnits() + { + return $this->container['units']; + } + + /** + * Sets units + * + * @param \OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]|null $units units + * + * @return self + */ + public function setUnits($units) + { + if (is_null($units)) { + array_push($this->openAPINullablesSetToNull, 'units'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('units', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['units'] = $units; + + return $this; + } + + /** + * Gets percentOff + * + * @return float|null + */ + public function getPercentOff() + { + return $this->container['percentOff']; + } + + /** + * Sets percentOff + * + * @param float|null $percentOff The percent discount that the customer will receive. + * + * @return self + */ + public function setPercentOff($percentOff) + { + if (is_null($percentOff)) { + array_push($this->openAPINullablesSetToNull, 'percentOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('percentOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['percentOff'] = $percentOff; + + return $this; + } + + /** + * Gets percentOffFormula + * + * @return string|null + */ + public function getPercentOffFormula() + { + return $this->container['percentOffFormula']; + } + + /** + * Sets percentOffFormula + * + * @param string|null $percentOffFormula percentOffFormula + * + * @return self + */ + public function setPercentOffFormula($percentOffFormula) + { + if (is_null($percentOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'percentOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('percentOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['percentOffFormula'] = $percentOffFormula; + + return $this; + } + + /** + * Gets amountLimit + * + * @return float|null + */ + public function getAmountLimit() + { + return $this->container['amountLimit']; + } + + /** + * Sets amountLimit + * + * @param float|null $amountLimit Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. + * + * @return self + */ + public function setAmountLimit($amountLimit) + { + if (is_null($amountLimit)) { + array_push($this->openAPINullablesSetToNull, 'amountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountLimit'] = $amountLimit; + + return $this; + } + + /** + * Gets fixedAmount + * + * @return float|null + */ + public function getFixedAmount() + { + return $this->container['fixedAmount']; + } + + /** + * Sets fixedAmount + * + * @param float|null $fixedAmount Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. + * + * @return self + */ + public function setFixedAmount($fixedAmount) + { + if (is_null($fixedAmount)) { + array_push($this->openAPINullablesSetToNull, 'fixedAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fixedAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fixedAmount'] = $fixedAmount; + + return $this; + } + + /** + * Gets fixedAmountFormula + * + * @return string|null + */ + public function getFixedAmountFormula() + { + return $this->container['fixedAmountFormula']; + } + + /** + * Sets fixedAmountFormula + * + * @param string|null $fixedAmountFormula fixedAmountFormula + * + * @return self + */ + public function setFixedAmountFormula($fixedAmountFormula) + { + if (is_null($fixedAmountFormula)) { + array_push($this->openAPINullablesSetToNull, 'fixedAmountFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fixedAmountFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fixedAmountFormula'] = $fixedAmountFormula; + + 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/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.php b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.php new file mode 100644 index 0000000..e666ccb --- /dev/null +++ b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.php @@ -0,0 +1,499 @@ + + */ +class ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Product's source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.php b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.php new file mode 100644 index 0000000..9519ac0 --- /dev/null +++ b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.php @@ -0,0 +1,418 @@ + + */ +class ClientValidationsValidateResponseBodyRedeemablesItemResultGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateResponseBodyRedeemablesItemResultGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'credits' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'credits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'credits' => true + ]; + + /** + * 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 = [ + 'credits' => 'credits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'credits' => 'setCredits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'credits' => 'getCredits' + ]; + + /** + * 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('credits', $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 credits + * + * @return int|null + */ + public function getCredits() + { + return $this->container['credits']; + } + + /** + * Sets credits + * + * @param int|null $credits Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). + * + * @return self + */ + public function setCredits($credits) + { + if (is_null($credits)) { + array_push($this->openAPINullablesSetToNull, 'credits'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('credits', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['credits'] = $credits; + + 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/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.php b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.php new file mode 100644 index 0000000..dc3a41f --- /dev/null +++ b/src/Model/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.php @@ -0,0 +1,417 @@ + + */ +class ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total number of loyalty points to be applied in the redemption. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/CodeConfig.php b/src/Model/CodeConfig.php new file mode 100644 index 0000000..7818c4c --- /dev/null +++ b/src/Model/CodeConfig.php @@ -0,0 +1,623 @@ + + */ +class CodeConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CodeConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'length' => 'float', + 'charset' => 'string', + 'prefix' => 'string', + 'postfix' => 'string', + 'pattern' => 'string', + 'initialCount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'length' => null, + 'charset' => null, + 'prefix' => null, + 'postfix' => null, + 'pattern' => null, + 'initialCount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'length' => true, + 'charset' => true, + 'prefix' => true, + 'postfix' => true, + 'pattern' => true, + 'initialCount' => true + ]; + + /** + * 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 = [ + 'length' => 'length', + 'charset' => 'charset', + 'prefix' => 'prefix', + 'postfix' => 'postfix', + 'pattern' => 'pattern', + 'initialCount' => 'initial_count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'length' => 'setLength', + 'charset' => 'setCharset', + 'prefix' => 'setPrefix', + 'postfix' => 'setPostfix', + 'pattern' => 'setPattern', + 'initialCount' => 'setInitialCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'length' => 'getLength', + 'charset' => 'getCharset', + 'prefix' => 'getPrefix', + 'postfix' => 'getPostfix', + 'pattern' => 'getPattern', + 'initialCount' => 'getInitialCount' + ]; + + /** + * 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('length', $data ?? [], null); + $this->setIfExists('charset', $data ?? [], null); + $this->setIfExists('prefix', $data ?? [], null); + $this->setIfExists('postfix', $data ?? [], null); + $this->setIfExists('pattern', $data ?? [], null); + $this->setIfExists('initialCount', $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 length + * + * @return float|null + */ + public function getLength() + { + return $this->container['length']; + } + + /** + * Sets length + * + * @param float|null $length Number of characters in a generated code (excluding prefix and postfix). + * + * @return self + */ + public function setLength($length) + { + if (is_null($length)) { + array_push($this->openAPINullablesSetToNull, 'length'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('length', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['length'] = $length; + + return $this; + } + + /** + * Gets charset + * + * @return string|null + */ + public function getCharset() + { + return $this->container['charset']; + } + + /** + * Sets charset + * + * @param string|null $charset Characters that can appear in the code. Examples: - Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` - Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` - Numbers: `0123456789` - Custom: a custom character set + * + * @return self + */ + public function setCharset($charset) + { + if (is_null($charset)) { + array_push($this->openAPINullablesSetToNull, 'charset'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('charset', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['charset'] = $charset; + + return $this; + } + + /** + * Gets prefix + * + * @return string|null + */ + public function getPrefix() + { + return $this->container['prefix']; + } + + /** + * Sets prefix + * + * @param string|null $prefix A text appended before the code. + * + * @return self + */ + public function setPrefix($prefix) + { + if (is_null($prefix)) { + array_push($this->openAPINullablesSetToNull, 'prefix'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('prefix', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['prefix'] = $prefix; + + return $this; + } + + /** + * Gets postfix + * + * @return string|null + */ + public function getPostfix() + { + return $this->container['postfix']; + } + + /** + * Sets postfix + * + * @param string|null $postfix A text appended after the code. + * + * @return self + */ + public function setPostfix($postfix) + { + if (is_null($postfix)) { + array_push($this->openAPINullablesSetToNull, 'postfix'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postfix', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postfix'] = $postfix; + + return $this; + } + + /** + * Gets pattern + * + * @return string|null + */ + public function getPattern() + { + return $this->container['pattern']; + } + + /** + * Sets pattern + * + * @param string|null $pattern A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`. + * + * @return self + */ + public function setPattern($pattern) + { + if (is_null($pattern)) { + array_push($this->openAPINullablesSetToNull, 'pattern'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pattern', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pattern'] = $pattern; + + return $this; + } + + /** + * Gets initialCount + * + * @return int|null + */ + public function getInitialCount() + { + return $this->container['initialCount']; + } + + /** + * Sets initialCount + * + * @param int|null $initialCount Internal value, does not change anything if provided. + * + * @return self + */ + public function setInitialCount($initialCount) + { + if (is_null($initialCount)) { + array_push($this->openAPINullablesSetToNull, 'initialCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialCount'] = $initialCount; + + 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/CreatePublicationCampaign.php b/src/Model/CreatePublicationCampaign.php new file mode 100644 index 0000000..c147d74 --- /dev/null +++ b/src/Model/CreatePublicationCampaign.php @@ -0,0 +1,475 @@ + + */ +class CreatePublicationCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreatePublicationCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'count' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'count' => 'count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'count' => 'setCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'count' => 'getCount' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('count', $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 = []; + + if (!is_null($this->container['count']) && ($this->container['count'] > 20)) { + $invalidProperties[] = "invalid value for 'count', must be smaller than or equal to 20."; + } + + if (!is_null($this->container['count']) && ($this->container['count'] < 1)) { + $invalidProperties[] = "invalid value for 'count', must be bigger than or equal to 1."; + } + + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Number of vouchers to be published to customer. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($count) && ($count > 20)) { + throw new \InvalidArgumentException('invalid value for $count when calling CreatePublicationCampaign., must be smaller than or equal to 20.'); + } + if (!is_null($count) && ($count < 1)) { + throw new \InvalidArgumentException('invalid value for $count when calling CreatePublicationCampaign., must be bigger than or equal to 1.'); + } + + $this->container['count'] = $count; + + 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/Customer.php b/src/Model/Customer.php new file mode 100644 index 0000000..a9fdaf2 --- /dev/null +++ b/src/Model/Customer.php @@ -0,0 +1,786 @@ + + */ +class Customer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Customer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\CustomerAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\CustomerAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\CustomerAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomerActivity.php b/src/Model/CustomerActivity.php new file mode 100644 index 0000000..19a832a --- /dev/null +++ b/src/Model/CustomerActivity.php @@ -0,0 +1,582 @@ + + */ +class CustomerActivity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerActivity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'data' => 'object', + 'createdAt' => '\DateTime', + 'groupId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'data' => null, + 'createdAt' => 'date-time', + 'groupId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true, + 'data' => true, + 'createdAt' => true, + 'groupId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type', + 'data' => 'data', + 'createdAt' => 'created_at', + 'groupId' => 'group_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'data' => 'setData', + 'createdAt' => 'setCreatedAt', + 'groupId' => 'setGroupId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'data' => 'getData', + 'createdAt' => 'getCreatedAt', + 'groupId' => 'getGroupId' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('groupId', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique event ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Event type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets data + * + * @return object|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object|null $data Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the customer activity occurred in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets groupId + * + * @return string|null + */ + public function getGroupId() + { + return $this->container['groupId']; + } + + /** + * Sets groupId + * + * @param string|null $groupId Unique identifier of the request that caused the event. + * + * @return self + */ + public function setGroupId($groupId) + { + if (is_null($groupId)) { + array_push($this->openAPINullablesSetToNull, 'groupId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('groupId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['groupId'] = $groupId; + + 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/CustomerAddress.php b/src/Model/CustomerAddress.php new file mode 100644 index 0000000..ae3d0b2 --- /dev/null +++ b/src/Model/CustomerAddress.php @@ -0,0 +1,623 @@ + + */ +class CustomerAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/CustomerId.php b/src/Model/CustomerId.php new file mode 100644 index 0000000..9961f83 --- /dev/null +++ b/src/Model/CustomerId.php @@ -0,0 +1,490 @@ + + */ +class CustomerId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/CustomerLoyalty.php b/src/Model/CustomerLoyalty.php new file mode 100644 index 0000000..f8039b0 --- /dev/null +++ b/src/Model/CustomerLoyalty.php @@ -0,0 +1,499 @@ + + */ +class CustomerLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'referredCustomers' => 'int', + 'campaigns' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'referredCustomers' => null, + 'campaigns' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'referredCustomers' => true, + 'campaigns' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'referredCustomers' => 'referred_customers', + 'campaigns' => 'campaigns' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'referredCustomers' => 'setReferredCustomers', + 'campaigns' => 'setCampaigns' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'referredCustomers' => 'getReferredCustomers', + 'campaigns' => 'getCampaigns' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('referredCustomers', $data ?? [], null); + $this->setIfExists('campaigns', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Customer's loyalty points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets referredCustomers + * + * @return int|null + */ + public function getReferredCustomers() + { + return $this->container['referredCustomers']; + } + + /** + * Sets referredCustomers + * + * @param int|null $referredCustomers Total number of customers referred by the customer. + * + * @return self + */ + public function setReferredCustomers($referredCustomers) + { + if (is_null($referredCustomers)) { + array_push($this->openAPINullablesSetToNull, 'referredCustomers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referredCustomers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referredCustomers'] = $referredCustomers; + + return $this; + } + + /** + * Gets campaigns + * + * @return array|null + */ + public function getCampaigns() + { + return $this->container['campaigns']; + } + + /** + * Sets campaigns + * + * @param array|null $campaigns Contains campaigns with details about point balances and how many customers were referred by the customer. + * + * @return self + */ + public function setCampaigns($campaigns) + { + if (is_null($campaigns)) { + array_push($this->openAPINullablesSetToNull, 'campaigns'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaigns', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaigns'] = $campaigns; + + 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/CustomerLoyaltyCampaignsEntry.php b/src/Model/CustomerLoyaltyCampaignsEntry.php new file mode 100644 index 0000000..eaf9059 --- /dev/null +++ b/src/Model/CustomerLoyaltyCampaignsEntry.php @@ -0,0 +1,479 @@ + + */ +class CustomerLoyaltyCampaignsEntry implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerLoyaltyCampaignsEntry'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'loyaltyTier' => 'string', + 'referredCustomers' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'loyaltyTier' => null, + 'referredCustomers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => false, + 'loyaltyTier' => false, + 'referredCustomers' => 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 = [ + 'points' => 'points', + 'loyaltyTier' => 'loyalty_tier', + 'referredCustomers' => 'referred_customers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'loyaltyTier' => 'setLoyaltyTier', + 'referredCustomers' => 'setReferredCustomers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'loyaltyTier' => 'getLoyaltyTier', + 'referredCustomers' => 'getReferredCustomers' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('referredCustomers', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Remaining point balance in campaign. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + throw new \InvalidArgumentException('non-nullable points cannot be null'); + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return string|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param string|null $loyaltyTier Customer's loyalty tier within the campaign. + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + throw new \InvalidArgumentException('non-nullable loyaltyTier cannot be null'); + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets referredCustomers + * + * @return int|null + */ + public function getReferredCustomers() + { + return $this->container['referredCustomers']; + } + + /** + * Sets referredCustomers + * + * @param int|null $referredCustomers Number of customers referred by the customer in campaign. + * + * @return self + */ + public function setReferredCustomers($referredCustomers) + { + if (is_null($referredCustomers)) { + throw new \InvalidArgumentException('non-nullable referredCustomers cannot be null'); + } + $this->container['referredCustomers'] = $referredCustomers; + + 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/CustomerRedeemable.php b/src/Model/CustomerRedeemable.php new file mode 100644 index 0000000..3b42bd5 --- /dev/null +++ b/src/Model/CustomerRedeemable.php @@ -0,0 +1,903 @@ + + */ +class CustomerRedeemable implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerRedeemable'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'redeemableId' => 'string', + 'redeemableObject' => 'string', + 'customerId' => 'string', + 'holderRole' => 'string', + 'campaignId' => 'string', + 'campaignType' => 'string', + 'voucherType' => 'string', + 'redeemable' => '\OpenAPI\Client\Model\CustomerRedeemableRedeemable' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'redeemableId' => null, + 'redeemableObject' => null, + 'customerId' => null, + 'holderRole' => null, + 'campaignId' => null, + 'campaignType' => null, + 'voucherType' => null, + 'redeemable' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'redeemableId' => true, + 'redeemableObject' => true, + 'customerId' => true, + 'holderRole' => true, + 'campaignId' => true, + 'campaignType' => true, + 'voucherType' => true, + 'redeemable' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'redeemableId' => 'redeemable_id', + 'redeemableObject' => 'redeemable_object', + 'customerId' => 'customer_id', + 'holderRole' => 'holder_role', + 'campaignId' => 'campaign_id', + 'campaignType' => 'campaign_type', + 'voucherType' => 'voucher_type', + 'redeemable' => 'redeemable' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'redeemableId' => 'setRedeemableId', + 'redeemableObject' => 'setRedeemableObject', + 'customerId' => 'setCustomerId', + 'holderRole' => 'setHolderRole', + 'campaignId' => 'setCampaignId', + 'campaignType' => 'setCampaignType', + 'voucherType' => 'setVoucherType', + 'redeemable' => 'setRedeemable' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'redeemableId' => 'getRedeemableId', + 'redeemableObject' => 'getRedeemableObject', + 'customerId' => 'getCustomerId', + 'holderRole' => 'getHolderRole', + 'campaignId' => 'getCampaignId', + 'campaignType' => 'getCampaignType', + 'voucherType' => 'getVoucherType', + 'redeemable' => 'getRedeemable' + ]; + + /** + * 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 HOLDER_ROLE_OWNER = 'OWNER'; + public const HOLDER_ROLE_REFERRER = 'REFERRER'; + public const HOLDER_ROLE_REFEREE = 'REFEREE'; + public const CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const CAMPAIGN_TYPE_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const CAMPAIGN_TYPE_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const CAMPAIGN_TYPE_PROMOTION = 'PROMOTION'; + public const CAMPAIGN_TYPE_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const CAMPAIGN_TYPE_LUCKY_DRAW = 'LUCKY_DRAW'; + public const VOUCHER_TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const VOUCHER_TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const VOUCHER_TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VOUCHER_TYPE_LUCKY_DRAW_CODE = 'LUCKY_DRAW_CODE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHolderRoleAllowableValues() + { + return [ + self::HOLDER_ROLE_OWNER, + self::HOLDER_ROLE_REFERRER, + self::HOLDER_ROLE_REFEREE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + self::CAMPAIGN_TYPE_GIFT_VOUCHERS, + self::CAMPAIGN_TYPE_DISCOUNT_COUPONS, + self::CAMPAIGN_TYPE_PROMOTION, + self::CAMPAIGN_TYPE_REFERRAL_PROGRAM, + self::CAMPAIGN_TYPE_LUCKY_DRAW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVoucherTypeAllowableValues() + { + return [ + self::VOUCHER_TYPE_GIFT_VOUCHER, + self::VOUCHER_TYPE_DISCOUNT_VOUCHER, + self::VOUCHER_TYPE_LOYALTY_CARD, + self::VOUCHER_TYPE_LUCKY_DRAW_CODE, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('redeemableId', $data ?? [], null); + $this->setIfExists('redeemableObject', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('holderRole', $data ?? [], 'OWNER'); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], 'DISCOUNT_COUPONS'); + $this->setIfExists('voucherType', $data ?? [], 'DISCOUNT_VOUCHER'); + $this->setIfExists('redeemable', $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->getHolderRoleAllowableValues(); + if (!is_null($this->container['holderRole']) && !in_array($this->container['holderRole'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'holderRole', must be one of '%s'", + $this->container['holderRole'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVoucherTypeAllowableValues(); + if (!is_null($this->container['voucherType']) && !in_array($this->container['voucherType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'voucherType', must be one of '%s'", + $this->container['voucherType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redeemable holder identifier. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the redeemable was assigned. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets redeemableId + * + * @return string|null + */ + public function getRedeemableId() + { + return $this->container['redeemableId']; + } + + /** + * Sets redeemableId + * + * @param string|null $redeemableId Identifier of the redeemable item. + * + * @return self + */ + public function setRedeemableId($redeemableId) + { + if (is_null($redeemableId)) { + array_push($this->openAPINullablesSetToNull, 'redeemableId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemableId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemableId'] = $redeemableId; + + return $this; + } + + /** + * Gets redeemableObject + * + * @return string|null + */ + public function getRedeemableObject() + { + return $this->container['redeemableObject']; + } + + /** + * Sets redeemableObject + * + * @param string|null $redeemableObject Type of the redeemable. + * + * @return self + */ + public function setRedeemableObject($redeemableObject) + { + if (is_null($redeemableObject)) { + array_push($this->openAPINullablesSetToNull, 'redeemableObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemableObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemableObject'] = $redeemableObject; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Identifier of the customer. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets holderRole + * + * @return string|null + */ + public function getHolderRole() + { + return $this->container['holderRole']; + } + + /** + * Sets holderRole + * + * @param string|null $holderRole Role of the holder. + * + * @return self + */ + public function setHolderRole($holderRole) + { + if (is_null($holderRole)) { + array_push($this->openAPINullablesSetToNull, 'holderRole'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderRole', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getHolderRoleAllowableValues(); + if (!is_null($holderRole) && !in_array($holderRole, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'holderRole', must be one of '%s'", + $holderRole, + implode("', '", $allowedValues) + ) + ); + } + $this->container['holderRole'] = $holderRole; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Unique campaign identifier, assigned by Voucherify. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Defines the type of the campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets voucherType + * + * @return string|null + */ + public function getVoucherType() + { + return $this->container['voucherType']; + } + + /** + * Sets voucherType + * + * @param string|null $voucherType Defines the type of the voucher. + * + * @return self + */ + public function setVoucherType($voucherType) + { + if (is_null($voucherType)) { + array_push($this->openAPINullablesSetToNull, 'voucherType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVoucherTypeAllowableValues(); + if (!is_null($voucherType) && !in_array($voucherType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'voucherType', must be one of '%s'", + $voucherType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['voucherType'] = $voucherType; + + return $this; + } + + /** + * Gets redeemable + * + * @return \OpenAPI\Client\Model\CustomerRedeemableRedeemable|null + */ + public function getRedeemable() + { + return $this->container['redeemable']; + } + + /** + * Sets redeemable + * + * @param \OpenAPI\Client\Model\CustomerRedeemableRedeemable|null $redeemable redeemable + * + * @return self + */ + public function setRedeemable($redeemable) + { + if (is_null($redeemable)) { + array_push($this->openAPINullablesSetToNull, 'redeemable'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemable', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemable'] = $redeemable; + + 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/CustomerRedeemableRedeemable.php b/src/Model/CustomerRedeemableRedeemable.php new file mode 100644 index 0000000..3b2225c --- /dev/null +++ b/src/Model/CustomerRedeemableRedeemable.php @@ -0,0 +1,538 @@ + + */ +class CustomerRedeemableRedeemable implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerRedeemableRedeemable'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\RedeemableVoucher', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'voucher' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'voucher' => false, + 'status' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'voucher' => 'voucher', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'status' => 'getStatus' + ]; + + /** + * 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 STATUS_ACTIVE = 'ACTIVE'; + public const STATUS_USED = 'USED'; + public const STATUS_DISABLED = 'DISABLED'; + public const STATUS_NOT_ACTIVE_YET = 'NOT_ACTIVE_YET'; + public const STATUS_EXPIRED = 'EXPIRED'; + public const STATUS_NO_BALANCE = 'NO_BALANCE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_ACTIVE, + self::STATUS_USED, + self::STATUS_DISABLED, + self::STATUS_NOT_ACTIVE_YET, + self::STATUS_EXPIRED, + self::STATUS_NO_BALANCE, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('status', $data ?? [], 'ACTIVE'); + } + + /** + * 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 = []; + + if ($this->container['voucher'] === null) { + $invalidProperties[] = "'voucher' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of the redeemable. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\RedeemableVoucher + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\RedeemableVoucher $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the redeemable. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/CustomerReferrals.php b/src/Model/CustomerReferrals.php new file mode 100644 index 0000000..37588eb --- /dev/null +++ b/src/Model/CustomerReferrals.php @@ -0,0 +1,459 @@ + + */ +class CustomerReferrals implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerReferrals'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'total' => 'int', + 'campaigns' => '\OpenAPI\Client\Model\CustomerReferralsCampaignsItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'total' => null, + 'campaigns' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => true, + 'campaigns' => true + ]; + + /** + * 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 = [ + 'total' => 'total', + 'campaigns' => 'campaigns' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'total' => 'setTotal', + 'campaigns' => 'setCampaigns' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'total' => 'getTotal', + 'campaigns' => 'getCampaigns' + ]; + + /** + * 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('total', $data ?? [], null); + $this->setIfExists('campaigns', $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 total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of times this customer received a referral, i.e. was referred by another customer. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets campaigns + * + * @return \OpenAPI\Client\Model\CustomerReferralsCampaignsItem[]|null + */ + public function getCampaigns() + { + return $this->container['campaigns']; + } + + /** + * Sets campaigns + * + * @param \OpenAPI\Client\Model\CustomerReferralsCampaignsItem[]|null $campaigns Contains an array of campaigns that served as the source of a referral for the customer. + * + * @return self + */ + public function setCampaigns($campaigns) + { + if (is_null($campaigns)) { + array_push($this->openAPINullablesSetToNull, 'campaigns'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaigns', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaigns'] = $campaigns; + + 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/CustomerReferralsCampaignsItem.php b/src/Model/CustomerReferralsCampaignsItem.php new file mode 100644 index 0000000..60be455 --- /dev/null +++ b/src/Model/CustomerReferralsCampaignsItem.php @@ -0,0 +1,562 @@ + + */ +class CustomerReferralsCampaignsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerReferralsCampaignsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'campaignId' => 'string', + 'referrerId' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'campaignId' => null, + 'referrerId' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'campaignId' => false, + 'referrerId' => false, + 'relatedObjectId' => false, + 'relatedObjectType' => false, + 'date' => 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 = [ + 'campaignId' => 'campaign_id', + 'referrerId' => 'referrer_id', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'campaignId' => 'setCampaignId', + 'referrerId' => 'setReferrerId', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'campaignId' => 'getCampaignId', + 'referrerId' => 'getReferrerId', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'date' => 'getDate' + ]; + + /** + * 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('campaignId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('date', $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 = []; + + if ($this->container['campaignId'] === null) { + $invalidProperties[] = "'campaignId' can't be null"; + } + if ($this->container['referrerId'] === null) { + $invalidProperties[] = "'referrerId' can't be null"; + } + if ($this->container['relatedObjectId'] === null) { + $invalidProperties[] = "'relatedObjectId' can't be null"; + } + if ($this->container['relatedObjectType'] === null) { + $invalidProperties[] = "'relatedObjectType' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + 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 campaignId + * + * @return string + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string $campaignId Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + throw new \InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string $referrerId Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + throw new \InvalidArgumentException('non-nullable referrerId cannot be null'); + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string $relatedObjectId Related object id + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + throw new \InvalidArgumentException('non-nullable relatedObjectId cannot be null'); + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string $relatedObjectType Related object type, i.e. `redemption`. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + throw new \InvalidArgumentException('non-nullable relatedObjectType cannot be null'); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime $date Timestamp representing the date and time when the customer was referred in ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/CustomerSummary.php b/src/Model/CustomerSummary.php new file mode 100644 index 0000000..577fae6 --- /dev/null +++ b/src/Model/CustomerSummary.php @@ -0,0 +1,450 @@ + + */ +class CustomerSummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\CustomerSummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\CustomerSummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => false, + 'orders' => 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 = []; + + if ($this->container['redemptions'] === null) { + $invalidProperties[] = "'redemptions' can't be null"; + } + if ($this->container['orders'] === null) { + $invalidProperties[] = "'orders' can't be null"; + } + 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 redemptions + * + * @return \OpenAPI\Client\Model\CustomerSummaryRedemptions + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\CustomerSummaryRedemptions $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + throw new \InvalidArgumentException('non-nullable redemptions cannot be null'); + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\CustomerSummaryOrders + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\CustomerSummaryOrders $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + throw new \InvalidArgumentException('non-nullable orders cannot be null'); + } + $this->container['orders'] = $orders; + + 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/CustomerSummaryOrders.php b/src/Model/CustomerSummaryOrders.php new file mode 100644 index 0000000..929d54f --- /dev/null +++ b/src/Model/CustomerSummaryOrders.php @@ -0,0 +1,581 @@ + + */ +class CustomerSummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerSummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalCount' => 'int', + 'averageAmount' => 'int', + 'lastOrderAmount' => 'int', + 'lastOrderDate' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalCount' => null, + 'averageAmount' => null, + 'lastOrderAmount' => null, + 'lastOrderDate' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalCount' => true, + 'averageAmount' => true, + 'lastOrderAmount' => true, + 'lastOrderDate' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalCount' => 'total_count', + 'averageAmount' => 'average_amount', + 'lastOrderAmount' => 'last_order_amount', + 'lastOrderDate' => 'last_order_date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalCount' => 'setTotalCount', + 'averageAmount' => 'setAverageAmount', + 'lastOrderAmount' => 'setLastOrderAmount', + 'lastOrderDate' => 'setLastOrderDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalCount' => 'getTotalCount', + 'averageAmount' => 'getAverageAmount', + 'lastOrderAmount' => 'getLastOrderAmount', + 'lastOrderDate' => 'getLastOrderDate' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalCount', $data ?? [], null); + $this->setIfExists('averageAmount', $data ?? [], null); + $this->setIfExists('lastOrderAmount', $data ?? [], null); + $this->setIfExists('lastOrderDate', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalCount + * + * @return int|null + */ + public function getTotalCount() + { + return $this->container['totalCount']; + } + + /** + * Sets totalCount + * + * @param int|null $totalCount Total number of orders made by the customer. + * + * @return self + */ + public function setTotalCount($totalCount) + { + if (is_null($totalCount)) { + array_push($this->openAPINullablesSetToNull, 'totalCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalCount'] = $totalCount; + + return $this; + } + + /** + * Gets averageAmount + * + * @return int|null + */ + public function getAverageAmount() + { + return $this->container['averageAmount']; + } + + /** + * Sets averageAmount + * + * @param int|null $averageAmount Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setAverageAmount($averageAmount) + { + if (is_null($averageAmount)) { + array_push($this->openAPINullablesSetToNull, 'averageAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('averageAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['averageAmount'] = $averageAmount; + + return $this; + } + + /** + * Gets lastOrderAmount + * + * @return int|null + */ + public function getLastOrderAmount() + { + return $this->container['lastOrderAmount']; + } + + /** + * Sets lastOrderAmount + * + * @param int|null $lastOrderAmount Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setLastOrderAmount($lastOrderAmount) + { + if (is_null($lastOrderAmount)) { + array_push($this->openAPINullablesSetToNull, 'lastOrderAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastOrderAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lastOrderAmount'] = $lastOrderAmount; + + return $this; + } + + /** + * Gets lastOrderDate + * + * @return \DateTime|null + */ + public function getLastOrderDate() + { + return $this->container['lastOrderDate']; + } + + /** + * Sets lastOrderDate + * + * @param \DateTime|null $lastOrderDate Timestamp representing the date and time of the customer's last order in ISO 8601 format. + * + * @return self + */ + public function setLastOrderDate($lastOrderDate) + { + if (is_null($lastOrderDate)) { + array_push($this->openAPINullablesSetToNull, 'lastOrderDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastOrderDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lastOrderDate'] = $lastOrderDate; + + 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/CustomerSummaryRedemptions.php b/src/Model/CustomerSummaryRedemptions.php new file mode 100644 index 0000000..834b968 --- /dev/null +++ b/src/Model/CustomerSummaryRedemptions.php @@ -0,0 +1,704 @@ + + */ +class CustomerSummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerSummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int', + 'totalFailed' => 'int', + 'totalSucceeded' => 'int', + 'totalRolledBack' => 'int', + 'totalRollbackFailed' => 'int', + 'totalRollbackSucceeded' => 'int', + 'gift' => '\OpenAPI\Client\Model\CustomerSummaryRedemptionsGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\CustomerSummaryRedemptionsLoyaltyCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null, + 'totalFailed' => null, + 'totalSucceeded' => null, + 'totalRolledBack' => null, + 'totalRollbackFailed' => null, + 'totalRollbackSucceeded' => null, + 'gift' => null, + 'loyaltyCard' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true, + 'totalFailed' => true, + 'totalSucceeded' => true, + 'totalRolledBack' => true, + 'totalRollbackFailed' => true, + 'totalRollbackSucceeded' => true, + 'gift' => true, + 'loyaltyCard' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed', + 'totalFailed' => 'total_failed', + 'totalSucceeded' => 'total_succeeded', + 'totalRolledBack' => 'total_rolled_back', + 'totalRollbackFailed' => 'total_rollback_failed', + 'totalRollbackSucceeded' => 'total_rollback_succeeded', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed', + 'totalFailed' => 'setTotalFailed', + 'totalSucceeded' => 'setTotalSucceeded', + 'totalRolledBack' => 'setTotalRolledBack', + 'totalRollbackFailed' => 'setTotalRollbackFailed', + 'totalRollbackSucceeded' => 'setTotalRollbackSucceeded', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed', + 'totalFailed' => 'getTotalFailed', + 'totalSucceeded' => 'getTotalSucceeded', + 'totalRolledBack' => 'getTotalRolledBack', + 'totalRollbackFailed' => 'getTotalRollbackFailed', + 'totalRollbackSucceeded' => 'getTotalRollbackSucceeded', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard' + ]; + + /** + * 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('totalRedeemed', $data ?? [], null); + $this->setIfExists('totalFailed', $data ?? [], null); + $this->setIfExists('totalSucceeded', $data ?? [], null); + $this->setIfExists('totalRolledBack', $data ?? [], null); + $this->setIfExists('totalRollbackFailed', $data ?? [], null); + $this->setIfExists('totalRollbackSucceeded', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Total number of redemptions made by the customer. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + return $this; + } + + /** + * Gets totalFailed + * + * @return int|null + */ + public function getTotalFailed() + { + return $this->container['totalFailed']; + } + + /** + * Sets totalFailed + * + * @param int|null $totalFailed Total number of redemptions that failed. + * + * @return self + */ + public function setTotalFailed($totalFailed) + { + if (is_null($totalFailed)) { + array_push($this->openAPINullablesSetToNull, 'totalFailed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalFailed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalFailed'] = $totalFailed; + + return $this; + } + + /** + * Gets totalSucceeded + * + * @return int|null + */ + public function getTotalSucceeded() + { + return $this->container['totalSucceeded']; + } + + /** + * Sets totalSucceeded + * + * @param int|null $totalSucceeded Total number of redemptions that succeeded. + * + * @return self + */ + public function setTotalSucceeded($totalSucceeded) + { + if (is_null($totalSucceeded)) { + array_push($this->openAPINullablesSetToNull, 'totalSucceeded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalSucceeded', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalSucceeded'] = $totalSucceeded; + + return $this; + } + + /** + * Gets totalRolledBack + * + * @return int|null + */ + public function getTotalRolledBack() + { + return $this->container['totalRolledBack']; + } + + /** + * Sets totalRolledBack + * + * @param int|null $totalRolledBack Total number of redemptions that were rolled back for the customer. + * + * @return self + */ + public function setTotalRolledBack($totalRolledBack) + { + if (is_null($totalRolledBack)) { + array_push($this->openAPINullablesSetToNull, 'totalRolledBack'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRolledBack', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRolledBack'] = $totalRolledBack; + + return $this; + } + + /** + * Gets totalRollbackFailed + * + * @return int|null + */ + public function getTotalRollbackFailed() + { + return $this->container['totalRollbackFailed']; + } + + /** + * Sets totalRollbackFailed + * + * @param int|null $totalRollbackFailed Total number of redemption rollbacks that failed. + * + * @return self + */ + public function setTotalRollbackFailed($totalRollbackFailed) + { + if (is_null($totalRollbackFailed)) { + array_push($this->openAPINullablesSetToNull, 'totalRollbackFailed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRollbackFailed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRollbackFailed'] = $totalRollbackFailed; + + return $this; + } + + /** + * Gets totalRollbackSucceeded + * + * @return int|null + */ + public function getTotalRollbackSucceeded() + { + return $this->container['totalRollbackSucceeded']; + } + + /** + * Sets totalRollbackSucceeded + * + * @param int|null $totalRollbackSucceeded Total number of redemption rollbacks that succeeded. + * + * @return self + */ + public function setTotalRollbackSucceeded($totalRollbackSucceeded) + { + if (is_null($totalRollbackSucceeded)) { + array_push($this->openAPINullablesSetToNull, 'totalRollbackSucceeded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRollbackSucceeded', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRollbackSucceeded'] = $totalRollbackSucceeded; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\CustomerSummaryRedemptionsGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\CustomerSummaryRedemptionsGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\CustomerSummaryRedemptionsLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\CustomerSummaryRedemptionsLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + 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/CustomerSummaryRedemptionsGift.php b/src/Model/CustomerSummaryRedemptionsGift.php new file mode 100644 index 0000000..30585e4 --- /dev/null +++ b/src/Model/CustomerSummaryRedemptionsGift.php @@ -0,0 +1,459 @@ + + */ +class CustomerSummaryRedemptionsGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerSummaryRedemptionsGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redeemedAmount' => 'int', + 'amountToGo' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redeemedAmount' => null, + 'amountToGo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redeemedAmount' => true, + 'amountToGo' => true + ]; + + /** + * 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 = [ + 'redeemedAmount' => 'redeemed_amount', + 'amountToGo' => 'amount_to_go' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redeemedAmount' => 'setRedeemedAmount', + 'amountToGo' => 'setAmountToGo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redeemedAmount' => 'getRedeemedAmount', + 'amountToGo' => 'getAmountToGo' + ]; + + /** + * 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('redeemedAmount', $data ?? [], 0); + $this->setIfExists('amountToGo', $data ?? [], 0); + } + + /** + * 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 redeemedAmount + * + * @return int|null + */ + public function getRedeemedAmount() + { + return $this->container['redeemedAmount']; + } + + /** + * Sets redeemedAmount + * + * @param int|null $redeemedAmount Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setRedeemedAmount($redeemedAmount) + { + if (is_null($redeemedAmount)) { + array_push($this->openAPINullablesSetToNull, 'redeemedAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedAmount'] = $redeemedAmount; + + return $this; + } + + /** + * Gets amountToGo + * + * @return int|null + */ + public function getAmountToGo() + { + return $this->container['amountToGo']; + } + + /** + * Sets amountToGo + * + * @param int|null $amountToGo Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setAmountToGo($amountToGo) + { + if (is_null($amountToGo)) { + array_push($this->openAPINullablesSetToNull, 'amountToGo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountToGo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountToGo'] = $amountToGo; + + 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/CustomerSummaryRedemptionsLoyaltyCard.php b/src/Model/CustomerSummaryRedemptionsLoyaltyCard.php new file mode 100644 index 0000000..d139429 --- /dev/null +++ b/src/Model/CustomerSummaryRedemptionsLoyaltyCard.php @@ -0,0 +1,459 @@ + + */ +class CustomerSummaryRedemptionsLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerSummaryRedemptionsLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redeemedPoints' => 'int', + 'pointsToGo' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redeemedPoints' => null, + 'pointsToGo' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redeemedPoints' => true, + 'pointsToGo' => true + ]; + + /** + * 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 = [ + 'redeemedPoints' => 'redeemed_points', + 'pointsToGo' => 'points_to_go' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redeemedPoints' => 'setRedeemedPoints', + 'pointsToGo' => 'setPointsToGo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redeemedPoints' => 'getRedeemedPoints', + 'pointsToGo' => 'getPointsToGo' + ]; + + /** + * 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('redeemedPoints', $data ?? [], null); + $this->setIfExists('pointsToGo', $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 redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total number of loyalty points redeemed by the customer. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets pointsToGo + * + * @return int|null + */ + public function getPointsToGo() + { + return $this->container['pointsToGo']; + } + + /** + * Sets pointsToGo + * + * @param int|null $pointsToGo Sum of remaining available point balance across all loyalty cards. + * + * @return self + */ + public function setPointsToGo($pointsToGo) + { + if (is_null($pointsToGo)) { + array_push($this->openAPINullablesSetToNull, 'pointsToGo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pointsToGo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pointsToGo'] = $pointsToGo; + + 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/CustomerWithSummaryLoyaltyReferrals.php b/src/Model/CustomerWithSummaryLoyaltyReferrals.php new file mode 100644 index 0000000..6a67af6 --- /dev/null +++ b/src/Model/CustomerWithSummaryLoyaltyReferrals.php @@ -0,0 +1,1125 @@ + + */ +class CustomerWithSummaryLoyaltyReferrals implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerWithSummaryLoyaltyReferrals'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'summary' => '\OpenAPI\Client\Model\CustomerSummary', + 'loyalty' => '\OpenAPI\Client\Model\CustomerLoyalty', + 'referrals' => '\OpenAPI\Client\Model\CustomerReferrals', + 'systemMetadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'assets' => '\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferralsAssets', + 'object' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferralsAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'summary' => null, + 'loyalty' => null, + 'referrals' => null, + 'systemMetadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'assets' => null, + 'object' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'summary' => false, + 'loyalty' => false, + 'referrals' => false, + 'systemMetadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'assets' => true, + 'object' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'summary' => 'summary', + 'loyalty' => 'loyalty', + 'referrals' => 'referrals', + 'systemMetadata' => 'system_metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'assets' => 'assets', + 'object' => 'object', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'summary' => 'setSummary', + 'loyalty' => 'setLoyalty', + 'referrals' => 'setReferrals', + 'systemMetadata' => 'setSystemMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'assets' => 'setAssets', + 'object' => 'setObject', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'summary' => 'getSummary', + 'loyalty' => 'getLoyalty', + 'referrals' => 'getReferrals', + 'systemMetadata' => 'getSystemMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'assets' => 'getAssets', + 'object' => 'getObject', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('referrals', $data ?? [], null); + $this->setIfExists('systemMetadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of an existing customer that will be linked to redemption in this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\CustomerSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\CustomerSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + throw new \InvalidArgumentException('non-nullable summary cannot be null'); + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\CustomerLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\CustomerLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + throw new \InvalidArgumentException('non-nullable loyalty cannot be null'); + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets referrals + * + * @return \OpenAPI\Client\Model\CustomerReferrals|null + */ + public function getReferrals() + { + return $this->container['referrals']; + } + + /** + * Sets referrals + * + * @param \OpenAPI\Client\Model\CustomerReferrals|null $referrals referrals + * + * @return self + */ + public function setReferrals($referrals) + { + if (is_null($referrals)) { + throw new \InvalidArgumentException('non-nullable referrals cannot be null'); + } + $this->container['referrals'] = $referrals; + + return $this; + } + + /** + * Gets systemMetadata + * + * @return object|null + */ + public function getSystemMetadata() + { + return $this->container['systemMetadata']; + } + + /** + * Sets systemMetadata + * + * @param object|null $systemMetadata Object used to store system metadata information. + * + * @return self + */ + public function setSystemMetadata($systemMetadata) + { + if (is_null($systemMetadata)) { + array_push($this->openAPINullablesSetToNull, 'systemMetadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('systemMetadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['systemMetadata'] = $systemMetadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferralsAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferralsAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + array_push($this->openAPINullablesSetToNull, 'assets'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assets', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferralsAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferralsAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomerWithSummaryLoyaltyReferralsAddress.php b/src/Model/CustomerWithSummaryLoyaltyReferralsAddress.php new file mode 100644 index 0000000..98ce871 --- /dev/null +++ b/src/Model/CustomerWithSummaryLoyaltyReferralsAddress.php @@ -0,0 +1,623 @@ + + */ +class CustomerWithSummaryLoyaltyReferralsAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerWithSummaryLoyaltyReferralsAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/CustomerWithSummaryLoyaltyReferralsAssets.php b/src/Model/CustomerWithSummaryLoyaltyReferralsAssets.php new file mode 100644 index 0000000..43d942e --- /dev/null +++ b/src/Model/CustomerWithSummaryLoyaltyReferralsAssets.php @@ -0,0 +1,418 @@ + + */ +class CustomerWithSummaryLoyaltyReferralsAssets implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomerWithSummaryLoyaltyReferralsAssets'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cockpitUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cockpitUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'cockpitUrl' => true + ]; + + /** + * 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 = [ + 'cockpitUrl' => 'cockpit_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cockpitUrl' => 'setCockpitUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cockpitUrl' => 'getCockpitUrl' + ]; + + /** + * 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('cockpitUrl', $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 cockpitUrl + * + * @return string|null + */ + public function getCockpitUrl() + { + return $this->container['cockpitUrl']; + } + + /** + * Sets cockpitUrl + * + * @param string|null $cockpitUrl Customer's cockpit URL address. + * + * @return self + */ + public function setCockpitUrl($cockpitUrl) + { + if (is_null($cockpitUrl)) { + array_push($this->openAPINullablesSetToNull, 'cockpitUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cockpitUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cockpitUrl'] = $cockpitUrl; + + 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/CustomersActivityListResponseBody.php b/src/Model/CustomersActivityListResponseBody.php new file mode 100644 index 0000000..ae18036 --- /dev/null +++ b/src/Model/CustomersActivityListResponseBody.php @@ -0,0 +1,614 @@ + + */ +class CustomersActivityListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersActivityListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\CustomerActivity[]', + 'hasMore' => 'bool', + 'moreStartingAfter' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'hasMore' => null, + 'moreStartingAfter' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'hasMore' => true, + 'moreStartingAfter' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'hasMore' => 'has_more', + 'moreStartingAfter' => 'more_starting_after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'hasMore' => 'setHasMore', + 'moreStartingAfter' => 'setMoreStartingAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'hasMore' => 'getHasMore', + 'moreStartingAfter' => 'getMoreStartingAfter' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('hasMore', $data ?? [], null); + $this->setIfExists('moreStartingAfter', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about customer activities in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of customer activity objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\CustomerActivity[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\CustomerActivity[]|null $data Array of customer activity objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + return $this; + } + + /** + * Gets moreStartingAfter + * + * @return string|null + */ + public function getMoreStartingAfter() + { + return $this->container['moreStartingAfter']; + } + + /** + * Sets moreStartingAfter + * + * @param string|null $moreStartingAfter Returns an ID that can be used to return another page of results. Use the event id in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. + * + * @return self + */ + public function setMoreStartingAfter($moreStartingAfter) + { + if (is_null($moreStartingAfter)) { + array_push($this->openAPINullablesSetToNull, 'moreStartingAfter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreStartingAfter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreStartingAfter'] = $moreStartingAfter; + + 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/CustomersCreateRequestBody.php b/src/Model/CustomersCreateRequestBody.php new file mode 100644 index 0000000..4865d87 --- /dev/null +++ b/src/Model/CustomersCreateRequestBody.php @@ -0,0 +1,787 @@ + + */ +class CustomersCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\CustomersCreateRequestBodyAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\CustomersCreateRequestBodyAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\CustomersCreateRequestBodyAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomersCreateRequestBodyAddress.php b/src/Model/CustomersCreateRequestBodyAddress.php new file mode 100644 index 0000000..7744cc9 --- /dev/null +++ b/src/Model/CustomersCreateRequestBodyAddress.php @@ -0,0 +1,623 @@ + + */ +class CustomersCreateRequestBodyAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersCreateRequestBodyAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/CustomersCreateResponseBody.php b/src/Model/CustomersCreateResponseBody.php new file mode 100644 index 0000000..22c1db6 --- /dev/null +++ b/src/Model/CustomersCreateResponseBody.php @@ -0,0 +1,1126 @@ + + */ +class CustomersCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'summary' => '\OpenAPI\Client\Model\CustomerSummary', + 'loyalty' => '\OpenAPI\Client\Model\CustomerLoyalty', + 'referrals' => '\OpenAPI\Client\Model\CustomerReferrals', + 'systemMetadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'assets' => '\OpenAPI\Client\Model\CustomersCreateResponseBodyAssets', + 'object' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\CustomersCreateResponseBodyAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'summary' => null, + 'loyalty' => null, + 'referrals' => null, + 'systemMetadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'assets' => null, + 'object' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'summary' => false, + 'loyalty' => false, + 'referrals' => false, + 'systemMetadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'assets' => true, + 'object' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'summary' => 'summary', + 'loyalty' => 'loyalty', + 'referrals' => 'referrals', + 'systemMetadata' => 'system_metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'assets' => 'assets', + 'object' => 'object', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'summary' => 'setSummary', + 'loyalty' => 'setLoyalty', + 'referrals' => 'setReferrals', + 'systemMetadata' => 'setSystemMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'assets' => 'setAssets', + 'object' => 'setObject', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'summary' => 'getSummary', + 'loyalty' => 'getLoyalty', + 'referrals' => 'getReferrals', + 'systemMetadata' => 'getSystemMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'assets' => 'getAssets', + 'object' => 'getObject', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('referrals', $data ?? [], null); + $this->setIfExists('systemMetadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of an existing customer that will be linked to redemption in this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\CustomerSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\CustomerSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + throw new \InvalidArgumentException('non-nullable summary cannot be null'); + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\CustomerLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\CustomerLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + throw new \InvalidArgumentException('non-nullable loyalty cannot be null'); + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets referrals + * + * @return \OpenAPI\Client\Model\CustomerReferrals|null + */ + public function getReferrals() + { + return $this->container['referrals']; + } + + /** + * Sets referrals + * + * @param \OpenAPI\Client\Model\CustomerReferrals|null $referrals referrals + * + * @return self + */ + public function setReferrals($referrals) + { + if (is_null($referrals)) { + throw new \InvalidArgumentException('non-nullable referrals cannot be null'); + } + $this->container['referrals'] = $referrals; + + return $this; + } + + /** + * Gets systemMetadata + * + * @return object|null + */ + public function getSystemMetadata() + { + return $this->container['systemMetadata']; + } + + /** + * Sets systemMetadata + * + * @param object|null $systemMetadata Object used to store system metadata information. + * + * @return self + */ + public function setSystemMetadata($systemMetadata) + { + if (is_null($systemMetadata)) { + array_push($this->openAPINullablesSetToNull, 'systemMetadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('systemMetadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['systemMetadata'] = $systemMetadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\CustomersCreateResponseBodyAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\CustomersCreateResponseBodyAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + array_push($this->openAPINullablesSetToNull, 'assets'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assets', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\CustomersCreateResponseBodyAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\CustomersCreateResponseBodyAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomersCreateResponseBodyAddress.php b/src/Model/CustomersCreateResponseBodyAddress.php new file mode 100644 index 0000000..5b84256 --- /dev/null +++ b/src/Model/CustomersCreateResponseBodyAddress.php @@ -0,0 +1,623 @@ + + */ +class CustomersCreateResponseBodyAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersCreateResponseBodyAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/CustomersCreateResponseBodyAssets.php b/src/Model/CustomersCreateResponseBodyAssets.php new file mode 100644 index 0000000..bd9c575 --- /dev/null +++ b/src/Model/CustomersCreateResponseBodyAssets.php @@ -0,0 +1,418 @@ + + */ +class CustomersCreateResponseBodyAssets implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersCreateResponseBodyAssets'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cockpitUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cockpitUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'cockpitUrl' => true + ]; + + /** + * 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 = [ + 'cockpitUrl' => 'cockpit_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cockpitUrl' => 'setCockpitUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cockpitUrl' => 'getCockpitUrl' + ]; + + /** + * 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('cockpitUrl', $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 cockpitUrl + * + * @return string|null + */ + public function getCockpitUrl() + { + return $this->container['cockpitUrl']; + } + + /** + * Sets cockpitUrl + * + * @param string|null $cockpitUrl Customer's cockpit URL address. + * + * @return self + */ + public function setCockpitUrl($cockpitUrl) + { + if (is_null($cockpitUrl)) { + array_push($this->openAPINullablesSetToNull, 'cockpitUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cockpitUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cockpitUrl'] = $cockpitUrl; + + 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/CustomersGetResponseBody.php b/src/Model/CustomersGetResponseBody.php new file mode 100644 index 0000000..87bd6df --- /dev/null +++ b/src/Model/CustomersGetResponseBody.php @@ -0,0 +1,1126 @@ + + */ +class CustomersGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'summary' => '\OpenAPI\Client\Model\CustomerSummary', + 'loyalty' => '\OpenAPI\Client\Model\CustomerLoyalty', + 'referrals' => '\OpenAPI\Client\Model\CustomerReferrals', + 'systemMetadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'assets' => '\OpenAPI\Client\Model\CustomersGetResponseBodyAssets', + 'object' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\CustomersGetResponseBodyAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'summary' => null, + 'loyalty' => null, + 'referrals' => null, + 'systemMetadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'assets' => null, + 'object' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'summary' => false, + 'loyalty' => false, + 'referrals' => false, + 'systemMetadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'assets' => true, + 'object' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'summary' => 'summary', + 'loyalty' => 'loyalty', + 'referrals' => 'referrals', + 'systemMetadata' => 'system_metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'assets' => 'assets', + 'object' => 'object', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'summary' => 'setSummary', + 'loyalty' => 'setLoyalty', + 'referrals' => 'setReferrals', + 'systemMetadata' => 'setSystemMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'assets' => 'setAssets', + 'object' => 'setObject', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'summary' => 'getSummary', + 'loyalty' => 'getLoyalty', + 'referrals' => 'getReferrals', + 'systemMetadata' => 'getSystemMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'assets' => 'getAssets', + 'object' => 'getObject', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('referrals', $data ?? [], null); + $this->setIfExists('systemMetadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of an existing customer that will be linked to redemption in this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\CustomerSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\CustomerSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + throw new \InvalidArgumentException('non-nullable summary cannot be null'); + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\CustomerLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\CustomerLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + throw new \InvalidArgumentException('non-nullable loyalty cannot be null'); + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets referrals + * + * @return \OpenAPI\Client\Model\CustomerReferrals|null + */ + public function getReferrals() + { + return $this->container['referrals']; + } + + /** + * Sets referrals + * + * @param \OpenAPI\Client\Model\CustomerReferrals|null $referrals referrals + * + * @return self + */ + public function setReferrals($referrals) + { + if (is_null($referrals)) { + throw new \InvalidArgumentException('non-nullable referrals cannot be null'); + } + $this->container['referrals'] = $referrals; + + return $this; + } + + /** + * Gets systemMetadata + * + * @return object|null + */ + public function getSystemMetadata() + { + return $this->container['systemMetadata']; + } + + /** + * Sets systemMetadata + * + * @param object|null $systemMetadata Object used to store system metadata information. + * + * @return self + */ + public function setSystemMetadata($systemMetadata) + { + if (is_null($systemMetadata)) { + array_push($this->openAPINullablesSetToNull, 'systemMetadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('systemMetadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['systemMetadata'] = $systemMetadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\CustomersGetResponseBodyAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\CustomersGetResponseBodyAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + array_push($this->openAPINullablesSetToNull, 'assets'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assets', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\CustomersGetResponseBodyAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\CustomersGetResponseBodyAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomersGetResponseBodyAddress.php b/src/Model/CustomersGetResponseBodyAddress.php new file mode 100644 index 0000000..56f934f --- /dev/null +++ b/src/Model/CustomersGetResponseBodyAddress.php @@ -0,0 +1,623 @@ + + */ +class CustomersGetResponseBodyAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersGetResponseBodyAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/CustomersGetResponseBodyAssets.php b/src/Model/CustomersGetResponseBodyAssets.php new file mode 100644 index 0000000..9880194 --- /dev/null +++ b/src/Model/CustomersGetResponseBodyAssets.php @@ -0,0 +1,418 @@ + + */ +class CustomersGetResponseBodyAssets implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersGetResponseBodyAssets'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cockpitUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cockpitUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'cockpitUrl' => true + ]; + + /** + * 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 = [ + 'cockpitUrl' => 'cockpit_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cockpitUrl' => 'setCockpitUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cockpitUrl' => 'getCockpitUrl' + ]; + + /** + * 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('cockpitUrl', $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 cockpitUrl + * + * @return string|null + */ + public function getCockpitUrl() + { + return $this->container['cockpitUrl']; + } + + /** + * Sets cockpitUrl + * + * @param string|null $cockpitUrl Customer's cockpit URL address. + * + * @return self + */ + public function setCockpitUrl($cockpitUrl) + { + if (is_null($cockpitUrl)) { + array_push($this->openAPINullablesSetToNull, 'cockpitUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cockpitUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cockpitUrl'] = $cockpitUrl; + + 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/CustomersImportCsvCreateResponseBody.php b/src/Model/CustomersImportCsvCreateResponseBody.php new file mode 100644 index 0000000..b6b30f8 --- /dev/null +++ b/src/Model/CustomersImportCsvCreateResponseBody.php @@ -0,0 +1,418 @@ + + */ +class CustomersImportCsvCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersImportCsvCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/CustomersListResponseBody.php b/src/Model/CustomersListResponseBody.php new file mode 100644 index 0000000..81494c8 --- /dev/null +++ b/src/Model/CustomersListResponseBody.php @@ -0,0 +1,582 @@ + + */ +class CustomersListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'customers' => '\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals[]', + 'total' => 'int', + 'hasMore' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'customers' => null, + 'total' => null, + 'hasMore' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'customers' => true, + 'total' => true, + 'hasMore' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'customers' => 'customers', + 'total' => 'total', + 'hasMore' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'customers' => 'setCustomers', + 'total' => 'setTotal', + 'hasMore' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'customers' => 'getCustomers', + 'total' => 'getTotal', + 'hasMore' => 'getHasMore' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'customers'); + $this->setIfExists('customers', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('hasMore', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about customers in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of customer objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets customers + * + * @return \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals[]|null + */ + public function getCustomers() + { + return $this->container['customers']; + } + + /** + * Sets customers + * + * @param \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals[]|null $customers Contains array of customer objects. + * + * @return self + */ + public function setCustomers($customers) + { + if (is_null($customers)) { + array_push($this->openAPINullablesSetToNull, 'customers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customers'] = $customers; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of customers. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different end date filter) to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + 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/CustomersMetadataUpdateInBulkRequestBody.php b/src/Model/CustomersMetadataUpdateInBulkRequestBody.php new file mode 100644 index 0000000..c0d976c --- /dev/null +++ b/src/Model/CustomersMetadataUpdateInBulkRequestBody.php @@ -0,0 +1,459 @@ + + */ +class CustomersMetadataUpdateInBulkRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersMetadataUpdateInBulkRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sourceIds' => 'string[]', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sourceIds' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sourceIds' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'sourceIds' => 'source_ids', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sourceIds' => 'setSourceIds', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sourceIds' => 'getSourceIds', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('sourceIds', $data ?? [], null); + $this->setIfExists('metadata', $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 sourceIds + * + * @return string[]|null + */ + public function getSourceIds() + { + return $this->container['sourceIds']; + } + + /** + * Sets sourceIds + * + * @param string[]|null $sourceIds An array of customer `source_id`'s. + * + * @return self + */ + public function setSourceIds($sourceIds) + { + if (is_null($sourceIds)) { + array_push($this->openAPINullablesSetToNull, 'sourceIds'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceIds', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceIds'] = $sourceIds; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomersMetadataUpdateInBulkResponseBody.php b/src/Model/CustomersMetadataUpdateInBulkResponseBody.php new file mode 100644 index 0000000..965b9fc --- /dev/null +++ b/src/Model/CustomersMetadataUpdateInBulkResponseBody.php @@ -0,0 +1,418 @@ + + */ +class CustomersMetadataUpdateInBulkResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersMetadataUpdateInBulkResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/CustomersPermanentDeletionCreateResponseBody.php b/src/Model/CustomersPermanentDeletionCreateResponseBody.php new file mode 100644 index 0000000..4f75eff --- /dev/null +++ b/src/Model/CustomersPermanentDeletionCreateResponseBody.php @@ -0,0 +1,664 @@ + + */ +class CustomersPermanentDeletionCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersPermanentDeletionCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'relatedObjectId' => 'string', + 'relatedObject' => 'string', + 'status' => 'string', + 'dataJson' => '\OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBodyDataJson', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'relatedObjectId' => null, + 'relatedObject' => null, + 'status' => null, + 'dataJson' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'relatedObjectId' => true, + 'relatedObject' => true, + 'status' => true, + 'dataJson' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'relatedObjectId' => 'related_object_id', + 'relatedObject' => 'related_object', + 'status' => 'status', + 'dataJson' => 'data_json', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObject' => 'setRelatedObject', + 'status' => 'setStatus', + 'dataJson' => 'setDataJson', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObject' => 'getRelatedObject', + 'status' => 'getStatus', + 'dataJson' => 'getDataJson', + 'object' => 'getObject' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObject', $data ?? [], 'customer'); + $this->setIfExists('status', $data ?? [], 'DONE'); + $this->setIfExists('dataJson', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'pernament_deletion'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique permanent deletion object ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Unique customer ID that is being deleted. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObject + * + * @return string|null + */ + public function getRelatedObject() + { + return $this->container['relatedObject']; + } + + /** + * Sets relatedObject + * + * @param string|null $relatedObject Object being deleted. + * + * @return self + */ + public function setRelatedObject($relatedObject) + { + if (is_null($relatedObject)) { + array_push($this->openAPINullablesSetToNull, 'relatedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObject'] = $relatedObject; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Deletion status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets dataJson + * + * @return \OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBodyDataJson|null + */ + public function getDataJson() + { + return $this->container['dataJson']; + } + + /** + * Sets dataJson + * + * @param \OpenAPI\Client\Model\CustomersPermanentDeletionCreateResponseBodyDataJson|null $dataJson dataJson + * + * @return self + */ + public function setDataJson($dataJson) + { + if (is_null($dataJson)) { + array_push($this->openAPINullablesSetToNull, 'dataJson'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataJson', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataJson'] = $dataJson; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/CustomersPermanentDeletionCreateResponseBodyDataJson.php b/src/Model/CustomersPermanentDeletionCreateResponseBodyDataJson.php new file mode 100644 index 0000000..93b66ca --- /dev/null +++ b/src/Model/CustomersPermanentDeletionCreateResponseBodyDataJson.php @@ -0,0 +1,664 @@ + + */ +class CustomersPermanentDeletionCreateResponseBodyDataJson implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersPermanentDeletionCreateResponseBodyDataJson'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'events' => 'int', + 'customerEvents' => 'int', + 'dailyEvents' => 'int', + 'segments' => 'int', + 'orders' => 'int', + 'orderEvents' => 'int', + 'customer' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'events' => null, + 'customerEvents' => null, + 'dailyEvents' => null, + 'segments' => null, + 'orders' => null, + 'orderEvents' => null, + 'customer' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'events' => true, + 'customerEvents' => true, + 'dailyEvents' => true, + 'segments' => true, + 'orders' => true, + 'orderEvents' => true, + 'customer' => true + ]; + + /** + * 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 = [ + 'events' => 'events', + 'customerEvents' => 'customer_events', + 'dailyEvents' => 'daily_events', + 'segments' => 'segments', + 'orders' => 'orders', + 'orderEvents' => 'order_events', + 'customer' => 'customer' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'events' => 'setEvents', + 'customerEvents' => 'setCustomerEvents', + 'dailyEvents' => 'setDailyEvents', + 'segments' => 'setSegments', + 'orders' => 'setOrders', + 'orderEvents' => 'setOrderEvents', + 'customer' => 'setCustomer' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'events' => 'getEvents', + 'customerEvents' => 'getCustomerEvents', + 'dailyEvents' => 'getDailyEvents', + 'segments' => 'getSegments', + 'orders' => 'getOrders', + 'orderEvents' => 'getOrderEvents', + 'customer' => 'getCustomer' + ]; + + /** + * 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('events', $data ?? [], null); + $this->setIfExists('customerEvents', $data ?? [], null); + $this->setIfExists('dailyEvents', $data ?? [], null); + $this->setIfExists('segments', $data ?? [], null); + $this->setIfExists('orders', $data ?? [], null); + $this->setIfExists('orderEvents', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], 1); + } + + /** + * 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 events + * + * @return int|null + */ + public function getEvents() + { + return $this->container['events']; + } + + /** + * Sets events + * + * @param int|null $events Number of events deleted. + * + * @return self + */ + public function setEvents($events) + { + if (is_null($events)) { + array_push($this->openAPINullablesSetToNull, 'events'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('events', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['events'] = $events; + + return $this; + } + + /** + * Gets customerEvents + * + * @return int|null + */ + public function getCustomerEvents() + { + return $this->container['customerEvents']; + } + + /** + * Sets customerEvents + * + * @param int|null $customerEvents Number of customer events deleted. + * + * @return self + */ + public function setCustomerEvents($customerEvents) + { + if (is_null($customerEvents)) { + array_push($this->openAPINullablesSetToNull, 'customerEvents'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerEvents', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerEvents'] = $customerEvents; + + return $this; + } + + /** + * Gets dailyEvents + * + * @return int|null + */ + public function getDailyEvents() + { + return $this->container['dailyEvents']; + } + + /** + * Sets dailyEvents + * + * @param int|null $dailyEvents Number of daily events deleted. + * + * @return self + */ + public function setDailyEvents($dailyEvents) + { + if (is_null($dailyEvents)) { + array_push($this->openAPINullablesSetToNull, 'dailyEvents'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dailyEvents', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dailyEvents'] = $dailyEvents; + + return $this; + } + + /** + * Gets segments + * + * @return int|null + */ + public function getSegments() + { + return $this->container['segments']; + } + + /** + * Sets segments + * + * @param int|null $segments Number of segments deleted. + * + * @return self + */ + public function setSegments($segments) + { + if (is_null($segments)) { + array_push($this->openAPINullablesSetToNull, 'segments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segments', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segments'] = $segments; + + return $this; + } + + /** + * Gets orders + * + * @return int|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param int|null $orders Number of orders deleted. + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + return $this; + } + + /** + * Gets orderEvents + * + * @return int|null + */ + public function getOrderEvents() + { + return $this->container['orderEvents']; + } + + /** + * Sets orderEvents + * + * @param int|null $orderEvents Number of order events deleted. + * + * @return self + */ + public function setOrderEvents($orderEvents) + { + if (is_null($orderEvents)) { + array_push($this->openAPINullablesSetToNull, 'orderEvents'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderEvents', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderEvents'] = $orderEvents; + + return $this; + } + + /** + * Gets customer + * + * @return int|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param int|null $customer Number of customers deleted. + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + 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/CustomersRedeemablesListResponseBody.php b/src/Model/CustomersRedeemablesListResponseBody.php new file mode 100644 index 0000000..3a3fcc6 --- /dev/null +++ b/src/Model/CustomersRedeemablesListResponseBody.php @@ -0,0 +1,623 @@ + + */ +class CustomersRedeemablesListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersRedeemablesListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\CustomerRedeemable[]', + 'total' => 'int', + 'hasMore' => 'bool', + 'moreStartingAfter' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null, + 'hasMore' => null, + 'moreStartingAfter' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true, + 'hasMore' => true, + 'moreStartingAfter' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total', + 'hasMore' => 'has_more', + 'moreStartingAfter' => 'more_starting_after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal', + 'hasMore' => 'setHasMore', + 'moreStartingAfter' => 'setMoreStartingAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal', + 'hasMore' => 'getHasMore', + 'moreStartingAfter' => 'getMoreStartingAfter' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('hasMore', $data ?? [], null); + $this->setIfExists('moreStartingAfter', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about customer redeemables. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of redeemables. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\CustomerRedeemable[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\CustomerRedeemable[]|null $data A dictionary that contains an array of redeemables. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of results returned. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + return $this; + } + + /** + * Gets moreStartingAfter + * + * @return string|null + */ + public function getMoreStartingAfter() + { + return $this->container['moreStartingAfter']; + } + + /** + * Sets moreStartingAfter + * + * @param string|null $moreStartingAfter Returns an ID that can be used to return another page of results. Use the ID in the `starting_after_id` query parameter to display another page of the results occuring after the field with that ID. + * + * @return self + */ + public function setMoreStartingAfter($moreStartingAfter) + { + if (is_null($moreStartingAfter)) { + array_push($this->openAPINullablesSetToNull, 'moreStartingAfter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreStartingAfter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreStartingAfter'] = $moreStartingAfter; + + 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/CustomersSegmentsListResponseBody.php b/src/Model/CustomersSegmentsListResponseBody.php new file mode 100644 index 0000000..f97f04f --- /dev/null +++ b/src/Model/CustomersSegmentsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class CustomersSegmentsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersSegmentsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\SimpleSegment[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about customer segments. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of segment IDs. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\SimpleSegment[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\SimpleSegment[]|null $data A dictionary that contains an array of segment IDs and names. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of segments the customer belongs to. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/CustomersUpdateInBulkRequestBody.php b/src/Model/CustomersUpdateInBulkRequestBody.php new file mode 100644 index 0000000..ee97c66 --- /dev/null +++ b/src/Model/CustomersUpdateInBulkRequestBody.php @@ -0,0 +1,746 @@ + + */ +class CustomersUpdateInBulkRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersUpdateInBulkRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sourceId' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\CustomersUpdateInBulkRequestBodyAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sourceId' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sourceId' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'sourceId' => 'source_id', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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 sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique customer source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\CustomersUpdateInBulkRequestBodyAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\CustomersUpdateInBulkRequestBodyAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomersUpdateInBulkRequestBodyAddress.php b/src/Model/CustomersUpdateInBulkRequestBodyAddress.php new file mode 100644 index 0000000..bb002c4 --- /dev/null +++ b/src/Model/CustomersUpdateInBulkRequestBodyAddress.php @@ -0,0 +1,623 @@ + + */ +class CustomersUpdateInBulkRequestBodyAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersUpdateInBulkRequestBodyAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/CustomersUpdateInBulkResponseBody.php b/src/Model/CustomersUpdateInBulkResponseBody.php new file mode 100644 index 0000000..2775cce --- /dev/null +++ b/src/Model/CustomersUpdateInBulkResponseBody.php @@ -0,0 +1,418 @@ + + */ +class CustomersUpdateInBulkResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersUpdateInBulkResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/CustomersUpdateRequestBody.php b/src/Model/CustomersUpdateRequestBody.php new file mode 100644 index 0000000..f3ab5f6 --- /dev/null +++ b/src/Model/CustomersUpdateRequestBody.php @@ -0,0 +1,705 @@ + + */ +class CustomersUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\CustomersUpdateRequestBodyAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\CustomersUpdateRequestBodyAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\CustomersUpdateRequestBodyAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomersUpdateRequestBodyAddress.php b/src/Model/CustomersUpdateRequestBodyAddress.php new file mode 100644 index 0000000..753c76a --- /dev/null +++ b/src/Model/CustomersUpdateRequestBodyAddress.php @@ -0,0 +1,623 @@ + + */ +class CustomersUpdateRequestBodyAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersUpdateRequestBodyAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/CustomersUpdateResponseBody.php b/src/Model/CustomersUpdateResponseBody.php new file mode 100644 index 0000000..624f95d --- /dev/null +++ b/src/Model/CustomersUpdateResponseBody.php @@ -0,0 +1,1126 @@ + + */ +class CustomersUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'summary' => '\OpenAPI\Client\Model\CustomerSummary', + 'loyalty' => '\OpenAPI\Client\Model\CustomerLoyalty', + 'referrals' => '\OpenAPI\Client\Model\CustomerReferrals', + 'systemMetadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'assets' => '\OpenAPI\Client\Model\CustomersUpdateResponseBodyAssets', + 'object' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\CustomersUpdateResponseBodyAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'summary' => null, + 'loyalty' => null, + 'referrals' => null, + 'systemMetadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'assets' => null, + 'object' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'summary' => false, + 'loyalty' => false, + 'referrals' => false, + 'systemMetadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'assets' => true, + 'object' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'summary' => 'summary', + 'loyalty' => 'loyalty', + 'referrals' => 'referrals', + 'systemMetadata' => 'system_metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'assets' => 'assets', + 'object' => 'object', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'summary' => 'setSummary', + 'loyalty' => 'setLoyalty', + 'referrals' => 'setReferrals', + 'systemMetadata' => 'setSystemMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'assets' => 'setAssets', + 'object' => 'setObject', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'summary' => 'getSummary', + 'loyalty' => 'getLoyalty', + 'referrals' => 'getReferrals', + 'systemMetadata' => 'getSystemMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'assets' => 'getAssets', + 'object' => 'getObject', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('referrals', $data ?? [], null); + $this->setIfExists('systemMetadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of an existing customer that will be linked to redemption in this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\CustomerSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\CustomerSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + throw new \InvalidArgumentException('non-nullable summary cannot be null'); + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\CustomerLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\CustomerLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + throw new \InvalidArgumentException('non-nullable loyalty cannot be null'); + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets referrals + * + * @return \OpenAPI\Client\Model\CustomerReferrals|null + */ + public function getReferrals() + { + return $this->container['referrals']; + } + + /** + * Sets referrals + * + * @param \OpenAPI\Client\Model\CustomerReferrals|null $referrals referrals + * + * @return self + */ + public function setReferrals($referrals) + { + if (is_null($referrals)) { + throw new \InvalidArgumentException('non-nullable referrals cannot be null'); + } + $this->container['referrals'] = $referrals; + + return $this; + } + + /** + * Gets systemMetadata + * + * @return object|null + */ + public function getSystemMetadata() + { + return $this->container['systemMetadata']; + } + + /** + * Sets systemMetadata + * + * @param object|null $systemMetadata Object used to store system metadata information. + * + * @return self + */ + public function setSystemMetadata($systemMetadata) + { + if (is_null($systemMetadata)) { + array_push($this->openAPINullablesSetToNull, 'systemMetadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('systemMetadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['systemMetadata'] = $systemMetadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\CustomersUpdateResponseBodyAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\CustomersUpdateResponseBodyAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + array_push($this->openAPINullablesSetToNull, 'assets'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assets', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\CustomersUpdateResponseBodyAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\CustomersUpdateResponseBodyAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/CustomersUpdateResponseBodyAddress.php b/src/Model/CustomersUpdateResponseBodyAddress.php new file mode 100644 index 0000000..33a2772 --- /dev/null +++ b/src/Model/CustomersUpdateResponseBodyAddress.php @@ -0,0 +1,623 @@ + + */ +class CustomersUpdateResponseBodyAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersUpdateResponseBodyAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/CustomersUpdateResponseBodyAssets.php b/src/Model/CustomersUpdateResponseBodyAssets.php new file mode 100644 index 0000000..6dd9739 --- /dev/null +++ b/src/Model/CustomersUpdateResponseBodyAssets.php @@ -0,0 +1,418 @@ + + */ +class CustomersUpdateResponseBodyAssets implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CustomersUpdateResponseBodyAssets'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cockpitUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cockpitUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'cockpitUrl' => true + ]; + + /** + * 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 = [ + 'cockpitUrl' => 'cockpit_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cockpitUrl' => 'setCockpitUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cockpitUrl' => 'getCockpitUrl' + ]; + + /** + * 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('cockpitUrl', $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 cockpitUrl + * + * @return string|null + */ + public function getCockpitUrl() + { + return $this->container['cockpitUrl']; + } + + /** + * Sets cockpitUrl + * + * @param string|null $cockpitUrl Customer's cockpit URL address. + * + * @return self + */ + public function setCockpitUrl($cockpitUrl) + { + if (is_null($cockpitUrl)) { + array_push($this->openAPINullablesSetToNull, 'cockpitUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cockpitUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['cockpitUrl'] = $cockpitUrl; + + 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/Discount.php b/src/Model/Discount.php new file mode 100644 index 0000000..700adcb --- /dev/null +++ b/src/Model/Discount.php @@ -0,0 +1,1143 @@ + + */ +class Discount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Discount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'amountOff' => 'float', + 'amountOffFormula' => 'string', + 'aggregatedAmountLimit' => 'int', + 'effect' => 'string', + 'isDynamic' => 'bool', + 'unitOff' => 'int', + 'unitOffFormula' => 'string', + 'unitType' => 'string', + 'product' => '\OpenAPI\Client\Model\SimpleProductDiscountUnit', + 'sku' => '\OpenAPI\Client\Model\SimpleSkuDiscountUnit', + 'units' => '\OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]', + 'percentOff' => 'float', + 'percentOffFormula' => 'string', + 'amountLimit' => 'float', + 'fixedAmount' => 'float', + 'fixedAmountFormula' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'amountOff' => null, + 'amountOffFormula' => null, + 'aggregatedAmountLimit' => null, + 'effect' => null, + 'isDynamic' => null, + 'unitOff' => null, + 'unitOffFormula' => null, + 'unitType' => null, + 'product' => null, + 'sku' => null, + 'units' => null, + 'percentOff' => null, + 'percentOffFormula' => null, + 'amountLimit' => null, + 'fixedAmount' => null, + 'fixedAmountFormula' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'amountOff' => true, + 'amountOffFormula' => true, + 'aggregatedAmountLimit' => true, + 'effect' => true, + 'isDynamic' => true, + 'unitOff' => true, + 'unitOffFormula' => true, + 'unitType' => true, + 'product' => false, + 'sku' => false, + 'units' => true, + 'percentOff' => true, + 'percentOffFormula' => true, + 'amountLimit' => true, + 'fixedAmount' => true, + 'fixedAmountFormula' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'amountOff' => 'amount_off', + 'amountOffFormula' => 'amount_off_formula', + 'aggregatedAmountLimit' => 'aggregated_amount_limit', + 'effect' => 'effect', + 'isDynamic' => 'is_dynamic', + 'unitOff' => 'unit_off', + 'unitOffFormula' => 'unit_off_formula', + 'unitType' => 'unit_type', + 'product' => 'product', + 'sku' => 'sku', + 'units' => 'units', + 'percentOff' => 'percent_off', + 'percentOffFormula' => 'percent_off_formula', + 'amountLimit' => 'amount_limit', + 'fixedAmount' => 'fixed_amount', + 'fixedAmountFormula' => 'fixed_amount_formula' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'amountOff' => 'setAmountOff', + 'amountOffFormula' => 'setAmountOffFormula', + 'aggregatedAmountLimit' => 'setAggregatedAmountLimit', + 'effect' => 'setEffect', + 'isDynamic' => 'setIsDynamic', + 'unitOff' => 'setUnitOff', + 'unitOffFormula' => 'setUnitOffFormula', + 'unitType' => 'setUnitType', + 'product' => 'setProduct', + 'sku' => 'setSku', + 'units' => 'setUnits', + 'percentOff' => 'setPercentOff', + 'percentOffFormula' => 'setPercentOffFormula', + 'amountLimit' => 'setAmountLimit', + 'fixedAmount' => 'setFixedAmount', + 'fixedAmountFormula' => 'setFixedAmountFormula' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'amountOff' => 'getAmountOff', + 'amountOffFormula' => 'getAmountOffFormula', + 'aggregatedAmountLimit' => 'getAggregatedAmountLimit', + 'effect' => 'getEffect', + 'isDynamic' => 'getIsDynamic', + 'unitOff' => 'getUnitOff', + 'unitOffFormula' => 'getUnitOffFormula', + 'unitType' => 'getUnitType', + 'product' => 'getProduct', + 'sku' => 'getSku', + 'units' => 'getUnits', + 'percentOff' => 'getPercentOff', + 'percentOffFormula' => 'getPercentOffFormula', + 'amountLimit' => 'getAmountLimit', + 'fixedAmount' => 'getFixedAmount', + 'fixedAmountFormula' => 'getFixedAmountFormula' + ]; + + /** + * 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 TYPE_AMOUNT = 'AMOUNT'; + public const TYPE_UNIT = 'UNIT'; + public const TYPE_PERCENT = 'PERCENT'; + public const TYPE_FIXED = 'FIXED'; + public const EFFECT_APPLY_TO_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_APPLY_TO_ITEMS = 'APPLY_TO_ITEMS'; + public const EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY = 'APPLY_TO_ITEMS_PROPORTIONALLY'; + public const EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY'; + public const EFFECT_APPLY_TO_ITEMS_BY_QUANTITY = 'APPLY_TO_ITEMS_BY_QUANTITY'; + public const EFFECT_ADD_MISSING_ITEMS = 'ADD_MISSING_ITEMS'; + public const EFFECT_ADD_NEW_ITEMS = 'ADD_NEW_ITEMS'; + public const EFFECT_ADD_MANY_ITEMS = 'ADD_MANY_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AMOUNT, + self::TYPE_UNIT, + self::TYPE_PERCENT, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_APPLY_TO_ORDER, + self::EFFECT_APPLY_TO_ITEMS, + self::EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::EFFECT_APPLY_TO_ITEMS_BY_QUANTITY, + self::EFFECT_ADD_MISSING_ITEMS, + self::EFFECT_ADD_NEW_ITEMS, + self::EFFECT_ADD_MANY_ITEMS, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('amountOff', $data ?? [], null); + $this->setIfExists('amountOffFormula', $data ?? [], null); + $this->setIfExists('aggregatedAmountLimit', $data ?? [], null); + $this->setIfExists('effect', $data ?? [], null); + $this->setIfExists('isDynamic', $data ?? [], null); + $this->setIfExists('unitOff', $data ?? [], null); + $this->setIfExists('unitOffFormula', $data ?? [], null); + $this->setIfExists('unitType', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('percentOff', $data ?? [], null); + $this->setIfExists('percentOffFormula', $data ?? [], null); + $this->setIfExists('amountLimit', $data ?? [], null); + $this->setIfExists('fixedAmount', $data ?? [], null); + $this->setIfExists('fixedAmountFormula', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets amountOff + * + * @return float|null + */ + public function getAmountOff() + { + return $this->container['amountOff']; + } + + /** + * Sets amountOff + * + * @param float|null $amountOff Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. + * + * @return self + */ + public function setAmountOff($amountOff) + { + if (is_null($amountOff)) { + array_push($this->openAPINullablesSetToNull, 'amountOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountOff'] = $amountOff; + + return $this; + } + + /** + * Gets amountOffFormula + * + * @return string|null + */ + public function getAmountOffFormula() + { + return $this->container['amountOffFormula']; + } + + /** + * Sets amountOffFormula + * + * @param string|null $amountOffFormula amountOffFormula + * + * @return self + */ + public function setAmountOffFormula($amountOffFormula) + { + if (is_null($amountOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'amountOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountOffFormula'] = $amountOffFormula; + + return $this; + } + + /** + * Gets aggregatedAmountLimit + * + * @return int|null + */ + public function getAggregatedAmountLimit() + { + return $this->container['aggregatedAmountLimit']; + } + + /** + * Sets aggregatedAmountLimit + * + * @param int|null $aggregatedAmountLimit Maximum discount amount per order. + * + * @return self + */ + public function setAggregatedAmountLimit($aggregatedAmountLimit) + { + if (is_null($aggregatedAmountLimit)) { + array_push($this->openAPINullablesSetToNull, 'aggregatedAmountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('aggregatedAmountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['aggregatedAmountLimit'] = $aggregatedAmountLimit; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect effect + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + return $this; + } + + /** + * Gets isDynamic + * + * @return bool|null + */ + public function getIsDynamic() + { + return $this->container['isDynamic']; + } + + /** + * Sets isDynamic + * + * @param bool|null $isDynamic Flag indicating whether the discount was calculated using a formula. + * + * @return self + */ + public function setIsDynamic($isDynamic) + { + if (is_null($isDynamic)) { + array_push($this->openAPINullablesSetToNull, 'isDynamic'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isDynamic', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isDynamic'] = $isDynamic; + + return $this; + } + + /** + * Gets unitOff + * + * @return int|null + */ + public function getUnitOff() + { + return $this->container['unitOff']; + } + + /** + * Sets unitOff + * + * @param int|null $unitOff Number of units to be granted a full value discount. + * + * @return self + */ + public function setUnitOff($unitOff) + { + if (is_null($unitOff)) { + array_push($this->openAPINullablesSetToNull, 'unitOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitOff'] = $unitOff; + + return $this; + } + + /** + * Gets unitOffFormula + * + * @return string|null + */ + public function getUnitOffFormula() + { + return $this->container['unitOffFormula']; + } + + /** + * Sets unitOffFormula + * + * @param string|null $unitOffFormula unitOffFormula + * + * @return self + */ + public function setUnitOffFormula($unitOffFormula) + { + if (is_null($unitOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'unitOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitOffFormula'] = $unitOffFormula; + + return $this; + } + + /** + * Gets unitType + * + * @return string|null + */ + public function getUnitType() + { + return $this->container['unitType']; + } + + /** + * Sets unitType + * + * @param string|null $unitType The product deemed as free, chosen from product inventory (e.g. time, items). + * + * @return self + */ + public function setUnitType($unitType) + { + if (is_null($unitType)) { + array_push($this->openAPINullablesSetToNull, 'unitType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitType'] = $unitType; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\SimpleProductDiscountUnit|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\SimpleProductDiscountUnit|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + throw new \InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets sku + * + * @return \OpenAPI\Client\Model\SimpleSkuDiscountUnit|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param \OpenAPI\Client\Model\SimpleSkuDiscountUnit|null $sku sku + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + throw new \InvalidArgumentException('non-nullable sku cannot be null'); + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets units + * + * @return \OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]|null + */ + public function getUnits() + { + return $this->container['units']; + } + + /** + * Sets units + * + * @param \OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]|null $units units + * + * @return self + */ + public function setUnits($units) + { + if (is_null($units)) { + array_push($this->openAPINullablesSetToNull, 'units'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('units', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['units'] = $units; + + return $this; + } + + /** + * Gets percentOff + * + * @return float|null + */ + public function getPercentOff() + { + return $this->container['percentOff']; + } + + /** + * Sets percentOff + * + * @param float|null $percentOff The percent discount that the customer will receive. + * + * @return self + */ + public function setPercentOff($percentOff) + { + if (is_null($percentOff)) { + array_push($this->openAPINullablesSetToNull, 'percentOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('percentOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['percentOff'] = $percentOff; + + return $this; + } + + /** + * Gets percentOffFormula + * + * @return string|null + */ + public function getPercentOffFormula() + { + return $this->container['percentOffFormula']; + } + + /** + * Sets percentOffFormula + * + * @param string|null $percentOffFormula percentOffFormula + * + * @return self + */ + public function setPercentOffFormula($percentOffFormula) + { + if (is_null($percentOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'percentOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('percentOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['percentOffFormula'] = $percentOffFormula; + + return $this; + } + + /** + * Gets amountLimit + * + * @return float|null + */ + public function getAmountLimit() + { + return $this->container['amountLimit']; + } + + /** + * Sets amountLimit + * + * @param float|null $amountLimit Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. + * + * @return self + */ + public function setAmountLimit($amountLimit) + { + if (is_null($amountLimit)) { + array_push($this->openAPINullablesSetToNull, 'amountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountLimit'] = $amountLimit; + + return $this; + } + + /** + * Gets fixedAmount + * + * @return float|null + */ + public function getFixedAmount() + { + return $this->container['fixedAmount']; + } + + /** + * Sets fixedAmount + * + * @param float|null $fixedAmount Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. + * + * @return self + */ + public function setFixedAmount($fixedAmount) + { + if (is_null($fixedAmount)) { + array_push($this->openAPINullablesSetToNull, 'fixedAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fixedAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fixedAmount'] = $fixedAmount; + + return $this; + } + + /** + * Gets fixedAmountFormula + * + * @return string|null + */ + public function getFixedAmountFormula() + { + return $this->container['fixedAmountFormula']; + } + + /** + * Sets fixedAmountFormula + * + * @param string|null $fixedAmountFormula fixedAmountFormula + * + * @return self + */ + public function setFixedAmountFormula($fixedAmountFormula) + { + if (is_null($fixedAmountFormula)) { + array_push($this->openAPINullablesSetToNull, 'fixedAmountFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fixedAmountFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fixedAmountFormula'] = $fixedAmountFormula; + + 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/DiscountUnitMultipleOneUnit.php b/src/Model/DiscountUnitMultipleOneUnit.php new file mode 100644 index 0000000..97056b7 --- /dev/null +++ b/src/Model/DiscountUnitMultipleOneUnit.php @@ -0,0 +1,642 @@ + + */ +class DiscountUnitMultipleOneUnit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DiscountUnitMultipleOneUnit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'unitOff' => 'float', + 'unitOffFormula' => 'string', + 'effect' => 'string', + 'unitType' => 'string', + 'product' => '\OpenAPI\Client\Model\SimpleProductDiscountUnit', + 'sku' => '\OpenAPI\Client\Model\SimpleSkuDiscountUnit' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'unitOff' => null, + 'unitOffFormula' => null, + 'effect' => null, + 'unitType' => null, + 'product' => null, + 'sku' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'unitOff' => true, + 'unitOffFormula' => true, + 'effect' => true, + 'unitType' => true, + 'product' => false, + 'sku' => 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 = [ + 'unitOff' => 'unit_off', + 'unitOffFormula' => 'unit_off_formula', + 'effect' => 'effect', + 'unitType' => 'unit_type', + 'product' => 'product', + 'sku' => 'sku' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'unitOff' => 'setUnitOff', + 'unitOffFormula' => 'setUnitOffFormula', + 'effect' => 'setEffect', + 'unitType' => 'setUnitType', + 'product' => 'setProduct', + 'sku' => 'setSku' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'unitOff' => 'getUnitOff', + 'unitOffFormula' => 'getUnitOffFormula', + 'effect' => 'getEffect', + 'unitType' => 'getUnitType', + 'product' => 'getProduct', + 'sku' => 'getSku' + ]; + + /** + * 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 EFFECT_NEW_ITEMS = 'ADD_NEW_ITEMS'; + public const EFFECT_MISSING_ITEMS = 'ADD_MISSING_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_NEW_ITEMS, + self::EFFECT_MISSING_ITEMS, + ]; + } + + /** + * 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('unitOff', $data ?? [], null); + $this->setIfExists('unitOffFormula', $data ?? [], null); + $this->setIfExists('effect', $data ?? [], null); + $this->setIfExists('unitType', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('sku', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 unitOff + * + * @return float|null + */ + public function getUnitOff() + { + return $this->container['unitOff']; + } + + /** + * Sets unitOff + * + * @param float|null $unitOff Number of units to be granted a full value discount. + * + * @return self + */ + public function setUnitOff($unitOff) + { + if (is_null($unitOff)) { + array_push($this->openAPINullablesSetToNull, 'unitOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitOff'] = $unitOff; + + return $this; + } + + /** + * Gets unitOffFormula + * + * @return string|null + */ + public function getUnitOffFormula() + { + return $this->container['unitOffFormula']; + } + + /** + * Sets unitOffFormula + * + * @param string|null $unitOffFormula unitOffFormula + * + * @return self + */ + public function setUnitOffFormula($unitOffFormula) + { + if (is_null($unitOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'unitOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitOffFormula'] = $unitOffFormula; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the unit is added to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + return $this; + } + + /** + * Gets unitType + * + * @return string|null + */ + public function getUnitType() + { + return $this->container['unitType']; + } + + /** + * Sets unitType + * + * @param string|null $unitType The product deemed as free, chosen from product inventory (e.g. time, items). + * + * @return self + */ + public function setUnitType($unitType) + { + if (is_null($unitType)) { + array_push($this->openAPINullablesSetToNull, 'unitType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitType'] = $unitType; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\SimpleProductDiscountUnit|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\SimpleProductDiscountUnit|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + throw new \InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets sku + * + * @return \OpenAPI\Client\Model\SimpleSkuDiscountUnit|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param \OpenAPI\Client\Model\SimpleSkuDiscountUnit|null $sku sku + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + throw new \InvalidArgumentException('non-nullable sku cannot be null'); + } + $this->container['sku'] = $sku; + + 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/EarningRule.php b/src/Model/EarningRule.php new file mode 100644 index 0000000..7e3302c --- /dev/null +++ b/src/Model/EarningRule.php @@ -0,0 +1,1207 @@ + + */ +class EarningRule implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRule'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'loyalty' => '\OpenAPI\Client\Model\EarningRuleLoyalty', + 'event' => 'string', + 'customEvent' => '\OpenAPI\Client\Model\EarningRuleCustomEvent', + 'segment' => '\OpenAPI\Client\Model\EarningRuleSegment', + 'loyaltyTier' => '\OpenAPI\Client\Model\EarningRuleLoyaltyTier', + 'source' => '\OpenAPI\Client\Model\EarningRuleSource', + 'object' => 'string', + 'automationId' => 'string', + 'startDate' => 'string', + 'expirationDate' => 'string', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'metadata' => 'object', + 'validationRuleId' => 'string', + 'updatedAt' => '\DateTime', + 'active' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'loyalty' => null, + 'event' => null, + 'customEvent' => null, + 'segment' => null, + 'loyaltyTier' => null, + 'source' => null, + 'object' => null, + 'automationId' => null, + 'startDate' => null, + 'expirationDate' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'metadata' => null, + 'validationRuleId' => null, + 'updatedAt' => 'date-time', + 'active' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'loyalty' => true, + 'event' => true, + 'customEvent' => true, + 'segment' => true, + 'loyaltyTier' => true, + 'source' => true, + 'object' => true, + 'automationId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'metadata' => true, + 'validationRuleId' => true, + 'updatedAt' => true, + 'active' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'loyalty' => 'loyalty', + 'event' => 'event', + 'customEvent' => 'custom_event', + 'segment' => 'segment', + 'loyaltyTier' => 'loyalty_tier', + 'source' => 'source', + 'object' => 'object', + 'automationId' => 'automation_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'metadata' => 'metadata', + 'validationRuleId' => 'validation_rule_id', + 'updatedAt' => 'updated_at', + 'active' => 'active' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'loyalty' => 'setLoyalty', + 'event' => 'setEvent', + 'customEvent' => 'setCustomEvent', + 'segment' => 'setSegment', + 'loyaltyTier' => 'setLoyaltyTier', + 'source' => 'setSource', + 'object' => 'setObject', + 'automationId' => 'setAutomationId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'metadata' => 'setMetadata', + 'validationRuleId' => 'setValidationRuleId', + 'updatedAt' => 'setUpdatedAt', + 'active' => 'setActive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'loyalty' => 'getLoyalty', + 'event' => 'getEvent', + 'customEvent' => 'getCustomEvent', + 'segment' => 'getSegment', + 'loyaltyTier' => 'getLoyaltyTier', + 'source' => 'getSource', + 'object' => 'getObject', + 'automationId' => 'getAutomationId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'metadata' => 'getMetadata', + 'validationRuleId' => 'getValidationRuleId', + 'updatedAt' => 'getUpdatedAt', + 'active' => 'getActive' + ]; + + /** + * 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 OBJECT_EARNING_RULE = 'earning_rule'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EARNING_RULE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'earning_rule'); + $this->setIfExists('automationId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('validationRuleId', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('active', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the earning rule object. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\EarningRuleLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\EarningRuleLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\EarningRuleCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\EarningRuleCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\EarningRuleSegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\EarningRuleSegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\EarningRuleSource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\EarningRuleSource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is earning_rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets automationId + * + * @return string|null + */ + public function getAutomationId() + { + return $this->container['automationId']; + } + + /** + * Sets automationId + * + * @param string|null $automationId For internal use by Voucherify. + * + * @return self + */ + public function setAutomationId($automationId) + { + if (is_null($automationId)) { + array_push($this->openAPINullablesSetToNull, 'automationId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('automationId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['automationId'] = $automationId; + + return $this; + } + + /** + * Gets startDate + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param string|null $startDate Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return string|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param string|null $expirationDate Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets validationRuleId + * + * @return string|null + */ + public function getValidationRuleId() + { + return $this->container['validationRuleId']; + } + + /** + * Sets validationRuleId + * + * @param string|null $validationRuleId A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + * + * @return self + */ + public function setValidationRuleId($validationRuleId) + { + if (is_null($validationRuleId)) { + array_push($this->openAPINullablesSetToNull, 'validationRuleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRuleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRuleId'] = $validationRuleId; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + 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/EarningRuleCustomEvent.php b/src/Model/EarningRuleCustomEvent.php new file mode 100644 index 0000000..f59f124 --- /dev/null +++ b/src/Model/EarningRuleCustomEvent.php @@ -0,0 +1,418 @@ + + */ +class EarningRuleCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'schemaId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'schemaId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schemaId' => true + ]; + + /** + * 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 = [ + 'schemaId' => 'schema_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'schemaId' => 'setSchemaId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'schemaId' => 'getSchemaId' + ]; + + /** + * 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('schemaId', $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 schemaId + * + * @return string|null + */ + public function getSchemaId() + { + return $this->container['schemaId']; + } + + /** + * Sets schemaId + * + * @param string|null $schemaId Unique identifier of the custom event schema + * + * @return self + */ + public function setSchemaId($schemaId) + { + if (is_null($schemaId)) { + array_push($this->openAPINullablesSetToNull, 'schemaId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('schemaId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['schemaId'] = $schemaId; + + 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/EarningRuleLoyalty.php b/src/Model/EarningRuleLoyalty.php new file mode 100644 index 0000000..057fec4 --- /dev/null +++ b/src/Model/EarningRuleLoyalty.php @@ -0,0 +1,743 @@ + + */ +class EarningRuleLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'calculationType' => 'string', + 'order' => '\OpenAPI\Client\Model\EarningRuleLoyaltyOrder', + 'orderItems' => '\OpenAPI\Client\Model\EarningRuleLoyaltyOrderItems', + 'customer' => '\OpenAPI\Client\Model\EarningRuleLoyaltyCustomer', + 'customEvent' => '\OpenAPI\Client\Model\EarningRuleLoyaltyCustomEvent', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'calculationType' => null, + 'order' => null, + 'orderItems' => null, + 'customer' => null, + 'customEvent' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'calculationType' => true, + 'order' => true, + 'orderItems' => true, + 'customer' => true, + 'customEvent' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'calculationType' => 'calculation_type', + 'order' => 'order', + 'orderItems' => 'order_items', + 'customer' => 'customer', + 'customEvent' => 'custom_event', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'calculationType' => 'setCalculationType', + 'order' => 'setOrder', + 'orderItems' => 'setOrderItems', + 'customer' => 'setCustomer', + 'customEvent' => 'setCustomEvent', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'calculationType' => 'getCalculationType', + 'order' => 'getOrder', + 'orderItems' => 'getOrderItems', + 'customer' => 'getCustomer', + 'customEvent' => 'getCustomEvent', + 'points' => 'getPoints' + ]; + + /** + * 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 TYPE_PROPORTIONAL = 'PROPORTIONAL'; + public const TYPE_FIXED = 'FIXED'; + public const CALCULATION_TYPE_ORDER_AMOUNT = 'ORDER_AMOUNT'; + public const CALCULATION_TYPE_ORDER_TOTAL_AMOUNT = 'ORDER_TOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_METADATA = 'ORDER_METADATA'; + public const CALCULATION_TYPE_ORDER_ITEMS_QUANTITY = 'ORDER_ITEMS_QUANTITY'; + public const CALCULATION_TYPE_ORDER_ITEMS_AMOUNT = 'ORDER_ITEMS_AMOUNT'; + public const CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT = 'ORDER_ITEMS_SUBTOTAL_AMOUNT'; + public const CALCULATION_TYPE_CUSTOMER_METADATA = 'CUSTOMER_METADATA'; + public const CALCULATION_TYPE_CUSTOM_EVENT_METADATA = 'CUSTOM_EVENT_METADATA'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PROPORTIONAL, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCalculationTypeAllowableValues() + { + return [ + self::CALCULATION_TYPE_ORDER_AMOUNT, + self::CALCULATION_TYPE_ORDER_TOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_METADATA, + self::CALCULATION_TYPE_ORDER_ITEMS_QUANTITY, + self::CALCULATION_TYPE_ORDER_ITEMS_AMOUNT, + self::CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT, + self::CALCULATION_TYPE_CUSTOMER_METADATA, + self::CALCULATION_TYPE_CUSTOM_EVENT_METADATA, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('calculationType', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('orderItems', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('points', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($this->container['calculationType']) && !in_array($this->container['calculationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'calculationType', must be one of '%s'", + $this->container['calculationType'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets calculationType + * + * @return string|null + */ + public function getCalculationType() + { + return $this->container['calculationType']; + } + + /** + * Sets calculationType + * + * @param string|null $calculationType calculationType + * + * @return self + */ + public function setCalculationType($calculationType) + { + if (is_null($calculationType)) { + array_push($this->openAPINullablesSetToNull, 'calculationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('calculationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($calculationType) && !in_array($calculationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'calculationType', must be one of '%s'", + $calculationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['calculationType'] = $calculationType; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets orderItems + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyOrderItems|null + */ + public function getOrderItems() + { + return $this->container['orderItems']; + } + + /** + * Sets orderItems + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyOrderItems|null $orderItems orderItems + * + * @return self + */ + public function setOrderItems($orderItems) + { + if (is_null($orderItems)) { + array_push($this->openAPINullablesSetToNull, 'orderItems'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItems', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItems'] = $orderItems; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/EarningRuleLoyaltyCustomEvent.php b/src/Model/EarningRuleLoyaltyCustomEvent.php new file mode 100644 index 0000000..64de6a5 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyCustomEvent.php @@ -0,0 +1,417 @@ + + */ +class EarningRuleLoyaltyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\EarningRuleLoyaltyCustomEventMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyCustomEventMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyCustomEventMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/EarningRuleLoyaltyCustomEventMetadata.php b/src/Model/EarningRuleLoyaltyCustomEventMetadata.php new file mode 100644 index 0000000..3870102 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyCustomEventMetadata.php @@ -0,0 +1,500 @@ + + */ +class EarningRuleLoyaltyCustomEventMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyCustomEventMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Custom event metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/EarningRuleLoyaltyCustomer.php b/src/Model/EarningRuleLoyaltyCustomer.php new file mode 100644 index 0000000..74b763f --- /dev/null +++ b/src/Model/EarningRuleLoyaltyCustomer.php @@ -0,0 +1,417 @@ + + */ +class EarningRuleLoyaltyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\EarningRuleLoyaltyCustomerMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyCustomerMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyCustomerMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/EarningRuleLoyaltyCustomerMetadata.php b/src/Model/EarningRuleLoyaltyCustomerMetadata.php new file mode 100644 index 0000000..8a1d6fd --- /dev/null +++ b/src/Model/EarningRuleLoyaltyCustomerMetadata.php @@ -0,0 +1,500 @@ + + */ +class EarningRuleLoyaltyCustomerMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyCustomerMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Customer metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/EarningRuleLoyaltyOrder.php b/src/Model/EarningRuleLoyaltyOrder.php new file mode 100644 index 0000000..d3b071d --- /dev/null +++ b/src/Model/EarningRuleLoyaltyOrder.php @@ -0,0 +1,499 @@ + + */ +class EarningRuleLoyaltyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\OpenAPI\Client\Model\EarningRuleLoyaltyOrderAmount', + 'totalAmount' => '\OpenAPI\Client\Model\EarningRuleLoyaltyOrderTotalAmount', + 'metadata' => '\OpenAPI\Client\Model\EarningRuleLoyaltyOrderMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'totalAmount' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'totalAmount' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'totalAmount' => 'total_amount', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'totalAmount' => 'setTotalAmount', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'totalAmount' => 'getTotalAmount', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('metadata', $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 amount + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyOrderAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyOrderAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyOrderTotalAmount|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyOrderTotalAmount|null $totalAmount totalAmount + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyOrderMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyOrderMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/EarningRuleLoyaltyOrderAmount.php b/src/Model/EarningRuleLoyaltyOrderAmount.php new file mode 100644 index 0000000..ec8fa48 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyOrderAmount.php @@ -0,0 +1,459 @@ + + */ +class EarningRuleLoyaltyOrderAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyOrderAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/EarningRuleLoyaltyOrderItems.php b/src/Model/EarningRuleLoyaltyOrderItems.php new file mode 100644 index 0000000..70e06aa --- /dev/null +++ b/src/Model/EarningRuleLoyaltyOrderItems.php @@ -0,0 +1,499 @@ + + */ +class EarningRuleLoyaltyOrderItems implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyOrderItems'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => '\OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsQuantity', + 'amount' => '\OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsAmount', + 'subtotalAmount' => '\OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsSubtotalAmount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'amount' => null, + 'subtotalAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'amount' => true, + 'subtotalAmount' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'amount' => 'amount', + 'subtotalAmount' => 'subtotal_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'amount' => 'setAmount', + 'subtotalAmount' => 'setSubtotalAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'amount' => 'getAmount', + 'subtotalAmount' => 'getSubtotalAmount' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('subtotalAmount', $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 quantity + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsQuantity|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsQuantity|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets amount + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return \OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsSubtotalAmount|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param \OpenAPI\Client\Model\EarningRuleLoyaltyOrderItemsSubtotalAmount|null $subtotalAmount subtotalAmount + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + 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/EarningRuleLoyaltyOrderItemsAmount.php b/src/Model/EarningRuleLoyaltyOrderItemsAmount.php new file mode 100644 index 0000000..7b299c4 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyOrderItemsAmount.php @@ -0,0 +1,577 @@ + + */ +class EarningRuleLoyaltyOrderItemsAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyOrderItemsAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/EarningRuleLoyaltyOrderItemsQuantity.php b/src/Model/EarningRuleLoyaltyOrderItemsQuantity.php new file mode 100644 index 0000000..a6e0af1 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyOrderItemsQuantity.php @@ -0,0 +1,577 @@ + + */ +class EarningRuleLoyaltyOrderItemsQuantity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyOrderItemsQuantity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/EarningRuleLoyaltyOrderItemsSubtotalAmount.php b/src/Model/EarningRuleLoyaltyOrderItemsSubtotalAmount.php new file mode 100644 index 0000000..1139740 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyOrderItemsSubtotalAmount.php @@ -0,0 +1,577 @@ + + */ +class EarningRuleLoyaltyOrderItemsSubtotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyOrderItemsSubtotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/EarningRuleLoyaltyOrderMetadata.php b/src/Model/EarningRuleLoyaltyOrderMetadata.php new file mode 100644 index 0000000..30d58b8 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyOrderMetadata.php @@ -0,0 +1,500 @@ + + */ +class EarningRuleLoyaltyOrderMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyOrderMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the order metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Order metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/EarningRuleLoyaltyOrderTotalAmount.php b/src/Model/EarningRuleLoyaltyOrderTotalAmount.php new file mode 100644 index 0000000..184beb6 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyOrderTotalAmount.php @@ -0,0 +1,459 @@ + + */ +class EarningRuleLoyaltyOrderTotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyOrderTotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/EarningRuleLoyaltyTier.php b/src/Model/EarningRuleLoyaltyTier.php new file mode 100644 index 0000000..e74b024 --- /dev/null +++ b/src/Model/EarningRuleLoyaltyTier.php @@ -0,0 +1,418 @@ + + */ +class EarningRuleLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/EarningRuleSegment.php b/src/Model/EarningRuleSegment.php new file mode 100644 index 0000000..471463e --- /dev/null +++ b/src/Model/EarningRuleSegment.php @@ -0,0 +1,418 @@ + + */ +class EarningRuleSegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleSegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/EarningRuleSource.php b/src/Model/EarningRuleSource.php new file mode 100644 index 0000000..f3b15c1 --- /dev/null +++ b/src/Model/EarningRuleSource.php @@ -0,0 +1,532 @@ + + */ +class EarningRuleSource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EarningRuleSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string', + 'objectId' => 'string', + 'objectType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null, + 'objectId' => null, + 'objectType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true, + 'objectId' => true, + 'objectType' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner', + 'objectId' => 'object_id', + 'objectType' => 'object_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner', + 'objectId' => 'setObjectId', + 'objectType' => 'setObjectType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner', + 'objectId' => 'getObjectId', + 'objectType' => 'getObjectType' + ]; + + /** + * 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 OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectTypeAllowableValues() + { + return [ + self::OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('banner', $data ?? [], null); + $this->setIfExists('objectId', $data ?? [], null); + $this->setIfExists('objectType', $data ?? [], 'campaign'); + } + + /** + * 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->getObjectTypeAllowableValues(); + if (!is_null($this->container['objectType']) && !in_array($this->container['objectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'objectType', must be one of '%s'", + $this->container['objectType'], + 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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets objectId + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['objectId']; + } + + /** + * Sets objectId + * + * @param string|null $objectId A unique campaign identifier assigned by the Voucherify API. + * + * @return self + */ + public function setObjectId($objectId) + { + if (is_null($objectId)) { + array_push($this->openAPINullablesSetToNull, 'objectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['objectId'] = $objectId; + + return $this; + } + + /** + * Gets objectType + * + * @return string|null + */ + public function getObjectType() + { + return $this->container['objectType']; + } + + /** + * Sets objectType + * + * @param string|null $objectType Defines the object associated with the earning rule. Defaults to `campaign`. + * + * @return self + */ + public function setObjectType($objectType) + { + if (is_null($objectType)) { + array_push($this->openAPINullablesSetToNull, 'objectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectTypeAllowableValues(); + if (!is_null($objectType) && !in_array($objectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'objectType', must be one of '%s'", + $objectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['objectType'] = $objectType; + + 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/Error.php b/src/Model/Error.php new file mode 100644 index 0000000..e8a38c0 --- /dev/null +++ b/src/Model/Error.php @@ -0,0 +1,664 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'int', + 'key' => 'string', + 'message' => 'string', + 'details' => 'string', + 'requestId' => 'string', + 'resourceId' => 'string', + 'resourceType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'key' => null, + 'message' => null, + 'details' => null, + 'requestId' => null, + 'resourceId' => null, + 'resourceType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'key' => true, + 'message' => true, + 'details' => true, + 'requestId' => true, + 'resourceId' => true, + 'resourceType' => true + ]; + + /** + * 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 = [ + 'code' => 'code', + 'key' => 'key', + 'message' => 'message', + 'details' => 'details', + 'requestId' => 'request_id', + 'resourceId' => 'resource_id', + 'resourceType' => 'resource_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'key' => 'setKey', + 'message' => 'setMessage', + 'details' => 'setDetails', + 'requestId' => 'setRequestId', + 'resourceId' => 'setResourceId', + 'resourceType' => 'setResourceType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'key' => 'getKey', + 'message' => 'getMessage', + 'details' => 'getDetails', + 'requestId' => 'getRequestId', + 'resourceId' => 'getResourceId', + 'resourceType' => 'getResourceType' + ]; + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('key', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + $this->setIfExists('requestId', $data ?? [], null); + $this->setIfExists('resourceId', $data ?? [], null); + $this->setIfExists('resourceType', $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 code + * + * @return int|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param int|null $code Error's HTTP status code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key Short string describing the kind of error which occurred. + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + array_push($this->openAPINullablesSetToNull, 'key'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('key', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message A human-readable message providing a short description about the error. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets details + * + * @return string|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param string|null $details A human-readable message providing more details about the error. + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + array_push($this->openAPINullablesSetToNull, 'details'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('details', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['details'] = $details; + + return $this; + } + + /** + * Gets requestId + * + * @return string|null + */ + public function getRequestId() + { + return $this->container['requestId']; + } + + /** + * Sets requestId + * + * @param string|null $requestId This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team. + * + * @return self + */ + public function setRequestId($requestId) + { + if (is_null($requestId)) { + array_push($this->openAPINullablesSetToNull, 'requestId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('requestId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['requestId'] = $requestId; + + return $this; + } + + /** + * Gets resourceId + * + * @return string|null + */ + public function getResourceId() + { + return $this->container['resourceId']; + } + + /** + * Sets resourceId + * + * @param string|null $resourceId Unique resource ID that can be used in another endpoint to get more details. + * + * @return self + */ + public function setResourceId($resourceId) + { + if (is_null($resourceId)) { + array_push($this->openAPINullablesSetToNull, 'resourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('resourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['resourceId'] = $resourceId; + + return $this; + } + + /** + * Gets resourceType + * + * @return string|null + */ + public function getResourceType() + { + return $this->container['resourceType']; + } + + /** + * Sets resourceType + * + * @param string|null $resourceType The resource type. + * + * @return self + */ + public function setResourceType($resourceType) + { + if (is_null($resourceType)) { + array_push($this->openAPINullablesSetToNull, 'resourceType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('resourceType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['resourceType'] = $resourceType; + + 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/EventsCreateRequestBody.php b/src/Model/EventsCreateRequestBody.php new file mode 100644 index 0000000..7bdfec6 --- /dev/null +++ b/src/Model/EventsCreateRequestBody.php @@ -0,0 +1,593 @@ + + */ +class EventsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EventsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'event' => 'string', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'referral' => '\OpenAPI\Client\Model\EventsCreateRequestBodyReferral', + 'loyalty' => '\OpenAPI\Client\Model\EventsCreateRequestBodyLoyalty', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'event' => null, + 'customer' => null, + 'referral' => null, + 'loyalty' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'event' => true, + 'customer' => false, + 'referral' => true, + 'loyalty' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'event' => 'event', + 'customer' => 'customer', + 'referral' => 'referral', + 'loyalty' => 'loyalty', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'event' => 'setEvent', + 'customer' => 'setCustomer', + 'referral' => 'setReferral', + 'loyalty' => 'setLoyalty', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'event' => 'getEvent', + 'customer' => 'getCustomer', + 'referral' => 'getReferral', + 'loyalty' => 'getLoyalty', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('event', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referral', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('metadata', $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 = []; + + if (!is_null($this->container['event']) && (mb_strlen($this->container['event']) > 300)) { + $invalidProperties[] = "invalid value for 'event', the character length must be smaller than or equal to 300."; + } + + if (!is_null($this->container['event']) && (mb_strlen($this->container['event']) < 1)) { + $invalidProperties[] = "invalid value for 'event', the character length must be bigger than or equal to 1."; + } + + if ($this->container['customer'] === null) { + $invalidProperties[] = "'customer' can't be null"; + } + 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 event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($event) && (mb_strlen($event) > 300)) { + throw new \InvalidArgumentException('invalid length for $event when calling EventsCreateRequestBody., must be smaller than or equal to 300.'); + } + if (!is_null($event) && (mb_strlen($event) < 1)) { + throw new \InvalidArgumentException('invalid length for $event when calling EventsCreateRequestBody., must be bigger than or equal to 1.'); + } + + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referral + * + * @return \OpenAPI\Client\Model\EventsCreateRequestBodyReferral|null + */ + public function getReferral() + { + return $this->container['referral']; + } + + /** + * Sets referral + * + * @param \OpenAPI\Client\Model\EventsCreateRequestBodyReferral|null $referral referral + * + * @return self + */ + public function setReferral($referral) + { + if (is_null($referral)) { + array_push($this->openAPINullablesSetToNull, 'referral'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referral', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referral'] = $referral; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\EventsCreateRequestBodyLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\EventsCreateRequestBodyLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/EventsCreateRequestBodyLoyalty.php b/src/Model/EventsCreateRequestBodyLoyalty.php new file mode 100644 index 0000000..badc4cf --- /dev/null +++ b/src/Model/EventsCreateRequestBodyLoyalty.php @@ -0,0 +1,418 @@ + + */ +class EventsCreateRequestBodyLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EventsCreateRequestBodyLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true + ]; + + /** + * 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 = [ + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode' + ]; + + /** + * 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('code', $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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + 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/EventsCreateRequestBodyReferral.php b/src/Model/EventsCreateRequestBodyReferral.php new file mode 100644 index 0000000..d8975ac --- /dev/null +++ b/src/Model/EventsCreateRequestBodyReferral.php @@ -0,0 +1,459 @@ + + */ +class EventsCreateRequestBodyReferral implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EventsCreateRequestBodyReferral'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'referrerId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'referrerId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'referrerId' => true + ]; + + /** + * 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 = [ + 'code' => 'code', + 'referrerId' => 'referrer_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'referrerId' => 'setReferrerId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'referrerId' => 'getReferrerId' + ]; + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('referrerId', $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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code through which a new visitor has been referred to a service. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique ID of the referring person - it is optional and not required if the referral **code** is provided. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + 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/EventsCreateResponseBody.php b/src/Model/EventsCreateResponseBody.php new file mode 100644 index 0000000..0c045cc --- /dev/null +++ b/src/Model/EventsCreateResponseBody.php @@ -0,0 +1,651 @@ + + */ +class EventsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'EventsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'type' => 'string', + 'customer' => '\OpenAPI\Client\Model\SimpleCustomerRequiredObjectType', + 'referral' => 'object', + 'loyalty' => 'object', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'type' => null, + 'customer' => null, + 'referral' => null, + 'loyalty' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'type' => true, + 'customer' => false, + 'referral' => true, + 'loyalty' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'type' => 'type', + 'customer' => 'customer', + 'referral' => 'referral', + 'loyalty' => 'loyalty', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'type' => 'setType', + 'customer' => 'setCustomer', + 'referral' => 'setReferral', + 'loyalty' => 'setLoyalty', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'type' => 'getType', + 'customer' => 'getCustomer', + 'referral' => 'getReferral', + 'loyalty' => 'getLoyalty', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 OBJECT_EVENT = 'event'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EVENT, + ]; + } + + /** + * 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('object', $data ?? [], 'event'); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referral', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('metadata', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['customer'] === null) { + $invalidProperties[] = "'customer' can't be null"; + } + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The object represented is an `event`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The event name. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\SimpleCustomerRequiredObjectType + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\SimpleCustomerRequiredObjectType $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referral + * + * @return object|null + */ + public function getReferral() + { + return $this->container['referral']; + } + + /** + * Sets referral + * + * @param object|null $referral A `null` referral object. + * + * @return self + */ + public function setReferral($referral) + { + if (is_null($referral)) { + array_push($this->openAPINullablesSetToNull, 'referral'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referral', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referral'] = $referral; + + return $this; + } + + /** + * Gets loyalty + * + * @return object|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param object|null $loyalty A `null` loyalty object. + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/Export.php b/src/Model/Export.php new file mode 100644 index 0000000..ccbbab7 --- /dev/null +++ b/src/Model/Export.php @@ -0,0 +1,859 @@ + + */ +class Export implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Export'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'channel' => 'string', + 'result' => '\OpenAPI\Client\Model\ExportResult', + 'userId' => 'string', + 'exportedObject' => 'string', + 'parameters' => '\OpenAPI\Client\Model\ExportParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'status' => null, + 'channel' => null, + 'result' => null, + 'userId' => null, + 'exportedObject' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'status' => true, + 'channel' => true, + 'result' => true, + 'userId' => true, + 'exportedObject' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'status' => 'status', + 'channel' => 'channel', + 'result' => 'result', + 'userId' => 'user_id', + 'exportedObject' => 'exported_object', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'channel' => 'setChannel', + 'result' => 'setResult', + 'userId' => 'setUserId', + 'exportedObject' => 'setExportedObject', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'channel' => 'getChannel', + 'result' => 'getResult', + 'userId' => 'getUserId', + 'exportedObject' => 'getExportedObject', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_EXPORT = 'export'; + public const STATUS_SCHEDULED = 'SCHEDULED'; + public const STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const STATUS_DONE = 'DONE'; + public const STATUS_ERROR = 'ERROR'; + public const EXPORTED_OBJECT_VOUCHER = 'voucher'; + public const EXPORTED_OBJECT_REDEMPTION = 'redemption'; + public const EXPORTED_OBJECT_CUSTOMER = 'customer'; + public const EXPORTED_OBJECT_PUBLICATION = 'publication'; + public const EXPORTED_OBJECT_ORDER = 'order'; + public const EXPORTED_OBJECT_POINTS_EXPIRATION = 'points_expiration'; + public const EXPORTED_OBJECT_VOUCHER_TRANSACTIONS = 'voucher_transactions'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EXPORT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SCHEDULED, + self::STATUS_IN_PROGRESS, + self::STATUS_DONE, + self::STATUS_ERROR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportedObjectAllowableValues() + { + return [ + self::EXPORTED_OBJECT_VOUCHER, + self::EXPORTED_OBJECT_REDEMPTION, + self::EXPORTED_OBJECT_CUSTOMER, + self::EXPORTED_OBJECT_PUBLICATION, + self::EXPORTED_OBJECT_ORDER, + self::EXPORTED_OBJECT_POINTS_EXPIRATION, + self::EXPORTED_OBJECT_VOUCHER_TRANSACTIONS, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'export'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('userId', $data ?? [], null); + $this->setIfExists('exportedObject', $data ?? [], null); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($this->container['exportedObject']) && !in_array($this->container['exportedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exportedObject', must be one of '%s'", + $this->container['exportedObject'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique export ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of object being represented. This object stores information about the export. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel through which the export was triggered. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\ExportResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\ExportResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets userId + * + * @return string|null + */ + public function getUserId() + { + return $this->container['userId']; + } + + /** + * Sets userId + * + * @param string|null $userId Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. + * + * @return self + */ + public function setUserId($userId) + { + if (is_null($userId)) { + array_push($this->openAPINullablesSetToNull, 'userId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('userId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['userId'] = $userId; + + return $this; + } + + /** + * Gets exportedObject + * + * @return string|null + */ + public function getExportedObject() + { + return $this->container['exportedObject']; + } + + /** + * Sets exportedObject + * + * @param string|null $exportedObject exportedObject + * + * @return self + */ + public function setExportedObject($exportedObject) + { + if (is_null($exportedObject)) { + array_push($this->openAPINullablesSetToNull, 'exportedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exportedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($exportedObject) && !in_array($exportedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exportedObject', must be one of '%s'", + $exportedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exportedObject'] = $exportedObject; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\ExportParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\ExportParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/ExportParameters.php b/src/Model/ExportParameters.php new file mode 100644 index 0000000..a8763fd --- /dev/null +++ b/src/Model/ExportParameters.php @@ -0,0 +1,779 @@ + + */ +class ExportParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\ExportParametersFilters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => true + ]; + + /** + * 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const ORDER_UPDATED_AT = '-updated_at'; + public const ORDER_UPDATED_AT2 = 'updated_at'; + public const ORDER_CODE = '-code'; + public const ORDER_CODE2 = 'code'; + public const ORDER_ID = '-id'; + public const ORDER_ID2 = 'id'; + public const ORDER_VOUCHER_CODE = '-voucher_code'; + public const ORDER_VOUCHER_CODE2 = 'voucher_code'; + public const ORDER_TRACKING_ID = '-tracking_id'; + public const ORDER_TRACKING_ID2 = 'tracking_id'; + public const ORDER_CUSTOMER_ID = '-customer_id'; + public const ORDER_CUSTOMER_ID2 = 'customer_id'; + public const ORDER_NAME = '-name'; + public const ORDER_NAME2 = 'name'; + public const ORDER_EMAIL = '-email'; + public const ORDER_EMAIL2 = 'email'; + public const ORDER_SOURCE_ID = '-source_id'; + public const ORDER_SOURCE_ID2 = 'source_id'; + public const ORDER_CHANNEL = '-channel'; + public const ORDER_CHANNEL2 = 'channel'; + public const ORDER_STATUS = '-status'; + public const ORDER_STATUS2 = 'status'; + public const ORDER_EXPIRES_AT = '-expires_at'; + public const ORDER_EXPIRES_AT2 = 'expires_at'; + public const FIELDS_CODE = 'code'; + public const FIELDS_VOUCHER_TYPE = 'voucher_type'; + public const FIELDS_VALUE = 'value'; + public const FIELDS_FORMULA = 'formula'; + public const FIELDS_DISCOUNT_TYPE = 'discount_type'; + public const FIELDS_CAMPAIGN = 'campaign'; + public const FIELDS_CATEGORY = 'category'; + public const FIELDS_START_DATE = 'start_date'; + public const FIELDS_EXPIRATION_DATE = 'expiration_date'; + public const FIELDS_GIFT_BALANCE = 'gift_balance'; + public const FIELDS_LOYALTY_BALANCE = 'loyalty_balance'; + public const FIELDS_REDEMPTION_QUANTITY = 'redemption_quantity'; + public const FIELDS_REDEMPTION_COUNT = 'redemption_count'; + public const FIELDS_ACTIVE = 'active'; + public const FIELDS_QR_CODE = 'qr_code'; + public const FIELDS_BAR_CODE = 'bar_code'; + public const FIELDS_METADATA = 'metadata'; + public const FIELDS_ID = 'id'; + public const FIELDS_IS_REFERRAL_CODE = 'is_referral_code'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_UPDATED_AT = 'updated_at'; + public const FIELDS_VALIDITY_TIMEFRAME_INTERVAL = 'validity_timeframe_interval'; + public const FIELDS_VALIDITY_TIMEFRAME_DURATION = 'validity_timeframe_duration'; + public const FIELDS_VALIDITY_DAY_OF_WEEK = 'validity_day_of_week'; + public const FIELDS_DISCOUNT_AMOUNT_LIMIT = 'discount_amount_limit'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_ADDITIONAL_INFO = 'additional_info'; + public const FIELDS_CUSTOMER_ID = 'customer_id'; + public const FIELDS_DISCOUNT_EFFECT = 'discount_effect'; + public const FIELDS_DISCOUNT_UNIT_TYPE = 'discount_unit_type'; + public const FIELDS_DISCOUNT_UNIT_EFFECT = 'discount_unit_effect'; + public const FIELDS_VALIDATION_RULES_ID = 'validation_rules_id'; + public const FIELDS_CUSTOMER_SOURCE_ID = 'customer_source_id'; + public const FIELDS_OBJECT = 'object'; + public const FIELDS_DATE = 'date'; + public const FIELDS_VOUCHER_CODE = 'voucher_code'; + public const FIELDS_PROMOTION_TIER_ID = 'promotion_tier_id'; + public const FIELDS_CUSTOMER_NAME = 'customer_name'; + public const FIELDS_TRACKING_ID = 'tracking_id'; + public const FIELDS_ORDER_ID = 'order_id'; + public const FIELDS_ORDER_AMOUNT = 'order_amount'; + public const FIELDS_GIFT_AMOUNT = 'gift_amount'; + public const FIELDS_LOYALTY_POINTS = 'loyalty_points'; + public const FIELDS_RESULT = 'result'; + public const FIELDS_FAILURE_CODE = 'failure_code'; + public const FIELDS_FAILURE_MESSAGE = 'failure_message'; + public const FIELDS_NAME = 'name'; + public const FIELDS_DESCRIPTION = 'description'; + public const FIELDS_EMAIL = 'email'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_ADDRESS_CITY = 'address_city'; + public const FIELDS_ADDRESS_STATE = 'address_state'; + public const FIELDS_ADDRESS_LINE_1 = 'address_line_1'; + public const FIELDS_ADDRESS_LINE_2 = 'address_line_2'; + public const FIELDS_ADDRESS_COUNTRY = 'address_country'; + public const FIELDS_ADDRESS_POSTAL_CODE = 'address_postal_code'; + public const FIELDS_REDEMPTIONS_TOTAL_REDEEMED = 'redemptions_total_redeemed'; + public const FIELDS_REDEMPTIONS_TOTAL_FAILED = 'redemptions_total_failed'; + public const FIELDS_REDEMPTIONS_TOTAL_SUCCEEDED = 'redemptions_total_succeeded'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLED_BACK = 'redemptions_total_rolled_back'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_FAILED = 'redemptions_total_rollback_failed'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED = 'redemptions_total_rollback_succeeded'; + public const FIELDS_ORDERS_TOTAL_AMOUNT = 'orders_total_amount'; + public const FIELDS_ORDERS_TOTAL_COUNT = 'orders_total_count'; + public const FIELDS_ORDERS_AVERAGE_AMOUNT = 'orders_average_amount'; + public const FIELDS_ORDERS_LAST_ORDER_AMOUNT = 'orders_last_order_amount'; + public const FIELDS_ORDERS_LAST_ORDER_DATE = 'orders_last_order_date'; + public const FIELDS_LOYALTY_REFERRED_CUSTOMERS = 'loyalty_referred_customers'; + public const FIELDS_PHONE = 'phone'; + public const FIELDS_BIRTHDAY = 'birthday'; + public const FIELDS_BIRTHDATE = 'birthdate'; + public const FIELDS_CHANNEL = 'channel'; + public const FIELDS_IS_WINNER = 'is_winner'; + public const FIELDS_STATUS = 'status'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_DISCOUNT_AMOUNT = 'discount_amount'; + public const FIELDS_ITEMS_DISCOUNT_AMOUNT = 'items_discount_amount'; + public const FIELDS_TOTAL_DISCOUNT_AMOUNT = 'total_discount_amount'; + public const FIELDS_TOTAL_AMOUNT = 'total_amount'; + public const FIELDS_REFERRER_ID = 'referrer_id'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_POINTS = 'points'; + public const FIELDS_EXPIRES_AT = 'expires_at'; + public const FIELDS_TYPE = 'type'; + public const FIELDS_REASON = 'reason'; + public const FIELDS_SOURCE = 'source'; + public const FIELDS_BALANCE = 'balance'; + public const FIELDS_RELATED_TRANSACTION_ID = 'related_transaction_id'; + public const FIELDS_DETAILS = 'details'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + self::ORDER_UPDATED_AT, + self::ORDER_UPDATED_AT2, + self::ORDER_CODE, + self::ORDER_CODE2, + self::ORDER_ID, + self::ORDER_ID2, + self::ORDER_VOUCHER_CODE, + self::ORDER_VOUCHER_CODE2, + self::ORDER_TRACKING_ID, + self::ORDER_TRACKING_ID2, + self::ORDER_CUSTOMER_ID, + self::ORDER_CUSTOMER_ID2, + self::ORDER_NAME, + self::ORDER_NAME2, + self::ORDER_EMAIL, + self::ORDER_EMAIL2, + self::ORDER_SOURCE_ID, + self::ORDER_SOURCE_ID2, + self::ORDER_CHANNEL, + self::ORDER_CHANNEL2, + self::ORDER_STATUS, + self::ORDER_STATUS2, + self::ORDER_EXPIRES_AT, + self::ORDER_EXPIRES_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_CODE, + self::FIELDS_VOUCHER_TYPE, + self::FIELDS_VALUE, + self::FIELDS_FORMULA, + self::FIELDS_DISCOUNT_TYPE, + self::FIELDS_CAMPAIGN, + self::FIELDS_CATEGORY, + self::FIELDS_START_DATE, + self::FIELDS_EXPIRATION_DATE, + self::FIELDS_GIFT_BALANCE, + self::FIELDS_LOYALTY_BALANCE, + self::FIELDS_REDEMPTION_QUANTITY, + self::FIELDS_REDEMPTION_COUNT, + self::FIELDS_ACTIVE, + self::FIELDS_QR_CODE, + self::FIELDS_BAR_CODE, + self::FIELDS_METADATA, + self::FIELDS_ID, + self::FIELDS_IS_REFERRAL_CODE, + self::FIELDS_CREATED_AT, + self::FIELDS_UPDATED_AT, + self::FIELDS_VALIDITY_TIMEFRAME_INTERVAL, + self::FIELDS_VALIDITY_TIMEFRAME_DURATION, + self::FIELDS_VALIDITY_DAY_OF_WEEK, + self::FIELDS_DISCOUNT_AMOUNT_LIMIT, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_ADDITIONAL_INFO, + self::FIELDS_CUSTOMER_ID, + self::FIELDS_DISCOUNT_EFFECT, + self::FIELDS_DISCOUNT_UNIT_TYPE, + self::FIELDS_DISCOUNT_UNIT_EFFECT, + self::FIELDS_VALIDATION_RULES_ID, + self::FIELDS_CUSTOMER_SOURCE_ID, + self::FIELDS_OBJECT, + self::FIELDS_DATE, + self::FIELDS_VOUCHER_CODE, + self::FIELDS_PROMOTION_TIER_ID, + self::FIELDS_CUSTOMER_NAME, + self::FIELDS_TRACKING_ID, + self::FIELDS_ORDER_ID, + self::FIELDS_ORDER_AMOUNT, + self::FIELDS_GIFT_AMOUNT, + self::FIELDS_LOYALTY_POINTS, + self::FIELDS_RESULT, + self::FIELDS_FAILURE_CODE, + self::FIELDS_FAILURE_MESSAGE, + self::FIELDS_NAME, + self::FIELDS_DESCRIPTION, + self::FIELDS_EMAIL, + self::FIELDS_SOURCE_ID, + self::FIELDS_ADDRESS_CITY, + self::FIELDS_ADDRESS_STATE, + self::FIELDS_ADDRESS_LINE_1, + self::FIELDS_ADDRESS_LINE_2, + self::FIELDS_ADDRESS_COUNTRY, + self::FIELDS_ADDRESS_POSTAL_CODE, + self::FIELDS_REDEMPTIONS_TOTAL_REDEEMED, + self::FIELDS_REDEMPTIONS_TOTAL_FAILED, + self::FIELDS_REDEMPTIONS_TOTAL_SUCCEEDED, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLED_BACK, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_FAILED, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED, + self::FIELDS_ORDERS_TOTAL_AMOUNT, + self::FIELDS_ORDERS_TOTAL_COUNT, + self::FIELDS_ORDERS_AVERAGE_AMOUNT, + self::FIELDS_ORDERS_LAST_ORDER_AMOUNT, + self::FIELDS_ORDERS_LAST_ORDER_DATE, + self::FIELDS_LOYALTY_REFERRED_CUSTOMERS, + self::FIELDS_PHONE, + self::FIELDS_BIRTHDAY, + self::FIELDS_BIRTHDATE, + self::FIELDS_CHANNEL, + self::FIELDS_IS_WINNER, + self::FIELDS_STATUS, + self::FIELDS_AMOUNT, + self::FIELDS_DISCOUNT_AMOUNT, + self::FIELDS_ITEMS_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_AMOUNT, + self::FIELDS_REFERRER_ID, + self::FIELDS_VOUCHER_ID, + self::FIELDS_POINTS, + self::FIELDS_EXPIRES_AT, + self::FIELDS_TYPE, + self::FIELDS_REASON, + self::FIELDS_SOURCE, + self::FIELDS_BALANCE, + self::FIELDS_RELATED_TRANSACTION_ID, + self::FIELDS_DETAILS, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\ExportParametersFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\ExportParametersFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + array_push($this->openAPINullablesSetToNull, 'filters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filters'] = $filters; + + 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/ExportParametersFilters.php b/src/Model/ExportParametersFilters.php new file mode 100644 index 0000000..9fa420d --- /dev/null +++ b/src/Model/ExportParametersFilters.php @@ -0,0 +1,553 @@ + + */ +class ExportParametersFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportParametersFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'campaignId' => '\OpenAPI\Client\Model\FieldConditions', + 'voucherId' => '\OpenAPI\Client\Model\FieldConditions', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'campaignId' => null, + 'voucherId' => null, + 'createdAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'campaignId' => false, + 'voucherId' => false, + 'createdAt' => 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 = [ + 'junction' => 'junction', + 'campaignId' => 'campaign_id', + 'voucherId' => 'voucher_id', + 'createdAt' => 'created_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'campaignId' => 'setCampaignId', + 'voucherId' => 'setVoucherId', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'campaignId' => 'getCampaignId', + 'voucherId' => 'getVoucherId', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('createdAt', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + throw new \InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets voucherId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $voucherId voucherId + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + throw new \InvalidArgumentException('non-nullable voucherId cannot be null'); + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + 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/ExportResult.php b/src/Model/ExportResult.php new file mode 100644 index 0000000..d2ed358 --- /dev/null +++ b/src/Model/ExportResult.php @@ -0,0 +1,417 @@ + + */ +class ExportResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'url' => true + ]; + + /** + * 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 = [ + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'url' => 'getUrl' + ]; + + /** + * 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('url', $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 url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL of the CSV file location. It contains the token used for authorization in the Download export method. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/ExportVoucherTransactionsFilters.php b/src/Model/ExportVoucherTransactionsFilters.php new file mode 100644 index 0000000..ce98a33 --- /dev/null +++ b/src/Model/ExportVoucherTransactionsFilters.php @@ -0,0 +1,553 @@ + + */ +class ExportVoucherTransactionsFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportVoucherTransactionsFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions', + 'voucherId' => '\OpenAPI\Client\Model\FieldConditions', + 'campaignId' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'createdAt' => null, + 'voucherId' => null, + 'campaignId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'createdAt' => false, + 'voucherId' => false, + 'campaignId' => 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 = [ + 'junction' => 'junction', + 'createdAt' => 'created_at', + 'voucherId' => 'voucher_id', + 'campaignId' => 'campaign_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'createdAt' => 'setCreatedAt', + 'voucherId' => 'setVoucherId', + 'campaignId' => 'setCampaignId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'createdAt' => 'getCreatedAt', + 'voucherId' => 'getVoucherId', + 'campaignId' => 'getCampaignId' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('campaignId', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets voucherId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $voucherId voucherId + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + throw new \InvalidArgumentException('non-nullable voucherId cannot be null'); + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + throw new \InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + 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/ExportsCreateRequestBody.php b/src/Model/ExportsCreateRequestBody.php new file mode 100644 index 0000000..c5d777c --- /dev/null +++ b/src/Model/ExportsCreateRequestBody.php @@ -0,0 +1,502 @@ + + */ +class ExportsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exportedObject' => 'string', + 'parameters' => '\OpenAPI\Client\Model\ExportsCreateRequestBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exportedObject' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'exportedObject' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'exportedObject' => 'exported_object', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exportedObject' => 'setExportedObject', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exportedObject' => 'getExportedObject', + 'parameters' => 'getParameters' + ]; + + /** + * 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 EXPORTED_OBJECT_VOUCHER = 'voucher'; + public const EXPORTED_OBJECT_REDEMPTION = 'redemption'; + public const EXPORTED_OBJECT_CUSTOMER = 'customer'; + public const EXPORTED_OBJECT_PUBLICATION = 'publication'; + public const EXPORTED_OBJECT_ORDER = 'order'; + public const EXPORTED_OBJECT_POINTS_EXPIRATION = 'points_expiration'; + public const EXPORTED_OBJECT_VOUCHER_TRANSACTIONS = 'voucher_transactions'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportedObjectAllowableValues() + { + return [ + self::EXPORTED_OBJECT_VOUCHER, + self::EXPORTED_OBJECT_REDEMPTION, + self::EXPORTED_OBJECT_CUSTOMER, + self::EXPORTED_OBJECT_PUBLICATION, + self::EXPORTED_OBJECT_ORDER, + self::EXPORTED_OBJECT_POINTS_EXPIRATION, + self::EXPORTED_OBJECT_VOUCHER_TRANSACTIONS, + ]; + } + + /** + * 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('exportedObject', $data ?? [], null); + $this->setIfExists('parameters', $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->getExportedObjectAllowableValues(); + if (!is_null($this->container['exportedObject']) && !in_array($this->container['exportedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exportedObject', must be one of '%s'", + $this->container['exportedObject'], + 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 exportedObject + * + * @return string|null + */ + public function getExportedObject() + { + return $this->container['exportedObject']; + } + + /** + * Sets exportedObject + * + * @param string|null $exportedObject exportedObject + * + * @return self + */ + public function setExportedObject($exportedObject) + { + if (is_null($exportedObject)) { + array_push($this->openAPINullablesSetToNull, 'exportedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exportedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($exportedObject) && !in_array($exportedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exportedObject', must be one of '%s'", + $exportedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exportedObject'] = $exportedObject; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\ExportsCreateRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\ExportsCreateRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/ExportsCreateRequestBodyParameters.php b/src/Model/ExportsCreateRequestBodyParameters.php new file mode 100644 index 0000000..2c070b0 --- /dev/null +++ b/src/Model/ExportsCreateRequestBodyParameters.php @@ -0,0 +1,779 @@ + + */ +class ExportsCreateRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsCreateRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\ExportsCreateRequestBodyParametersFilters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => true + ]; + + /** + * 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const ORDER_UPDATED_AT = '-updated_at'; + public const ORDER_UPDATED_AT2 = 'updated_at'; + public const ORDER_CODE = '-code'; + public const ORDER_CODE2 = 'code'; + public const ORDER_ID = '-id'; + public const ORDER_ID2 = 'id'; + public const ORDER_VOUCHER_CODE = '-voucher_code'; + public const ORDER_VOUCHER_CODE2 = 'voucher_code'; + public const ORDER_TRACKING_ID = '-tracking_id'; + public const ORDER_TRACKING_ID2 = 'tracking_id'; + public const ORDER_CUSTOMER_ID = '-customer_id'; + public const ORDER_CUSTOMER_ID2 = 'customer_id'; + public const ORDER_NAME = '-name'; + public const ORDER_NAME2 = 'name'; + public const ORDER_EMAIL = '-email'; + public const ORDER_EMAIL2 = 'email'; + public const ORDER_SOURCE_ID = '-source_id'; + public const ORDER_SOURCE_ID2 = 'source_id'; + public const ORDER_CHANNEL = '-channel'; + public const ORDER_CHANNEL2 = 'channel'; + public const ORDER_STATUS = '-status'; + public const ORDER_STATUS2 = 'status'; + public const ORDER_EXPIRES_AT = '-expires_at'; + public const ORDER_EXPIRES_AT2 = 'expires_at'; + public const FIELDS_CODE = 'code'; + public const FIELDS_VOUCHER_TYPE = 'voucher_type'; + public const FIELDS_VALUE = 'value'; + public const FIELDS_FORMULA = 'formula'; + public const FIELDS_DISCOUNT_TYPE = 'discount_type'; + public const FIELDS_CAMPAIGN = 'campaign'; + public const FIELDS_CATEGORY = 'category'; + public const FIELDS_START_DATE = 'start_date'; + public const FIELDS_EXPIRATION_DATE = 'expiration_date'; + public const FIELDS_GIFT_BALANCE = 'gift_balance'; + public const FIELDS_LOYALTY_BALANCE = 'loyalty_balance'; + public const FIELDS_REDEMPTION_QUANTITY = 'redemption_quantity'; + public const FIELDS_REDEMPTION_COUNT = 'redemption_count'; + public const FIELDS_ACTIVE = 'active'; + public const FIELDS_QR_CODE = 'qr_code'; + public const FIELDS_BAR_CODE = 'bar_code'; + public const FIELDS_METADATA = 'metadata'; + public const FIELDS_ID = 'id'; + public const FIELDS_IS_REFERRAL_CODE = 'is_referral_code'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_UPDATED_AT = 'updated_at'; + public const FIELDS_VALIDITY_TIMEFRAME_INTERVAL = 'validity_timeframe_interval'; + public const FIELDS_VALIDITY_TIMEFRAME_DURATION = 'validity_timeframe_duration'; + public const FIELDS_VALIDITY_DAY_OF_WEEK = 'validity_day_of_week'; + public const FIELDS_DISCOUNT_AMOUNT_LIMIT = 'discount_amount_limit'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_ADDITIONAL_INFO = 'additional_info'; + public const FIELDS_CUSTOMER_ID = 'customer_id'; + public const FIELDS_DISCOUNT_EFFECT = 'discount_effect'; + public const FIELDS_DISCOUNT_UNIT_TYPE = 'discount_unit_type'; + public const FIELDS_DISCOUNT_UNIT_EFFECT = 'discount_unit_effect'; + public const FIELDS_VALIDATION_RULES_ID = 'validation_rules_id'; + public const FIELDS_CUSTOMER_SOURCE_ID = 'customer_source_id'; + public const FIELDS_OBJECT = 'object'; + public const FIELDS_DATE = 'date'; + public const FIELDS_VOUCHER_CODE = 'voucher_code'; + public const FIELDS_PROMOTION_TIER_ID = 'promotion_tier_id'; + public const FIELDS_CUSTOMER_NAME = 'customer_name'; + public const FIELDS_TRACKING_ID = 'tracking_id'; + public const FIELDS_ORDER_ID = 'order_id'; + public const FIELDS_ORDER_AMOUNT = 'order_amount'; + public const FIELDS_GIFT_AMOUNT = 'gift_amount'; + public const FIELDS_LOYALTY_POINTS = 'loyalty_points'; + public const FIELDS_RESULT = 'result'; + public const FIELDS_FAILURE_CODE = 'failure_code'; + public const FIELDS_FAILURE_MESSAGE = 'failure_message'; + public const FIELDS_NAME = 'name'; + public const FIELDS_DESCRIPTION = 'description'; + public const FIELDS_EMAIL = 'email'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_ADDRESS_CITY = 'address_city'; + public const FIELDS_ADDRESS_STATE = 'address_state'; + public const FIELDS_ADDRESS_LINE_1 = 'address_line_1'; + public const FIELDS_ADDRESS_LINE_2 = 'address_line_2'; + public const FIELDS_ADDRESS_COUNTRY = 'address_country'; + public const FIELDS_ADDRESS_POSTAL_CODE = 'address_postal_code'; + public const FIELDS_REDEMPTIONS_TOTAL_REDEEMED = 'redemptions_total_redeemed'; + public const FIELDS_REDEMPTIONS_TOTAL_FAILED = 'redemptions_total_failed'; + public const FIELDS_REDEMPTIONS_TOTAL_SUCCEEDED = 'redemptions_total_succeeded'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLED_BACK = 'redemptions_total_rolled_back'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_FAILED = 'redemptions_total_rollback_failed'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED = 'redemptions_total_rollback_succeeded'; + public const FIELDS_ORDERS_TOTAL_AMOUNT = 'orders_total_amount'; + public const FIELDS_ORDERS_TOTAL_COUNT = 'orders_total_count'; + public const FIELDS_ORDERS_AVERAGE_AMOUNT = 'orders_average_amount'; + public const FIELDS_ORDERS_LAST_ORDER_AMOUNT = 'orders_last_order_amount'; + public const FIELDS_ORDERS_LAST_ORDER_DATE = 'orders_last_order_date'; + public const FIELDS_LOYALTY_REFERRED_CUSTOMERS = 'loyalty_referred_customers'; + public const FIELDS_PHONE = 'phone'; + public const FIELDS_BIRTHDAY = 'birthday'; + public const FIELDS_BIRTHDATE = 'birthdate'; + public const FIELDS_CHANNEL = 'channel'; + public const FIELDS_IS_WINNER = 'is_winner'; + public const FIELDS_STATUS = 'status'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_DISCOUNT_AMOUNT = 'discount_amount'; + public const FIELDS_ITEMS_DISCOUNT_AMOUNT = 'items_discount_amount'; + public const FIELDS_TOTAL_DISCOUNT_AMOUNT = 'total_discount_amount'; + public const FIELDS_TOTAL_AMOUNT = 'total_amount'; + public const FIELDS_REFERRER_ID = 'referrer_id'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_POINTS = 'points'; + public const FIELDS_EXPIRES_AT = 'expires_at'; + public const FIELDS_TYPE = 'type'; + public const FIELDS_REASON = 'reason'; + public const FIELDS_SOURCE = 'source'; + public const FIELDS_BALANCE = 'balance'; + public const FIELDS_RELATED_TRANSACTION_ID = 'related_transaction_id'; + public const FIELDS_DETAILS = 'details'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + self::ORDER_UPDATED_AT, + self::ORDER_UPDATED_AT2, + self::ORDER_CODE, + self::ORDER_CODE2, + self::ORDER_ID, + self::ORDER_ID2, + self::ORDER_VOUCHER_CODE, + self::ORDER_VOUCHER_CODE2, + self::ORDER_TRACKING_ID, + self::ORDER_TRACKING_ID2, + self::ORDER_CUSTOMER_ID, + self::ORDER_CUSTOMER_ID2, + self::ORDER_NAME, + self::ORDER_NAME2, + self::ORDER_EMAIL, + self::ORDER_EMAIL2, + self::ORDER_SOURCE_ID, + self::ORDER_SOURCE_ID2, + self::ORDER_CHANNEL, + self::ORDER_CHANNEL2, + self::ORDER_STATUS, + self::ORDER_STATUS2, + self::ORDER_EXPIRES_AT, + self::ORDER_EXPIRES_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_CODE, + self::FIELDS_VOUCHER_TYPE, + self::FIELDS_VALUE, + self::FIELDS_FORMULA, + self::FIELDS_DISCOUNT_TYPE, + self::FIELDS_CAMPAIGN, + self::FIELDS_CATEGORY, + self::FIELDS_START_DATE, + self::FIELDS_EXPIRATION_DATE, + self::FIELDS_GIFT_BALANCE, + self::FIELDS_LOYALTY_BALANCE, + self::FIELDS_REDEMPTION_QUANTITY, + self::FIELDS_REDEMPTION_COUNT, + self::FIELDS_ACTIVE, + self::FIELDS_QR_CODE, + self::FIELDS_BAR_CODE, + self::FIELDS_METADATA, + self::FIELDS_ID, + self::FIELDS_IS_REFERRAL_CODE, + self::FIELDS_CREATED_AT, + self::FIELDS_UPDATED_AT, + self::FIELDS_VALIDITY_TIMEFRAME_INTERVAL, + self::FIELDS_VALIDITY_TIMEFRAME_DURATION, + self::FIELDS_VALIDITY_DAY_OF_WEEK, + self::FIELDS_DISCOUNT_AMOUNT_LIMIT, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_ADDITIONAL_INFO, + self::FIELDS_CUSTOMER_ID, + self::FIELDS_DISCOUNT_EFFECT, + self::FIELDS_DISCOUNT_UNIT_TYPE, + self::FIELDS_DISCOUNT_UNIT_EFFECT, + self::FIELDS_VALIDATION_RULES_ID, + self::FIELDS_CUSTOMER_SOURCE_ID, + self::FIELDS_OBJECT, + self::FIELDS_DATE, + self::FIELDS_VOUCHER_CODE, + self::FIELDS_PROMOTION_TIER_ID, + self::FIELDS_CUSTOMER_NAME, + self::FIELDS_TRACKING_ID, + self::FIELDS_ORDER_ID, + self::FIELDS_ORDER_AMOUNT, + self::FIELDS_GIFT_AMOUNT, + self::FIELDS_LOYALTY_POINTS, + self::FIELDS_RESULT, + self::FIELDS_FAILURE_CODE, + self::FIELDS_FAILURE_MESSAGE, + self::FIELDS_NAME, + self::FIELDS_DESCRIPTION, + self::FIELDS_EMAIL, + self::FIELDS_SOURCE_ID, + self::FIELDS_ADDRESS_CITY, + self::FIELDS_ADDRESS_STATE, + self::FIELDS_ADDRESS_LINE_1, + self::FIELDS_ADDRESS_LINE_2, + self::FIELDS_ADDRESS_COUNTRY, + self::FIELDS_ADDRESS_POSTAL_CODE, + self::FIELDS_REDEMPTIONS_TOTAL_REDEEMED, + self::FIELDS_REDEMPTIONS_TOTAL_FAILED, + self::FIELDS_REDEMPTIONS_TOTAL_SUCCEEDED, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLED_BACK, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_FAILED, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED, + self::FIELDS_ORDERS_TOTAL_AMOUNT, + self::FIELDS_ORDERS_TOTAL_COUNT, + self::FIELDS_ORDERS_AVERAGE_AMOUNT, + self::FIELDS_ORDERS_LAST_ORDER_AMOUNT, + self::FIELDS_ORDERS_LAST_ORDER_DATE, + self::FIELDS_LOYALTY_REFERRED_CUSTOMERS, + self::FIELDS_PHONE, + self::FIELDS_BIRTHDAY, + self::FIELDS_BIRTHDATE, + self::FIELDS_CHANNEL, + self::FIELDS_IS_WINNER, + self::FIELDS_STATUS, + self::FIELDS_AMOUNT, + self::FIELDS_DISCOUNT_AMOUNT, + self::FIELDS_ITEMS_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_AMOUNT, + self::FIELDS_REFERRER_ID, + self::FIELDS_VOUCHER_ID, + self::FIELDS_POINTS, + self::FIELDS_EXPIRES_AT, + self::FIELDS_TYPE, + self::FIELDS_REASON, + self::FIELDS_SOURCE, + self::FIELDS_BALANCE, + self::FIELDS_RELATED_TRANSACTION_ID, + self::FIELDS_DETAILS, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\ExportsCreateRequestBodyParametersFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\ExportsCreateRequestBodyParametersFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + array_push($this->openAPINullablesSetToNull, 'filters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filters'] = $filters; + + 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/ExportsCreateRequestBodyParametersFilters.php b/src/Model/ExportsCreateRequestBodyParametersFilters.php new file mode 100644 index 0000000..d04a984 --- /dev/null +++ b/src/Model/ExportsCreateRequestBodyParametersFilters.php @@ -0,0 +1,553 @@ + + */ +class ExportsCreateRequestBodyParametersFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsCreateRequestBodyParametersFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'campaignId' => '\OpenAPI\Client\Model\FieldConditions', + 'voucherId' => '\OpenAPI\Client\Model\FieldConditions', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'campaignId' => null, + 'voucherId' => null, + 'createdAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'campaignId' => false, + 'voucherId' => false, + 'createdAt' => 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 = [ + 'junction' => 'junction', + 'campaignId' => 'campaign_id', + 'voucherId' => 'voucher_id', + 'createdAt' => 'created_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'campaignId' => 'setCampaignId', + 'voucherId' => 'setVoucherId', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'campaignId' => 'getCampaignId', + 'voucherId' => 'getVoucherId', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('createdAt', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + throw new \InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets voucherId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $voucherId voucherId + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + throw new \InvalidArgumentException('non-nullable voucherId cannot be null'); + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + 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/ExportsCreateResponseBody.php b/src/Model/ExportsCreateResponseBody.php new file mode 100644 index 0000000..45ec1fe --- /dev/null +++ b/src/Model/ExportsCreateResponseBody.php @@ -0,0 +1,853 @@ + + */ +class ExportsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'channel' => 'string', + 'result' => 'object', + 'userId' => 'string', + 'exportedObject' => 'string', + 'parameters' => '\OpenAPI\Client\Model\ExportsCreateResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'status' => null, + 'channel' => null, + 'result' => null, + 'userId' => null, + 'exportedObject' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'status' => true, + 'channel' => true, + 'result' => true, + 'userId' => true, + 'exportedObject' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'status' => 'status', + 'channel' => 'channel', + 'result' => 'result', + 'userId' => 'user_id', + 'exportedObject' => 'exported_object', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'channel' => 'setChannel', + 'result' => 'setResult', + 'userId' => 'setUserId', + 'exportedObject' => 'setExportedObject', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'channel' => 'getChannel', + 'result' => 'getResult', + 'userId' => 'getUserId', + 'exportedObject' => 'getExportedObject', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_EXPORT = 'export'; + public const STATUS_SCHEDULED = 'SCHEDULED'; + public const EXPORTED_OBJECT_VOUCHER = 'voucher'; + public const EXPORTED_OBJECT_REDEMPTION = 'redemption'; + public const EXPORTED_OBJECT_CUSTOMER = 'customer'; + public const EXPORTED_OBJECT_PUBLICATION = 'publication'; + public const EXPORTED_OBJECT_ORDER = 'order'; + public const EXPORTED_OBJECT_POINTS_EXPIRATION = 'points_expiration'; + public const EXPORTED_OBJECT_VOUCHER_TRANSACTIONS = 'voucher_transactions'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EXPORT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SCHEDULED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportedObjectAllowableValues() + { + return [ + self::EXPORTED_OBJECT_VOUCHER, + self::EXPORTED_OBJECT_REDEMPTION, + self::EXPORTED_OBJECT_CUSTOMER, + self::EXPORTED_OBJECT_PUBLICATION, + self::EXPORTED_OBJECT_ORDER, + self::EXPORTED_OBJECT_POINTS_EXPIRATION, + self::EXPORTED_OBJECT_VOUCHER_TRANSACTIONS, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'export'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], 'SCHEDULED'); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('userId', $data ?? [], null); + $this->setIfExists('exportedObject', $data ?? [], null); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($this->container['exportedObject']) && !in_array($this->container['exportedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exportedObject', must be one of '%s'", + $this->container['exportedObject'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique export ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of object being represented. This object stores information about the export. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel through which the export was triggered. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets result + * + * @return object|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param object|null $result Contains the URL of the CSV file. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets userId + * + * @return string|null + */ + public function getUserId() + { + return $this->container['userId']; + } + + /** + * Sets userId + * + * @param string|null $userId Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. + * + * @return self + */ + public function setUserId($userId) + { + if (is_null($userId)) { + array_push($this->openAPINullablesSetToNull, 'userId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('userId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['userId'] = $userId; + + return $this; + } + + /** + * Gets exportedObject + * + * @return string|null + */ + public function getExportedObject() + { + return $this->container['exportedObject']; + } + + /** + * Sets exportedObject + * + * @param string|null $exportedObject exportedObject + * + * @return self + */ + public function setExportedObject($exportedObject) + { + if (is_null($exportedObject)) { + array_push($this->openAPINullablesSetToNull, 'exportedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exportedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($exportedObject) && !in_array($exportedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exportedObject', must be one of '%s'", + $exportedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exportedObject'] = $exportedObject; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\ExportsCreateResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\ExportsCreateResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/ExportsCreateResponseBodyParameters.php b/src/Model/ExportsCreateResponseBodyParameters.php new file mode 100644 index 0000000..a1895ea --- /dev/null +++ b/src/Model/ExportsCreateResponseBodyParameters.php @@ -0,0 +1,779 @@ + + */ +class ExportsCreateResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsCreateResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\ExportsCreateResponseBodyParametersFilters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => true + ]; + + /** + * 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const ORDER_UPDATED_AT = '-updated_at'; + public const ORDER_UPDATED_AT2 = 'updated_at'; + public const ORDER_CODE = '-code'; + public const ORDER_CODE2 = 'code'; + public const ORDER_ID = '-id'; + public const ORDER_ID2 = 'id'; + public const ORDER_VOUCHER_CODE = '-voucher_code'; + public const ORDER_VOUCHER_CODE2 = 'voucher_code'; + public const ORDER_TRACKING_ID = '-tracking_id'; + public const ORDER_TRACKING_ID2 = 'tracking_id'; + public const ORDER_CUSTOMER_ID = '-customer_id'; + public const ORDER_CUSTOMER_ID2 = 'customer_id'; + public const ORDER_NAME = '-name'; + public const ORDER_NAME2 = 'name'; + public const ORDER_EMAIL = '-email'; + public const ORDER_EMAIL2 = 'email'; + public const ORDER_SOURCE_ID = '-source_id'; + public const ORDER_SOURCE_ID2 = 'source_id'; + public const ORDER_CHANNEL = '-channel'; + public const ORDER_CHANNEL2 = 'channel'; + public const ORDER_STATUS = '-status'; + public const ORDER_STATUS2 = 'status'; + public const ORDER_EXPIRES_AT = '-expires_at'; + public const ORDER_EXPIRES_AT2 = 'expires_at'; + public const FIELDS_CODE = 'code'; + public const FIELDS_VOUCHER_TYPE = 'voucher_type'; + public const FIELDS_VALUE = 'value'; + public const FIELDS_FORMULA = 'formula'; + public const FIELDS_DISCOUNT_TYPE = 'discount_type'; + public const FIELDS_CAMPAIGN = 'campaign'; + public const FIELDS_CATEGORY = 'category'; + public const FIELDS_START_DATE = 'start_date'; + public const FIELDS_EXPIRATION_DATE = 'expiration_date'; + public const FIELDS_GIFT_BALANCE = 'gift_balance'; + public const FIELDS_LOYALTY_BALANCE = 'loyalty_balance'; + public const FIELDS_REDEMPTION_QUANTITY = 'redemption_quantity'; + public const FIELDS_REDEMPTION_COUNT = 'redemption_count'; + public const FIELDS_ACTIVE = 'active'; + public const FIELDS_QR_CODE = 'qr_code'; + public const FIELDS_BAR_CODE = 'bar_code'; + public const FIELDS_METADATA = 'metadata'; + public const FIELDS_ID = 'id'; + public const FIELDS_IS_REFERRAL_CODE = 'is_referral_code'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_UPDATED_AT = 'updated_at'; + public const FIELDS_VALIDITY_TIMEFRAME_INTERVAL = 'validity_timeframe_interval'; + public const FIELDS_VALIDITY_TIMEFRAME_DURATION = 'validity_timeframe_duration'; + public const FIELDS_VALIDITY_DAY_OF_WEEK = 'validity_day_of_week'; + public const FIELDS_DISCOUNT_AMOUNT_LIMIT = 'discount_amount_limit'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_ADDITIONAL_INFO = 'additional_info'; + public const FIELDS_CUSTOMER_ID = 'customer_id'; + public const FIELDS_DISCOUNT_EFFECT = 'discount_effect'; + public const FIELDS_DISCOUNT_UNIT_TYPE = 'discount_unit_type'; + public const FIELDS_DISCOUNT_UNIT_EFFECT = 'discount_unit_effect'; + public const FIELDS_VALIDATION_RULES_ID = 'validation_rules_id'; + public const FIELDS_CUSTOMER_SOURCE_ID = 'customer_source_id'; + public const FIELDS_OBJECT = 'object'; + public const FIELDS_DATE = 'date'; + public const FIELDS_VOUCHER_CODE = 'voucher_code'; + public const FIELDS_PROMOTION_TIER_ID = 'promotion_tier_id'; + public const FIELDS_CUSTOMER_NAME = 'customer_name'; + public const FIELDS_TRACKING_ID = 'tracking_id'; + public const FIELDS_ORDER_ID = 'order_id'; + public const FIELDS_ORDER_AMOUNT = 'order_amount'; + public const FIELDS_GIFT_AMOUNT = 'gift_amount'; + public const FIELDS_LOYALTY_POINTS = 'loyalty_points'; + public const FIELDS_RESULT = 'result'; + public const FIELDS_FAILURE_CODE = 'failure_code'; + public const FIELDS_FAILURE_MESSAGE = 'failure_message'; + public const FIELDS_NAME = 'name'; + public const FIELDS_DESCRIPTION = 'description'; + public const FIELDS_EMAIL = 'email'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_ADDRESS_CITY = 'address_city'; + public const FIELDS_ADDRESS_STATE = 'address_state'; + public const FIELDS_ADDRESS_LINE_1 = 'address_line_1'; + public const FIELDS_ADDRESS_LINE_2 = 'address_line_2'; + public const FIELDS_ADDRESS_COUNTRY = 'address_country'; + public const FIELDS_ADDRESS_POSTAL_CODE = 'address_postal_code'; + public const FIELDS_REDEMPTIONS_TOTAL_REDEEMED = 'redemptions_total_redeemed'; + public const FIELDS_REDEMPTIONS_TOTAL_FAILED = 'redemptions_total_failed'; + public const FIELDS_REDEMPTIONS_TOTAL_SUCCEEDED = 'redemptions_total_succeeded'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLED_BACK = 'redemptions_total_rolled_back'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_FAILED = 'redemptions_total_rollback_failed'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED = 'redemptions_total_rollback_succeeded'; + public const FIELDS_ORDERS_TOTAL_AMOUNT = 'orders_total_amount'; + public const FIELDS_ORDERS_TOTAL_COUNT = 'orders_total_count'; + public const FIELDS_ORDERS_AVERAGE_AMOUNT = 'orders_average_amount'; + public const FIELDS_ORDERS_LAST_ORDER_AMOUNT = 'orders_last_order_amount'; + public const FIELDS_ORDERS_LAST_ORDER_DATE = 'orders_last_order_date'; + public const FIELDS_LOYALTY_REFERRED_CUSTOMERS = 'loyalty_referred_customers'; + public const FIELDS_PHONE = 'phone'; + public const FIELDS_BIRTHDAY = 'birthday'; + public const FIELDS_BIRTHDATE = 'birthdate'; + public const FIELDS_CHANNEL = 'channel'; + public const FIELDS_IS_WINNER = 'is_winner'; + public const FIELDS_STATUS = 'status'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_DISCOUNT_AMOUNT = 'discount_amount'; + public const FIELDS_ITEMS_DISCOUNT_AMOUNT = 'items_discount_amount'; + public const FIELDS_TOTAL_DISCOUNT_AMOUNT = 'total_discount_amount'; + public const FIELDS_TOTAL_AMOUNT = 'total_amount'; + public const FIELDS_REFERRER_ID = 'referrer_id'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_POINTS = 'points'; + public const FIELDS_EXPIRES_AT = 'expires_at'; + public const FIELDS_TYPE = 'type'; + public const FIELDS_REASON = 'reason'; + public const FIELDS_SOURCE = 'source'; + public const FIELDS_BALANCE = 'balance'; + public const FIELDS_RELATED_TRANSACTION_ID = 'related_transaction_id'; + public const FIELDS_DETAILS = 'details'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + self::ORDER_UPDATED_AT, + self::ORDER_UPDATED_AT2, + self::ORDER_CODE, + self::ORDER_CODE2, + self::ORDER_ID, + self::ORDER_ID2, + self::ORDER_VOUCHER_CODE, + self::ORDER_VOUCHER_CODE2, + self::ORDER_TRACKING_ID, + self::ORDER_TRACKING_ID2, + self::ORDER_CUSTOMER_ID, + self::ORDER_CUSTOMER_ID2, + self::ORDER_NAME, + self::ORDER_NAME2, + self::ORDER_EMAIL, + self::ORDER_EMAIL2, + self::ORDER_SOURCE_ID, + self::ORDER_SOURCE_ID2, + self::ORDER_CHANNEL, + self::ORDER_CHANNEL2, + self::ORDER_STATUS, + self::ORDER_STATUS2, + self::ORDER_EXPIRES_AT, + self::ORDER_EXPIRES_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_CODE, + self::FIELDS_VOUCHER_TYPE, + self::FIELDS_VALUE, + self::FIELDS_FORMULA, + self::FIELDS_DISCOUNT_TYPE, + self::FIELDS_CAMPAIGN, + self::FIELDS_CATEGORY, + self::FIELDS_START_DATE, + self::FIELDS_EXPIRATION_DATE, + self::FIELDS_GIFT_BALANCE, + self::FIELDS_LOYALTY_BALANCE, + self::FIELDS_REDEMPTION_QUANTITY, + self::FIELDS_REDEMPTION_COUNT, + self::FIELDS_ACTIVE, + self::FIELDS_QR_CODE, + self::FIELDS_BAR_CODE, + self::FIELDS_METADATA, + self::FIELDS_ID, + self::FIELDS_IS_REFERRAL_CODE, + self::FIELDS_CREATED_AT, + self::FIELDS_UPDATED_AT, + self::FIELDS_VALIDITY_TIMEFRAME_INTERVAL, + self::FIELDS_VALIDITY_TIMEFRAME_DURATION, + self::FIELDS_VALIDITY_DAY_OF_WEEK, + self::FIELDS_DISCOUNT_AMOUNT_LIMIT, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_ADDITIONAL_INFO, + self::FIELDS_CUSTOMER_ID, + self::FIELDS_DISCOUNT_EFFECT, + self::FIELDS_DISCOUNT_UNIT_TYPE, + self::FIELDS_DISCOUNT_UNIT_EFFECT, + self::FIELDS_VALIDATION_RULES_ID, + self::FIELDS_CUSTOMER_SOURCE_ID, + self::FIELDS_OBJECT, + self::FIELDS_DATE, + self::FIELDS_VOUCHER_CODE, + self::FIELDS_PROMOTION_TIER_ID, + self::FIELDS_CUSTOMER_NAME, + self::FIELDS_TRACKING_ID, + self::FIELDS_ORDER_ID, + self::FIELDS_ORDER_AMOUNT, + self::FIELDS_GIFT_AMOUNT, + self::FIELDS_LOYALTY_POINTS, + self::FIELDS_RESULT, + self::FIELDS_FAILURE_CODE, + self::FIELDS_FAILURE_MESSAGE, + self::FIELDS_NAME, + self::FIELDS_DESCRIPTION, + self::FIELDS_EMAIL, + self::FIELDS_SOURCE_ID, + self::FIELDS_ADDRESS_CITY, + self::FIELDS_ADDRESS_STATE, + self::FIELDS_ADDRESS_LINE_1, + self::FIELDS_ADDRESS_LINE_2, + self::FIELDS_ADDRESS_COUNTRY, + self::FIELDS_ADDRESS_POSTAL_CODE, + self::FIELDS_REDEMPTIONS_TOTAL_REDEEMED, + self::FIELDS_REDEMPTIONS_TOTAL_FAILED, + self::FIELDS_REDEMPTIONS_TOTAL_SUCCEEDED, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLED_BACK, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_FAILED, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED, + self::FIELDS_ORDERS_TOTAL_AMOUNT, + self::FIELDS_ORDERS_TOTAL_COUNT, + self::FIELDS_ORDERS_AVERAGE_AMOUNT, + self::FIELDS_ORDERS_LAST_ORDER_AMOUNT, + self::FIELDS_ORDERS_LAST_ORDER_DATE, + self::FIELDS_LOYALTY_REFERRED_CUSTOMERS, + self::FIELDS_PHONE, + self::FIELDS_BIRTHDAY, + self::FIELDS_BIRTHDATE, + self::FIELDS_CHANNEL, + self::FIELDS_IS_WINNER, + self::FIELDS_STATUS, + self::FIELDS_AMOUNT, + self::FIELDS_DISCOUNT_AMOUNT, + self::FIELDS_ITEMS_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_AMOUNT, + self::FIELDS_REFERRER_ID, + self::FIELDS_VOUCHER_ID, + self::FIELDS_POINTS, + self::FIELDS_EXPIRES_AT, + self::FIELDS_TYPE, + self::FIELDS_REASON, + self::FIELDS_SOURCE, + self::FIELDS_BALANCE, + self::FIELDS_RELATED_TRANSACTION_ID, + self::FIELDS_DETAILS, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\ExportsCreateResponseBodyParametersFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\ExportsCreateResponseBodyParametersFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + array_push($this->openAPINullablesSetToNull, 'filters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filters'] = $filters; + + 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/ExportsCreateResponseBodyParametersFilters.php b/src/Model/ExportsCreateResponseBodyParametersFilters.php new file mode 100644 index 0000000..4f69255 --- /dev/null +++ b/src/Model/ExportsCreateResponseBodyParametersFilters.php @@ -0,0 +1,553 @@ + + */ +class ExportsCreateResponseBodyParametersFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsCreateResponseBodyParametersFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'campaignId' => '\OpenAPI\Client\Model\FieldConditions', + 'voucherId' => '\OpenAPI\Client\Model\FieldConditions', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'campaignId' => null, + 'voucherId' => null, + 'createdAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'campaignId' => false, + 'voucherId' => false, + 'createdAt' => 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 = [ + 'junction' => 'junction', + 'campaignId' => 'campaign_id', + 'voucherId' => 'voucher_id', + 'createdAt' => 'created_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'campaignId' => 'setCampaignId', + 'voucherId' => 'setVoucherId', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'campaignId' => 'getCampaignId', + 'voucherId' => 'getVoucherId', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('createdAt', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + throw new \InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets voucherId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $voucherId voucherId + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + throw new \InvalidArgumentException('non-nullable voucherId cannot be null'); + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + 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/ExportsGetResponseBody.php b/src/Model/ExportsGetResponseBody.php new file mode 100644 index 0000000..dda03a6 --- /dev/null +++ b/src/Model/ExportsGetResponseBody.php @@ -0,0 +1,860 @@ + + */ +class ExportsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'channel' => 'string', + 'result' => '\OpenAPI\Client\Model\ExportsGetResponseBodyResult', + 'userId' => 'string', + 'exportedObject' => 'string', + 'parameters' => '\OpenAPI\Client\Model\ExportsGetResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'status' => null, + 'channel' => null, + 'result' => null, + 'userId' => null, + 'exportedObject' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'status' => true, + 'channel' => true, + 'result' => true, + 'userId' => true, + 'exportedObject' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'status' => 'status', + 'channel' => 'channel', + 'result' => 'result', + 'userId' => 'user_id', + 'exportedObject' => 'exported_object', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'channel' => 'setChannel', + 'result' => 'setResult', + 'userId' => 'setUserId', + 'exportedObject' => 'setExportedObject', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'channel' => 'getChannel', + 'result' => 'getResult', + 'userId' => 'getUserId', + 'exportedObject' => 'getExportedObject', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_EXPORT = 'export'; + public const STATUS_SCHEDULED = 'SCHEDULED'; + public const STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const STATUS_DONE = 'DONE'; + public const STATUS_ERROR = 'ERROR'; + public const EXPORTED_OBJECT_VOUCHER = 'voucher'; + public const EXPORTED_OBJECT_REDEMPTION = 'redemption'; + public const EXPORTED_OBJECT_CUSTOMER = 'customer'; + public const EXPORTED_OBJECT_PUBLICATION = 'publication'; + public const EXPORTED_OBJECT_ORDER = 'order'; + public const EXPORTED_OBJECT_POINTS_EXPIRATION = 'points_expiration'; + public const EXPORTED_OBJECT_VOUCHER_TRANSACTIONS = 'voucher_transactions'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EXPORT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SCHEDULED, + self::STATUS_IN_PROGRESS, + self::STATUS_DONE, + self::STATUS_ERROR, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportedObjectAllowableValues() + { + return [ + self::EXPORTED_OBJECT_VOUCHER, + self::EXPORTED_OBJECT_REDEMPTION, + self::EXPORTED_OBJECT_CUSTOMER, + self::EXPORTED_OBJECT_PUBLICATION, + self::EXPORTED_OBJECT_ORDER, + self::EXPORTED_OBJECT_POINTS_EXPIRATION, + self::EXPORTED_OBJECT_VOUCHER_TRANSACTIONS, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'export'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('userId', $data ?? [], null); + $this->setIfExists('exportedObject', $data ?? [], null); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($this->container['exportedObject']) && !in_array($this->container['exportedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exportedObject', must be one of '%s'", + $this->container['exportedObject'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique export ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of object being represented. This object stores information about the export. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel through which the export was triggered. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\ExportsGetResponseBodyResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\ExportsGetResponseBodyResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets userId + * + * @return string|null + */ + public function getUserId() + { + return $this->container['userId']; + } + + /** + * Sets userId + * + * @param string|null $userId Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. + * + * @return self + */ + public function setUserId($userId) + { + if (is_null($userId)) { + array_push($this->openAPINullablesSetToNull, 'userId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('userId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['userId'] = $userId; + + return $this; + } + + /** + * Gets exportedObject + * + * @return string|null + */ + public function getExportedObject() + { + return $this->container['exportedObject']; + } + + /** + * Sets exportedObject + * + * @param string|null $exportedObject exportedObject + * + * @return self + */ + public function setExportedObject($exportedObject) + { + if (is_null($exportedObject)) { + array_push($this->openAPINullablesSetToNull, 'exportedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exportedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($exportedObject) && !in_array($exportedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exportedObject', must be one of '%s'", + $exportedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exportedObject'] = $exportedObject; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\ExportsGetResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\ExportsGetResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/ExportsGetResponseBodyParameters.php b/src/Model/ExportsGetResponseBodyParameters.php new file mode 100644 index 0000000..1344c67 --- /dev/null +++ b/src/Model/ExportsGetResponseBodyParameters.php @@ -0,0 +1,779 @@ + + */ +class ExportsGetResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsGetResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\ExportsGetResponseBodyParametersFilters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => true + ]; + + /** + * 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const ORDER_UPDATED_AT = '-updated_at'; + public const ORDER_UPDATED_AT2 = 'updated_at'; + public const ORDER_CODE = '-code'; + public const ORDER_CODE2 = 'code'; + public const ORDER_ID = '-id'; + public const ORDER_ID2 = 'id'; + public const ORDER_VOUCHER_CODE = '-voucher_code'; + public const ORDER_VOUCHER_CODE2 = 'voucher_code'; + public const ORDER_TRACKING_ID = '-tracking_id'; + public const ORDER_TRACKING_ID2 = 'tracking_id'; + public const ORDER_CUSTOMER_ID = '-customer_id'; + public const ORDER_CUSTOMER_ID2 = 'customer_id'; + public const ORDER_NAME = '-name'; + public const ORDER_NAME2 = 'name'; + public const ORDER_EMAIL = '-email'; + public const ORDER_EMAIL2 = 'email'; + public const ORDER_SOURCE_ID = '-source_id'; + public const ORDER_SOURCE_ID2 = 'source_id'; + public const ORDER_CHANNEL = '-channel'; + public const ORDER_CHANNEL2 = 'channel'; + public const ORDER_STATUS = '-status'; + public const ORDER_STATUS2 = 'status'; + public const ORDER_EXPIRES_AT = '-expires_at'; + public const ORDER_EXPIRES_AT2 = 'expires_at'; + public const FIELDS_CODE = 'code'; + public const FIELDS_VOUCHER_TYPE = 'voucher_type'; + public const FIELDS_VALUE = 'value'; + public const FIELDS_FORMULA = 'formula'; + public const FIELDS_DISCOUNT_TYPE = 'discount_type'; + public const FIELDS_CAMPAIGN = 'campaign'; + public const FIELDS_CATEGORY = 'category'; + public const FIELDS_START_DATE = 'start_date'; + public const FIELDS_EXPIRATION_DATE = 'expiration_date'; + public const FIELDS_GIFT_BALANCE = 'gift_balance'; + public const FIELDS_LOYALTY_BALANCE = 'loyalty_balance'; + public const FIELDS_REDEMPTION_QUANTITY = 'redemption_quantity'; + public const FIELDS_REDEMPTION_COUNT = 'redemption_count'; + public const FIELDS_ACTIVE = 'active'; + public const FIELDS_QR_CODE = 'qr_code'; + public const FIELDS_BAR_CODE = 'bar_code'; + public const FIELDS_METADATA = 'metadata'; + public const FIELDS_ID = 'id'; + public const FIELDS_IS_REFERRAL_CODE = 'is_referral_code'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_UPDATED_AT = 'updated_at'; + public const FIELDS_VALIDITY_TIMEFRAME_INTERVAL = 'validity_timeframe_interval'; + public const FIELDS_VALIDITY_TIMEFRAME_DURATION = 'validity_timeframe_duration'; + public const FIELDS_VALIDITY_DAY_OF_WEEK = 'validity_day_of_week'; + public const FIELDS_DISCOUNT_AMOUNT_LIMIT = 'discount_amount_limit'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_ADDITIONAL_INFO = 'additional_info'; + public const FIELDS_CUSTOMER_ID = 'customer_id'; + public const FIELDS_DISCOUNT_EFFECT = 'discount_effect'; + public const FIELDS_DISCOUNT_UNIT_TYPE = 'discount_unit_type'; + public const FIELDS_DISCOUNT_UNIT_EFFECT = 'discount_unit_effect'; + public const FIELDS_VALIDATION_RULES_ID = 'validation_rules_id'; + public const FIELDS_CUSTOMER_SOURCE_ID = 'customer_source_id'; + public const FIELDS_OBJECT = 'object'; + public const FIELDS_DATE = 'date'; + public const FIELDS_VOUCHER_CODE = 'voucher_code'; + public const FIELDS_PROMOTION_TIER_ID = 'promotion_tier_id'; + public const FIELDS_CUSTOMER_NAME = 'customer_name'; + public const FIELDS_TRACKING_ID = 'tracking_id'; + public const FIELDS_ORDER_ID = 'order_id'; + public const FIELDS_ORDER_AMOUNT = 'order_amount'; + public const FIELDS_GIFT_AMOUNT = 'gift_amount'; + public const FIELDS_LOYALTY_POINTS = 'loyalty_points'; + public const FIELDS_RESULT = 'result'; + public const FIELDS_FAILURE_CODE = 'failure_code'; + public const FIELDS_FAILURE_MESSAGE = 'failure_message'; + public const FIELDS_NAME = 'name'; + public const FIELDS_DESCRIPTION = 'description'; + public const FIELDS_EMAIL = 'email'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_ADDRESS_CITY = 'address_city'; + public const FIELDS_ADDRESS_STATE = 'address_state'; + public const FIELDS_ADDRESS_LINE_1 = 'address_line_1'; + public const FIELDS_ADDRESS_LINE_2 = 'address_line_2'; + public const FIELDS_ADDRESS_COUNTRY = 'address_country'; + public const FIELDS_ADDRESS_POSTAL_CODE = 'address_postal_code'; + public const FIELDS_REDEMPTIONS_TOTAL_REDEEMED = 'redemptions_total_redeemed'; + public const FIELDS_REDEMPTIONS_TOTAL_FAILED = 'redemptions_total_failed'; + public const FIELDS_REDEMPTIONS_TOTAL_SUCCEEDED = 'redemptions_total_succeeded'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLED_BACK = 'redemptions_total_rolled_back'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_FAILED = 'redemptions_total_rollback_failed'; + public const FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED = 'redemptions_total_rollback_succeeded'; + public const FIELDS_ORDERS_TOTAL_AMOUNT = 'orders_total_amount'; + public const FIELDS_ORDERS_TOTAL_COUNT = 'orders_total_count'; + public const FIELDS_ORDERS_AVERAGE_AMOUNT = 'orders_average_amount'; + public const FIELDS_ORDERS_LAST_ORDER_AMOUNT = 'orders_last_order_amount'; + public const FIELDS_ORDERS_LAST_ORDER_DATE = 'orders_last_order_date'; + public const FIELDS_LOYALTY_REFERRED_CUSTOMERS = 'loyalty_referred_customers'; + public const FIELDS_PHONE = 'phone'; + public const FIELDS_BIRTHDAY = 'birthday'; + public const FIELDS_BIRTHDATE = 'birthdate'; + public const FIELDS_CHANNEL = 'channel'; + public const FIELDS_IS_WINNER = 'is_winner'; + public const FIELDS_STATUS = 'status'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_DISCOUNT_AMOUNT = 'discount_amount'; + public const FIELDS_ITEMS_DISCOUNT_AMOUNT = 'items_discount_amount'; + public const FIELDS_TOTAL_DISCOUNT_AMOUNT = 'total_discount_amount'; + public const FIELDS_TOTAL_AMOUNT = 'total_amount'; + public const FIELDS_REFERRER_ID = 'referrer_id'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_POINTS = 'points'; + public const FIELDS_EXPIRES_AT = 'expires_at'; + public const FIELDS_TYPE = 'type'; + public const FIELDS_REASON = 'reason'; + public const FIELDS_SOURCE = 'source'; + public const FIELDS_BALANCE = 'balance'; + public const FIELDS_RELATED_TRANSACTION_ID = 'related_transaction_id'; + public const FIELDS_DETAILS = 'details'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + self::ORDER_UPDATED_AT, + self::ORDER_UPDATED_AT2, + self::ORDER_CODE, + self::ORDER_CODE2, + self::ORDER_ID, + self::ORDER_ID2, + self::ORDER_VOUCHER_CODE, + self::ORDER_VOUCHER_CODE2, + self::ORDER_TRACKING_ID, + self::ORDER_TRACKING_ID2, + self::ORDER_CUSTOMER_ID, + self::ORDER_CUSTOMER_ID2, + self::ORDER_NAME, + self::ORDER_NAME2, + self::ORDER_EMAIL, + self::ORDER_EMAIL2, + self::ORDER_SOURCE_ID, + self::ORDER_SOURCE_ID2, + self::ORDER_CHANNEL, + self::ORDER_CHANNEL2, + self::ORDER_STATUS, + self::ORDER_STATUS2, + self::ORDER_EXPIRES_AT, + self::ORDER_EXPIRES_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_CODE, + self::FIELDS_VOUCHER_TYPE, + self::FIELDS_VALUE, + self::FIELDS_FORMULA, + self::FIELDS_DISCOUNT_TYPE, + self::FIELDS_CAMPAIGN, + self::FIELDS_CATEGORY, + self::FIELDS_START_DATE, + self::FIELDS_EXPIRATION_DATE, + self::FIELDS_GIFT_BALANCE, + self::FIELDS_LOYALTY_BALANCE, + self::FIELDS_REDEMPTION_QUANTITY, + self::FIELDS_REDEMPTION_COUNT, + self::FIELDS_ACTIVE, + self::FIELDS_QR_CODE, + self::FIELDS_BAR_CODE, + self::FIELDS_METADATA, + self::FIELDS_ID, + self::FIELDS_IS_REFERRAL_CODE, + self::FIELDS_CREATED_AT, + self::FIELDS_UPDATED_AT, + self::FIELDS_VALIDITY_TIMEFRAME_INTERVAL, + self::FIELDS_VALIDITY_TIMEFRAME_DURATION, + self::FIELDS_VALIDITY_DAY_OF_WEEK, + self::FIELDS_DISCOUNT_AMOUNT_LIMIT, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_ADDITIONAL_INFO, + self::FIELDS_CUSTOMER_ID, + self::FIELDS_DISCOUNT_EFFECT, + self::FIELDS_DISCOUNT_UNIT_TYPE, + self::FIELDS_DISCOUNT_UNIT_EFFECT, + self::FIELDS_VALIDATION_RULES_ID, + self::FIELDS_CUSTOMER_SOURCE_ID, + self::FIELDS_OBJECT, + self::FIELDS_DATE, + self::FIELDS_VOUCHER_CODE, + self::FIELDS_PROMOTION_TIER_ID, + self::FIELDS_CUSTOMER_NAME, + self::FIELDS_TRACKING_ID, + self::FIELDS_ORDER_ID, + self::FIELDS_ORDER_AMOUNT, + self::FIELDS_GIFT_AMOUNT, + self::FIELDS_LOYALTY_POINTS, + self::FIELDS_RESULT, + self::FIELDS_FAILURE_CODE, + self::FIELDS_FAILURE_MESSAGE, + self::FIELDS_NAME, + self::FIELDS_DESCRIPTION, + self::FIELDS_EMAIL, + self::FIELDS_SOURCE_ID, + self::FIELDS_ADDRESS_CITY, + self::FIELDS_ADDRESS_STATE, + self::FIELDS_ADDRESS_LINE_1, + self::FIELDS_ADDRESS_LINE_2, + self::FIELDS_ADDRESS_COUNTRY, + self::FIELDS_ADDRESS_POSTAL_CODE, + self::FIELDS_REDEMPTIONS_TOTAL_REDEEMED, + self::FIELDS_REDEMPTIONS_TOTAL_FAILED, + self::FIELDS_REDEMPTIONS_TOTAL_SUCCEEDED, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLED_BACK, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_FAILED, + self::FIELDS_REDEMPTIONS_TOTAL_ROLLBACK_SUCCEEDED, + self::FIELDS_ORDERS_TOTAL_AMOUNT, + self::FIELDS_ORDERS_TOTAL_COUNT, + self::FIELDS_ORDERS_AVERAGE_AMOUNT, + self::FIELDS_ORDERS_LAST_ORDER_AMOUNT, + self::FIELDS_ORDERS_LAST_ORDER_DATE, + self::FIELDS_LOYALTY_REFERRED_CUSTOMERS, + self::FIELDS_PHONE, + self::FIELDS_BIRTHDAY, + self::FIELDS_BIRTHDATE, + self::FIELDS_CHANNEL, + self::FIELDS_IS_WINNER, + self::FIELDS_STATUS, + self::FIELDS_AMOUNT, + self::FIELDS_DISCOUNT_AMOUNT, + self::FIELDS_ITEMS_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_AMOUNT, + self::FIELDS_REFERRER_ID, + self::FIELDS_VOUCHER_ID, + self::FIELDS_POINTS, + self::FIELDS_EXPIRES_AT, + self::FIELDS_TYPE, + self::FIELDS_REASON, + self::FIELDS_SOURCE, + self::FIELDS_BALANCE, + self::FIELDS_RELATED_TRANSACTION_ID, + self::FIELDS_DETAILS, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\ExportsGetResponseBodyParametersFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\ExportsGetResponseBodyParametersFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + array_push($this->openAPINullablesSetToNull, 'filters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filters'] = $filters; + + 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/ExportsGetResponseBodyParametersFilters.php b/src/Model/ExportsGetResponseBodyParametersFilters.php new file mode 100644 index 0000000..29d540c --- /dev/null +++ b/src/Model/ExportsGetResponseBodyParametersFilters.php @@ -0,0 +1,553 @@ + + */ +class ExportsGetResponseBodyParametersFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsGetResponseBodyParametersFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'campaignId' => '\OpenAPI\Client\Model\FieldConditions', + 'voucherId' => '\OpenAPI\Client\Model\FieldConditions', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'campaignId' => null, + 'voucherId' => null, + 'createdAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'campaignId' => false, + 'voucherId' => false, + 'createdAt' => 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 = [ + 'junction' => 'junction', + 'campaignId' => 'campaign_id', + 'voucherId' => 'voucher_id', + 'createdAt' => 'created_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'campaignId' => 'setCampaignId', + 'voucherId' => 'setVoucherId', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'campaignId' => 'getCampaignId', + 'voucherId' => 'getVoucherId', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('createdAt', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + throw new \InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets voucherId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $voucherId voucherId + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + throw new \InvalidArgumentException('non-nullable voucherId cannot be null'); + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + 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/ExportsGetResponseBodyResult.php b/src/Model/ExportsGetResponseBodyResult.php new file mode 100644 index 0000000..dbfa6ea --- /dev/null +++ b/src/Model/ExportsGetResponseBodyResult.php @@ -0,0 +1,417 @@ + + */ +class ExportsGetResponseBodyResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsGetResponseBodyResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'url' => true + ]; + + /** + * 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 = [ + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'url' => 'getUrl' + ]; + + /** + * 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('url', $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 url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL of the CSV file location. It contains the token used for authorization in the Download export method. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/ExportsListResponseBody.php b/src/Model/ExportsListResponseBody.php new file mode 100644 index 0000000..53b99e0 --- /dev/null +++ b/src/Model/ExportsListResponseBody.php @@ -0,0 +1,605 @@ + + */ +class ExportsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ExportsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'exports' => '\OpenAPI\Client\Model\Export[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'exports' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'exports' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'exports' => 'exports', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'exports' => 'setExports', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'exports' => 'getExports', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_EXPORTS = 'exports'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_EXPORTS, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'exports'); + $this->setIfExists('exports', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about exports. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of exports. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets exports + * + * @return \OpenAPI\Client\Model\Export[]|null + */ + public function getExports() + { + return $this->container['exports']; + } + + /** + * Sets exports + * + * @param \OpenAPI\Client\Model\Export[]|null $exports An array of export objects. + * + * @return self + */ + public function setExports($exports) + { + if (is_null($exports)) { + array_push($this->openAPINullablesSetToNull, 'exports'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exports', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['exports'] = $exports; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of exports. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/FieldConditions.php b/src/Model/FieldConditions.php new file mode 100644 index 0000000..b5edeeb --- /dev/null +++ b/src/Model/FieldConditions.php @@ -0,0 +1,410 @@ + + */ +class FieldConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FieldConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FiltersCondition' + ]; + + /** + * 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\FiltersCondition|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FiltersCondition|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/FilterConditionsString.php b/src/Model/FilterConditionsString.php new file mode 100644 index 0000000..573da7e --- /dev/null +++ b/src/Model/FilterConditionsString.php @@ -0,0 +1,705 @@ + + */ +class FilterConditionsString implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FilterConditionsString'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string', + 'hasValue' => 'string', + 'isUnknown' => 'string', + 'startsWith' => 'string', + 'endsWith' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null, + 'hasValue' => null, + 'isUnknown' => null, + 'startsWith' => null, + 'endsWith' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true, + 'hasValue' => true, + 'isUnknown' => true, + 'startsWith' => true, + 'endsWith' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not', + 'hasValue' => '$has_value', + 'isUnknown' => '$is_unknown', + 'startsWith' => '$starts_with', + 'endsWith' => '$ends_with' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'hasValue' => 'setHasValue', + 'isUnknown' => 'setIsUnknown', + 'startsWith' => 'setStartsWith', + 'endsWith' => 'setEndsWith' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'hasValue' => 'getHasValue', + 'isUnknown' => 'getIsUnknown', + 'startsWith' => 'getStartsWith', + 'endsWith' => 'getEndsWith' + ]; + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isNot', $data ?? [], null); + $this->setIfExists('hasValue', $data ?? [], null); + $this->setIfExists('isUnknown', $data ?? [], null); + $this->setIfExists('startsWith', $data ?? [], null); + $this->setIfExists('endsWith', $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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Value is exactly this value (single value). + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results omit this value (single value). + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets hasValue + * + * @return string|null + */ + public function getHasValue() + { + return $this->container['hasValue']; + } + + /** + * Sets hasValue + * + * @param string|null $hasValue Value is NOT null. The value for this parameter is an empty string. + * + * @return self + */ + public function setHasValue($hasValue) + { + if (is_null($hasValue)) { + array_push($this->openAPINullablesSetToNull, 'hasValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasValue'] = $hasValue; + + return $this; + } + + /** + * Gets isUnknown + * + * @return string|null + */ + public function getIsUnknown() + { + return $this->container['isUnknown']; + } + + /** + * Sets isUnknown + * + * @param string|null $isUnknown Value is null. The value for this parameter is an empty string. + * + * @return self + */ + public function setIsUnknown($isUnknown) + { + if (is_null($isUnknown)) { + array_push($this->openAPINullablesSetToNull, 'isUnknown'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isUnknown', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isUnknown'] = $isUnknown; + + return $this; + } + + /** + * Gets startsWith + * + * @return string|null + */ + public function getStartsWith() + { + return $this->container['startsWith']; + } + + /** + * Sets startsWith + * + * @param string|null $startsWith Value starts with the specified string. + * + * @return self + */ + public function setStartsWith($startsWith) + { + if (is_null($startsWith)) { + array_push($this->openAPINullablesSetToNull, 'startsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startsWith'] = $startsWith; + + return $this; + } + + /** + * Gets endsWith + * + * @return string|null + */ + public function getEndsWith() + { + return $this->container['endsWith']; + } + + /** + * Sets endsWith + * + * @param string|null $endsWith Value ends with the specified string. + * + * @return self + */ + public function setEndsWith($endsWith) + { + if (is_null($endsWith)) { + array_push($this->openAPINullablesSetToNull, 'endsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('endsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['endsWith'] = $endsWith; + + 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/FiltersCondition.php b/src/Model/FiltersCondition.php new file mode 100644 index 0000000..b54ae62 --- /dev/null +++ b/src/Model/FiltersCondition.php @@ -0,0 +1,1401 @@ + + */ +class FiltersCondition implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FiltersCondition'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'mixed', + 'notIn' => 'mixed', + 'is' => 'mixed', + 'isDaysAgo' => 'mixed', + 'isDaysInFuture' => 'mixed', + 'isNot' => 'mixed', + 'hasValue' => 'mixed', + 'isUnknown' => 'mixed', + 'contains' => 'mixed', + 'notContain' => 'mixed', + 'startsWith' => 'mixed', + 'endsWith' => 'mixed', + 'moreThan' => 'mixed', + 'lessThan' => 'mixed', + 'moreThanAgo' => 'mixed', + 'lessThanAgo' => 'mixed', + 'moreThanFuture' => 'mixed', + 'lessThanFuture' => 'mixed', + 'moreThanEqual' => 'mixed', + 'lessThanEqual' => 'mixed', + 'after' => 'mixed', + 'before' => 'mixed', + 'count' => 'mixed', + 'countLess' => 'mixed', + 'countMore' => 'mixed' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isDaysAgo' => null, + 'isDaysInFuture' => null, + 'isNot' => null, + 'hasValue' => null, + 'isUnknown' => null, + 'contains' => null, + 'notContain' => null, + 'startsWith' => null, + 'endsWith' => null, + 'moreThan' => null, + 'lessThan' => null, + 'moreThanAgo' => null, + 'lessThanAgo' => null, + 'moreThanFuture' => null, + 'lessThanFuture' => null, + 'moreThanEqual' => null, + 'lessThanEqual' => null, + 'after' => null, + 'before' => null, + 'count' => null, + 'countLess' => null, + 'countMore' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isDaysAgo' => true, + 'isDaysInFuture' => true, + 'isNot' => true, + 'hasValue' => true, + 'isUnknown' => true, + 'contains' => true, + 'notContain' => true, + 'startsWith' => true, + 'endsWith' => true, + 'moreThan' => true, + 'lessThan' => true, + 'moreThanAgo' => true, + 'lessThanAgo' => true, + 'moreThanFuture' => true, + 'lessThanFuture' => true, + 'moreThanEqual' => true, + 'lessThanEqual' => true, + 'after' => true, + 'before' => true, + 'count' => true, + 'countLess' => true, + 'countMore' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isDaysAgo' => '$is_days_ago', + 'isDaysInFuture' => '$is_days_in_future', + 'isNot' => '$is_not', + 'hasValue' => '$has_value', + 'isUnknown' => '$is_unknown', + 'contains' => '$contains', + 'notContain' => '$not_contain', + 'startsWith' => '$starts_with', + 'endsWith' => '$ends_with', + 'moreThan' => '$more_than', + 'lessThan' => '$less_than', + 'moreThanAgo' => '$more_than_ago', + 'lessThanAgo' => '$less_than_ago', + 'moreThanFuture' => '$more_than_future', + 'lessThanFuture' => '$less_than_future', + 'moreThanEqual' => '$more_than_equal', + 'lessThanEqual' => '$less_than_equal', + 'after' => '$after', + 'before' => '$before', + 'count' => '$count', + 'countLess' => '$count_less', + 'countMore' => '$count_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isDaysAgo' => 'setIsDaysAgo', + 'isDaysInFuture' => 'setIsDaysInFuture', + 'isNot' => 'setIsNot', + 'hasValue' => 'setHasValue', + 'isUnknown' => 'setIsUnknown', + 'contains' => 'setContains', + 'notContain' => 'setNotContain', + 'startsWith' => 'setStartsWith', + 'endsWith' => 'setEndsWith', + 'moreThan' => 'setMoreThan', + 'lessThan' => 'setLessThan', + 'moreThanAgo' => 'setMoreThanAgo', + 'lessThanAgo' => 'setLessThanAgo', + 'moreThanFuture' => 'setMoreThanFuture', + 'lessThanFuture' => 'setLessThanFuture', + 'moreThanEqual' => 'setMoreThanEqual', + 'lessThanEqual' => 'setLessThanEqual', + 'after' => 'setAfter', + 'before' => 'setBefore', + 'count' => 'setCount', + 'countLess' => 'setCountLess', + 'countMore' => 'setCountMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isDaysAgo' => 'getIsDaysAgo', + 'isDaysInFuture' => 'getIsDaysInFuture', + 'isNot' => 'getIsNot', + 'hasValue' => 'getHasValue', + 'isUnknown' => 'getIsUnknown', + 'contains' => 'getContains', + 'notContain' => 'getNotContain', + 'startsWith' => 'getStartsWith', + 'endsWith' => 'getEndsWith', + 'moreThan' => 'getMoreThan', + 'lessThan' => 'getLessThan', + 'moreThanAgo' => 'getMoreThanAgo', + 'lessThanAgo' => 'getLessThanAgo', + 'moreThanFuture' => 'getMoreThanFuture', + 'lessThanFuture' => 'getLessThanFuture', + 'moreThanEqual' => 'getMoreThanEqual', + 'lessThanEqual' => 'getLessThanEqual', + 'after' => 'getAfter', + 'before' => 'getBefore', + 'count' => 'getCount', + 'countLess' => 'getCountLess', + 'countMore' => 'getCountMore' + ]; + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isDaysAgo', $data ?? [], null); + $this->setIfExists('isDaysInFuture', $data ?? [], null); + $this->setIfExists('isNot', $data ?? [], null); + $this->setIfExists('hasValue', $data ?? [], null); + $this->setIfExists('isUnknown', $data ?? [], null); + $this->setIfExists('contains', $data ?? [], null); + $this->setIfExists('notContain', $data ?? [], null); + $this->setIfExists('startsWith', $data ?? [], null); + $this->setIfExists('endsWith', $data ?? [], null); + $this->setIfExists('moreThan', $data ?? [], null); + $this->setIfExists('lessThan', $data ?? [], null); + $this->setIfExists('moreThanAgo', $data ?? [], null); + $this->setIfExists('lessThanAgo', $data ?? [], null); + $this->setIfExists('moreThanFuture', $data ?? [], null); + $this->setIfExists('lessThanFuture', $data ?? [], null); + $this->setIfExists('moreThanEqual', $data ?? [], null); + $this->setIfExists('lessThanEqual', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('countLess', $data ?? [], null); + $this->setIfExists('countMore', $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 in + * + * @return mixed|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param mixed|null $in in + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets notIn + * + * @return mixed|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param mixed|null $notIn notIn + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return mixed|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param mixed|null $is is + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isDaysAgo + * + * @return mixed|null + */ + public function getIsDaysAgo() + { + return $this->container['isDaysAgo']; + } + + /** + * Sets isDaysAgo + * + * @param mixed|null $isDaysAgo isDaysAgo + * + * @return self + */ + public function setIsDaysAgo($isDaysAgo) + { + if (is_null($isDaysAgo)) { + array_push($this->openAPINullablesSetToNull, 'isDaysAgo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isDaysAgo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isDaysAgo'] = $isDaysAgo; + + return $this; + } + + /** + * Gets isDaysInFuture + * + * @return mixed|null + */ + public function getIsDaysInFuture() + { + return $this->container['isDaysInFuture']; + } + + /** + * Sets isDaysInFuture + * + * @param mixed|null $isDaysInFuture isDaysInFuture + * + * @return self + */ + public function setIsDaysInFuture($isDaysInFuture) + { + if (is_null($isDaysInFuture)) { + array_push($this->openAPINullablesSetToNull, 'isDaysInFuture'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isDaysInFuture', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isDaysInFuture'] = $isDaysInFuture; + + return $this; + } + + /** + * Gets isNot + * + * @return mixed|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param mixed|null $isNot isNot + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets hasValue + * + * @return mixed|null + */ + public function getHasValue() + { + return $this->container['hasValue']; + } + + /** + * Sets hasValue + * + * @param mixed|null $hasValue hasValue + * + * @return self + */ + public function setHasValue($hasValue) + { + if (is_null($hasValue)) { + array_push($this->openAPINullablesSetToNull, 'hasValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasValue'] = $hasValue; + + return $this; + } + + /** + * Gets isUnknown + * + * @return mixed|null + */ + public function getIsUnknown() + { + return $this->container['isUnknown']; + } + + /** + * Sets isUnknown + * + * @param mixed|null $isUnknown isUnknown + * + * @return self + */ + public function setIsUnknown($isUnknown) + { + if (is_null($isUnknown)) { + array_push($this->openAPINullablesSetToNull, 'isUnknown'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isUnknown', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isUnknown'] = $isUnknown; + + return $this; + } + + /** + * Gets contains + * + * @return mixed|null + */ + public function getContains() + { + return $this->container['contains']; + } + + /** + * Sets contains + * + * @param mixed|null $contains contains + * + * @return self + */ + public function setContains($contains) + { + if (is_null($contains)) { + array_push($this->openAPINullablesSetToNull, 'contains'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('contains', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['contains'] = $contains; + + return $this; + } + + /** + * Gets notContain + * + * @return mixed|null + */ + public function getNotContain() + { + return $this->container['notContain']; + } + + /** + * Sets notContain + * + * @param mixed|null $notContain notContain + * + * @return self + */ + public function setNotContain($notContain) + { + if (is_null($notContain)) { + array_push($this->openAPINullablesSetToNull, 'notContain'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notContain', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notContain'] = $notContain; + + return $this; + } + + /** + * Gets startsWith + * + * @return mixed|null + */ + public function getStartsWith() + { + return $this->container['startsWith']; + } + + /** + * Sets startsWith + * + * @param mixed|null $startsWith startsWith + * + * @return self + */ + public function setStartsWith($startsWith) + { + if (is_null($startsWith)) { + array_push($this->openAPINullablesSetToNull, 'startsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startsWith'] = $startsWith; + + return $this; + } + + /** + * Gets endsWith + * + * @return mixed|null + */ + public function getEndsWith() + { + return $this->container['endsWith']; + } + + /** + * Sets endsWith + * + * @param mixed|null $endsWith endsWith + * + * @return self + */ + public function setEndsWith($endsWith) + { + if (is_null($endsWith)) { + array_push($this->openAPINullablesSetToNull, 'endsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('endsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['endsWith'] = $endsWith; + + return $this; + } + + /** + * Gets moreThan + * + * @return mixed|null + */ + public function getMoreThan() + { + return $this->container['moreThan']; + } + + /** + * Sets moreThan + * + * @param mixed|null $moreThan moreThan + * + * @return self + */ + public function setMoreThan($moreThan) + { + if (is_null($moreThan)) { + array_push($this->openAPINullablesSetToNull, 'moreThan'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreThan', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreThan'] = $moreThan; + + return $this; + } + + /** + * Gets lessThan + * + * @return mixed|null + */ + public function getLessThan() + { + return $this->container['lessThan']; + } + + /** + * Sets lessThan + * + * @param mixed|null $lessThan lessThan + * + * @return self + */ + public function setLessThan($lessThan) + { + if (is_null($lessThan)) { + array_push($this->openAPINullablesSetToNull, 'lessThan'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lessThan', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lessThan'] = $lessThan; + + return $this; + } + + /** + * Gets moreThanAgo + * + * @return mixed|null + */ + public function getMoreThanAgo() + { + return $this->container['moreThanAgo']; + } + + /** + * Sets moreThanAgo + * + * @param mixed|null $moreThanAgo moreThanAgo + * + * @return self + */ + public function setMoreThanAgo($moreThanAgo) + { + if (is_null($moreThanAgo)) { + array_push($this->openAPINullablesSetToNull, 'moreThanAgo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreThanAgo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreThanAgo'] = $moreThanAgo; + + return $this; + } + + /** + * Gets lessThanAgo + * + * @return mixed|null + */ + public function getLessThanAgo() + { + return $this->container['lessThanAgo']; + } + + /** + * Sets lessThanAgo + * + * @param mixed|null $lessThanAgo lessThanAgo + * + * @return self + */ + public function setLessThanAgo($lessThanAgo) + { + if (is_null($lessThanAgo)) { + array_push($this->openAPINullablesSetToNull, 'lessThanAgo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lessThanAgo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lessThanAgo'] = $lessThanAgo; + + return $this; + } + + /** + * Gets moreThanFuture + * + * @return mixed|null + */ + public function getMoreThanFuture() + { + return $this->container['moreThanFuture']; + } + + /** + * Sets moreThanFuture + * + * @param mixed|null $moreThanFuture moreThanFuture + * + * @return self + */ + public function setMoreThanFuture($moreThanFuture) + { + if (is_null($moreThanFuture)) { + array_push($this->openAPINullablesSetToNull, 'moreThanFuture'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreThanFuture', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreThanFuture'] = $moreThanFuture; + + return $this; + } + + /** + * Gets lessThanFuture + * + * @return mixed|null + */ + public function getLessThanFuture() + { + return $this->container['lessThanFuture']; + } + + /** + * Sets lessThanFuture + * + * @param mixed|null $lessThanFuture lessThanFuture + * + * @return self + */ + public function setLessThanFuture($lessThanFuture) + { + if (is_null($lessThanFuture)) { + array_push($this->openAPINullablesSetToNull, 'lessThanFuture'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lessThanFuture', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lessThanFuture'] = $lessThanFuture; + + return $this; + } + + /** + * Gets moreThanEqual + * + * @return mixed|null + */ + public function getMoreThanEqual() + { + return $this->container['moreThanEqual']; + } + + /** + * Sets moreThanEqual + * + * @param mixed|null $moreThanEqual moreThanEqual + * + * @return self + */ + public function setMoreThanEqual($moreThanEqual) + { + if (is_null($moreThanEqual)) { + array_push($this->openAPINullablesSetToNull, 'moreThanEqual'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreThanEqual', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreThanEqual'] = $moreThanEqual; + + return $this; + } + + /** + * Gets lessThanEqual + * + * @return mixed|null + */ + public function getLessThanEqual() + { + return $this->container['lessThanEqual']; + } + + /** + * Sets lessThanEqual + * + * @param mixed|null $lessThanEqual lessThanEqual + * + * @return self + */ + public function setLessThanEqual($lessThanEqual) + { + if (is_null($lessThanEqual)) { + array_push($this->openAPINullablesSetToNull, 'lessThanEqual'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lessThanEqual', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lessThanEqual'] = $lessThanEqual; + + return $this; + } + + /** + * Gets after + * + * @return mixed|null + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param mixed|null $after after + * + * @return self + */ + public function setAfter($after) + { + if (is_null($after)) { + array_push($this->openAPINullablesSetToNull, 'after'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('after', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['after'] = $after; + + return $this; + } + + /** + * Gets before + * + * @return mixed|null + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param mixed|null $before before + * + * @return self + */ + public function setBefore($before) + { + if (is_null($before)) { + array_push($this->openAPINullablesSetToNull, 'before'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('before', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['before'] = $before; + + return $this; + } + + /** + * Gets count + * + * @return mixed|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param mixed|null $count count + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets countLess + * + * @return mixed|null + */ + public function getCountLess() + { + return $this->container['countLess']; + } + + /** + * Sets countLess + * + * @param mixed|null $countLess countLess + * + * @return self + */ + public function setCountLess($countLess) + { + if (is_null($countLess)) { + array_push($this->openAPINullablesSetToNull, 'countLess'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('countLess', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['countLess'] = $countLess; + + return $this; + } + + /** + * Gets countMore + * + * @return mixed|null + */ + public function getCountMore() + { + return $this->container['countMore']; + } + + /** + * Sets countMore + * + * @param mixed|null $countMore countMore + * + * @return self + */ + public function setCountMore($countMore) + { + if (is_null($countMore)) { + array_push($this->openAPINullablesSetToNull, 'countMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('countMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['countMore'] = $countMore; + + 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/Gift.php b/src/Model/Gift.php new file mode 100644 index 0000000..e4bddab --- /dev/null +++ b/src/Model/Gift.php @@ -0,0 +1,534 @@ + + */ +class Gift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Gift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'float', + 'balance' => 'float', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return float|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param float|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/InapplicableTo.php b/src/Model/InapplicableTo.php new file mode 100644 index 0000000..8ba19ac --- /dev/null +++ b/src/Model/InapplicableTo.php @@ -0,0 +1,1145 @@ + + */ +class InapplicableTo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InapplicableTo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'id' => 'string', + 'sourceId' => 'string', + 'productId' => 'string', + 'productSourceId' => 'string', + 'strict' => 'bool', + 'price' => 'float', + 'priceFormula' => 'float', + 'effect' => 'string', + 'quantityLimit' => 'int', + 'aggregatedQuantityLimit' => 'int', + 'amountLimit' => 'int', + 'aggregatedAmountLimit' => 'int', + 'orderItemIndices' => 'int[]', + 'repeat' => 'int', + 'skipInitially' => 'int', + 'target' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'id' => null, + 'sourceId' => null, + 'productId' => null, + 'productSourceId' => null, + 'strict' => null, + 'price' => null, + 'priceFormula' => null, + 'effect' => null, + 'quantityLimit' => null, + 'aggregatedQuantityLimit' => null, + 'amountLimit' => null, + 'aggregatedAmountLimit' => null, + 'orderItemIndices' => null, + 'repeat' => null, + 'skipInitially' => null, + 'target' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'id' => true, + 'sourceId' => true, + 'productId' => true, + 'productSourceId' => true, + 'strict' => true, + 'price' => true, + 'priceFormula' => true, + 'effect' => true, + 'quantityLimit' => true, + 'aggregatedQuantityLimit' => true, + 'amountLimit' => true, + 'aggregatedAmountLimit' => true, + 'orderItemIndices' => true, + 'repeat' => true, + 'skipInitially' => true, + 'target' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'id' => 'id', + 'sourceId' => 'source_id', + 'productId' => 'product_id', + 'productSourceId' => 'product_source_id', + 'strict' => 'strict', + 'price' => 'price', + 'priceFormula' => 'price_formula', + 'effect' => 'effect', + 'quantityLimit' => 'quantity_limit', + 'aggregatedQuantityLimit' => 'aggregated_quantity_limit', + 'amountLimit' => 'amount_limit', + 'aggregatedAmountLimit' => 'aggregated_amount_limit', + 'orderItemIndices' => 'order_item_indices', + 'repeat' => 'repeat', + 'skipInitially' => 'skip_initially', + 'target' => 'target' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'productId' => 'setProductId', + 'productSourceId' => 'setProductSourceId', + 'strict' => 'setStrict', + 'price' => 'setPrice', + 'priceFormula' => 'setPriceFormula', + 'effect' => 'setEffect', + 'quantityLimit' => 'setQuantityLimit', + 'aggregatedQuantityLimit' => 'setAggregatedQuantityLimit', + 'amountLimit' => 'setAmountLimit', + 'aggregatedAmountLimit' => 'setAggregatedAmountLimit', + 'orderItemIndices' => 'setOrderItemIndices', + 'repeat' => 'setRepeat', + 'skipInitially' => 'setSkipInitially', + 'target' => 'setTarget' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'productId' => 'getProductId', + 'productSourceId' => 'getProductSourceId', + 'strict' => 'getStrict', + 'price' => 'getPrice', + 'priceFormula' => 'getPriceFormula', + 'effect' => 'getEffect', + 'quantityLimit' => 'getQuantityLimit', + 'aggregatedQuantityLimit' => 'getAggregatedQuantityLimit', + 'amountLimit' => 'getAmountLimit', + 'aggregatedAmountLimit' => 'getAggregatedAmountLimit', + 'orderItemIndices' => 'getOrderItemIndices', + 'repeat' => 'getRepeat', + 'skipInitially' => 'getSkipInitially', + 'target' => 'getTarget' + ]; + + /** + * 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 OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + public const OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const EFFECT_EVERY = 'APPLY_TO_EVERY'; + public const EFFECT_CHEAPEST = 'APPLY_TO_CHEAPEST'; + public const EFFECT_MOST_EXPENSIVE = 'APPLY_TO_MOST_EXPENSIVE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + self::OBJECT_PRODUCTS_COLLECTION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_EVERY, + self::EFFECT_CHEAPEST, + self::EFFECT_MOST_EXPENSIVE, + ]; + } + + /** + * 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('object', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('productSourceId', $data ?? [], null); + $this->setIfExists('strict', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('priceFormula', $data ?? [], null); + $this->setIfExists('effect', $data ?? [], null); + $this->setIfExists('quantityLimit', $data ?? [], null); + $this->setIfExists('aggregatedQuantityLimit', $data ?? [], null); + $this->setIfExists('amountLimit', $data ?? [], null); + $this->setIfExists('aggregatedAmountLimit', $data ?? [], null); + $this->setIfExists('orderItemIndices', $data ?? [], null); + $this->setIfExists('repeat', $data ?? [], null); + $this->setIfExists('skipInitially', $data ?? [], null); + $this->setIfExists('target', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object This object stores information about the product collection. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product collection ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The source ID from your inventory system. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId Parent product's unique ID assigned by Voucherify. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets productSourceId + * + * @return string|null + */ + public function getProductSourceId() + { + return $this->container['productSourceId']; + } + + /** + * Sets productSourceId + * + * @param string|null $productSourceId Parent product's source ID from your inventory system. + * + * @return self + */ + public function setProductSourceId($productSourceId) + { + if (is_null($productSourceId)) { + array_push($this->openAPINullablesSetToNull, 'productSourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productSourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productSourceId'] = $productSourceId; + + return $this; + } + + /** + * Gets strict + * + * @return bool|null + */ + public function getStrict() + { + return $this->container['strict']; + } + + /** + * Sets strict + * + * @param bool|null $strict strict + * + * @return self + */ + public function setStrict($strict) + { + if (is_null($strict)) { + array_push($this->openAPINullablesSetToNull, 'strict'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('strict', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['strict'] = $strict; + + return $this; + } + + /** + * Gets price + * + * @return float|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float|null $price New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets priceFormula + * + * @return float|null + */ + public function getPriceFormula() + { + return $this->container['priceFormula']; + } + + /** + * Sets priceFormula + * + * @param float|null $priceFormula Formula used to calculate the discounted price of an item. + * + * @return self + */ + public function setPriceFormula($priceFormula) + { + if (is_null($priceFormula)) { + array_push($this->openAPINullablesSetToNull, 'priceFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('priceFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['priceFormula'] = $priceFormula; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect effect + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + return $this; + } + + /** + * Gets quantityLimit + * + * @return int|null + */ + public function getQuantityLimit() + { + return $this->container['quantityLimit']; + } + + /** + * Sets quantityLimit + * + * @param int|null $quantityLimit The maximum number of units allowed to be discounted per order line item. + * + * @return self + */ + public function setQuantityLimit($quantityLimit) + { + if (is_null($quantityLimit)) { + array_push($this->openAPINullablesSetToNull, 'quantityLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantityLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantityLimit'] = $quantityLimit; + + return $this; + } + + /** + * Gets aggregatedQuantityLimit + * + * @return int|null + */ + public function getAggregatedQuantityLimit() + { + return $this->container['aggregatedQuantityLimit']; + } + + /** + * Sets aggregatedQuantityLimit + * + * @param int|null $aggregatedQuantityLimit The maximum number of units allowed to be discounted combined across all matched order line items. + * + * @return self + */ + public function setAggregatedQuantityLimit($aggregatedQuantityLimit) + { + if (is_null($aggregatedQuantityLimit)) { + array_push($this->openAPINullablesSetToNull, 'aggregatedQuantityLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('aggregatedQuantityLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['aggregatedQuantityLimit'] = $aggregatedQuantityLimit; + + return $this; + } + + /** + * Gets amountLimit + * + * @return int|null + */ + public function getAmountLimit() + { + return $this->container['amountLimit']; + } + + /** + * Sets amountLimit + * + * @param int|null $amountLimit Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. + * + * @return self + */ + public function setAmountLimit($amountLimit) + { + if (is_null($amountLimit)) { + array_push($this->openAPINullablesSetToNull, 'amountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountLimit'] = $amountLimit; + + return $this; + } + + /** + * Gets aggregatedAmountLimit + * + * @return int|null + */ + public function getAggregatedAmountLimit() + { + return $this->container['aggregatedAmountLimit']; + } + + /** + * Sets aggregatedAmountLimit + * + * @param int|null $aggregatedAmountLimit Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value) + * + * @return self + */ + public function setAggregatedAmountLimit($aggregatedAmountLimit) + { + if (is_null($aggregatedAmountLimit)) { + array_push($this->openAPINullablesSetToNull, 'aggregatedAmountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('aggregatedAmountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['aggregatedAmountLimit'] = $aggregatedAmountLimit; + + return $this; + } + + /** + * Gets orderItemIndices + * + * @return int[]|null + */ + public function getOrderItemIndices() + { + return $this->container['orderItemIndices']; + } + + /** + * Sets orderItemIndices + * + * @param int[]|null $orderItemIndices orderItemIndices + * + * @return self + */ + public function setOrderItemIndices($orderItemIndices) + { + if (is_null($orderItemIndices)) { + array_push($this->openAPINullablesSetToNull, 'orderItemIndices'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItemIndices', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItemIndices'] = $orderItemIndices; + + return $this; + } + + /** + * Gets repeat + * + * @return int|null + */ + public function getRepeat() + { + return $this->container['repeat']; + } + + /** + * Sets repeat + * + * @param int|null $repeat repeat + * + * @return self + */ + public function setRepeat($repeat) + { + if (is_null($repeat)) { + array_push($this->openAPINullablesSetToNull, 'repeat'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('repeat', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['repeat'] = $repeat; + + return $this; + } + + /** + * Gets skipInitially + * + * @return int|null + */ + public function getSkipInitially() + { + return $this->container['skipInitially']; + } + + /** + * Sets skipInitially + * + * @param int|null $skipInitially skipInitially + * + * @return self + */ + public function setSkipInitially($skipInitially) + { + if (is_null($skipInitially)) { + array_push($this->openAPINullablesSetToNull, 'skipInitially'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skipInitially', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skipInitially'] = $skipInitially; + + return $this; + } + + /** + * Gets target + * + * @return string|null + */ + public function getTarget() + { + return $this->container['target']; + } + + /** + * Sets target + * + * @param string|null $target target + * + * @return self + */ + public function setTarget($target) + { + if (is_null($target)) { + array_push($this->openAPINullablesSetToNull, 'target'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('target', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['target'] = $target; + + 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/InapplicableToResultList.php b/src/Model/InapplicableToResultList.php new file mode 100644 index 0000000..9e20b74 --- /dev/null +++ b/src/Model/InapplicableToResultList.php @@ -0,0 +1,613 @@ + + */ +class InapplicableToResultList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InapplicableToResultList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\OpenAPI\Client\Model\InapplicableTo[]', + 'total' => 'int', + 'object' => 'string', + 'dataRef' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'total' => null, + 'object' => null, + 'dataRef' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => true, + 'total' => true, + 'object' => true, + 'dataRef' => true + ]; + + /** + * 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 = [ + 'data' => 'data', + 'total' => 'total', + 'object' => 'object', + 'dataRef' => 'data_ref' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'total' => 'setTotal', + 'object' => 'setObject', + 'dataRef' => 'setDataRef' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'total' => 'getTotal', + 'object' => 'getObject', + 'dataRef' => 'getDataRef' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + } + + /** + * 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 = []; + + if (!is_null($this->container['total']) && ($this->container['total'] < 0)) { + $invalidProperties[] = "invalid value for 'total', must be bigger than or equal to 0."; + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 data + * + * @return \OpenAPI\Client\Model\InapplicableTo[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\InapplicableTo[]|null $data Contains array of items to which the discount cannot apply. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of objects defining included products, SKUs, or product collections. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($total) && ($total < 0)) { + throw new \InvalidArgumentException('invalid value for $total when calling InapplicableToResultList., must be bigger than or equal to 0.'); + } + + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef The type of the object represented by JSON. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + 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/ListPublicationsItemVoucher.php b/src/Model/ListPublicationsItemVoucher.php new file mode 100644 index 0000000..9f01410 --- /dev/null +++ b/src/Model/ListPublicationsItemVoucher.php @@ -0,0 +1,681 @@ + + */ +class ListPublicationsItemVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ListPublicationsItemVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'object' => 'string', + 'campaign' => 'string', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'loyaltyCard' => 'object', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'isReferralCode' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'object' => null, + 'campaign' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'discount' => null, + 'isReferralCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'object' => true, + 'campaign' => true, + 'gift' => false, + 'loyaltyCard' => true, + 'discount' => false, + 'isReferralCode' => true + ]; + + /** + * 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 = [ + 'code' => 'code', + 'object' => 'object', + 'campaign' => 'campaign', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'discount' => 'discount', + 'isReferralCode' => 'is_referral_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'object' => 'setObject', + 'campaign' => 'setCampaign', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'discount' => 'setDiscount', + 'isReferralCode' => 'setIsReferralCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'object' => 'getObject', + 'campaign' => 'getCampaign', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'discount' => 'getDiscount', + 'isReferralCode' => 'getIsReferralCode' + ]; + + /** + * 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 OBJECT_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + ]; + } + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('isReferralCode', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Voucher code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign Campaign name + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return object|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param object|null $loyaltyCard Defines the loyalty card details. + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + 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/LoyaltiesCreateCampaignRequestBody.php b/src/Model/LoyaltiesCreateCampaignRequestBody.php new file mode 100644 index 0000000..3a5d5a7 --- /dev/null +++ b/src/Model/LoyaltiesCreateCampaignRequestBody.php @@ -0,0 +1,1243 @@ + + */ +class LoyaltiesCreateCampaignRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesCreateCampaignRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'type' => 'string', + 'joinOnce' => 'bool', + 'autoJoin' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'validationRules' => 'string[]', + 'categoryId' => 'string', + 'category' => 'string', + 'metadata' => 'object', + 'campaignType' => 'string', + 'voucher' => '\OpenAPI\Client\Model\CampaignLoyaltyVoucher' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'type' => null, + 'joinOnce' => null, + 'autoJoin' => null, + 'useVoucherMetadataSchema' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'validationRules' => null, + 'categoryId' => null, + 'category' => null, + 'metadata' => null, + 'campaignType' => null, + 'voucher' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'description' => true, + 'type' => true, + 'joinOnce' => true, + 'autoJoin' => true, + 'useVoucherMetadataSchema' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'validationRules' => true, + 'categoryId' => true, + 'category' => true, + 'metadata' => true, + 'campaignType' => true, + 'voucher' => 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 = [ + 'name' => 'name', + 'description' => 'description', + 'type' => 'type', + 'joinOnce' => 'join_once', + 'autoJoin' => 'auto_join', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'validationRules' => 'validation_rules', + 'categoryId' => 'category_id', + 'category' => 'category', + 'metadata' => 'metadata', + 'campaignType' => 'campaign_type', + 'voucher' => 'voucher' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'type' => 'setType', + 'joinOnce' => 'setJoinOnce', + 'autoJoin' => 'setAutoJoin', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'validationRules' => 'setValidationRules', + 'categoryId' => 'setCategoryId', + 'category' => 'setCategory', + 'metadata' => 'setMetadata', + 'campaignType' => 'setCampaignType', + 'voucher' => 'setVoucher' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'type' => 'getType', + 'joinOnce' => 'getJoinOnce', + 'autoJoin' => 'getAutoJoin', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'validationRules' => 'getValidationRules', + 'categoryId' => 'getCategoryId', + 'category' => 'getCategory', + 'metadata' => 'getMetadata', + 'campaignType' => 'getCampaignType', + 'voucher' => 'getVoucher' + ]; + + /** + * 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 TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('validationRules', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], 'LOYALTY_PROGRAM'); + $this->setIfExists('voucher', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['validationRules']) && (count($this->container['validationRules']) > 1)) { + $invalidProperties[] = "invalid value for 'validationRules', number of items must be less than or equal to 1."; + } + + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign (size of campaign). + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets validationRules + * + * @return string[]|null + */ + public function getValidationRules() + { + return $this->container['validationRules']; + } + + /** + * Sets validationRules + * + * @param string[]|null $validationRules Array containing the ID of the validation rule associated with the promotion tier. + * + * @return self + */ + public function setValidationRules($validationRules) + { + if (is_null($validationRules)) { + array_push($this->openAPINullablesSetToNull, 'validationRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($validationRules) && (count($validationRules) > 1)) { + throw new \InvalidArgumentException('invalid value for $validationRules when calling LoyaltiesCreateCampaignRequestBody., number of items must be less than or equal to 1.'); + } + $this->container['validationRules'] = $validationRules; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The category assigned to the campaign. Either pass this parameter OR the `category_id`. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\CampaignLoyaltyVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\CampaignLoyaltyVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + 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/LoyaltiesCreateCampaignResponseBody.php b/src/Model/LoyaltiesCreateCampaignResponseBody.php new file mode 100644 index 0000000..19029f2 --- /dev/null +++ b/src/Model/LoyaltiesCreateCampaignResponseBody.php @@ -0,0 +1,1745 @@ + + */ +class LoyaltiesCreateCampaignResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesCreateCampaignResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'campaignType' => 'string', + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\LoyaltyCampaignVoucher', + 'autoJoin' => 'bool', + 'joinOnce' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'active' => 'bool', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'category' => 'string', + 'creationStatus' => 'string', + 'vouchersGenerationStatus' => 'string', + 'protected' => 'bool', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'object' => 'string', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'accessSettingsAssignments' => '\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'description' => null, + 'campaignType' => null, + 'type' => null, + 'voucher' => null, + 'autoJoin' => null, + 'joinOnce' => null, + 'useVoucherMetadataSchema' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'active' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'category' => null, + 'creationStatus' => null, + 'vouchersGenerationStatus' => null, + 'protected' => null, + 'categoryId' => null, + 'categories' => null, + 'object' => null, + 'loyaltyTiersExpiration' => null, + 'validationRulesAssignments' => null, + 'accessSettingsAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'description' => true, + 'campaignType' => true, + 'type' => true, + 'voucher' => false, + 'autoJoin' => true, + 'joinOnce' => true, + 'useVoucherMetadataSchema' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'active' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'category' => true, + 'creationStatus' => true, + 'vouchersGenerationStatus' => true, + 'protected' => true, + 'categoryId' => true, + 'categories' => true, + 'object' => true, + 'loyaltyTiersExpiration' => false, + 'validationRulesAssignments' => false, + 'accessSettingsAssignments' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'campaignType' => 'campaign_type', + 'type' => 'type', + 'voucher' => 'voucher', + 'autoJoin' => 'auto_join', + 'joinOnce' => 'join_once', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'active' => 'active', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'category' => 'category', + 'creationStatus' => 'creation_status', + 'vouchersGenerationStatus' => 'vouchers_generation_status', + 'protected' => 'protected', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'object' => 'object', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'accessSettingsAssignments' => 'access_settings_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'campaignType' => 'setCampaignType', + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'autoJoin' => 'setAutoJoin', + 'joinOnce' => 'setJoinOnce', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'category' => 'setCategory', + 'creationStatus' => 'setCreationStatus', + 'vouchersGenerationStatus' => 'setVouchersGenerationStatus', + 'protected' => 'setProtected', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'object' => 'setObject', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'accessSettingsAssignments' => 'setAccessSettingsAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'campaignType' => 'getCampaignType', + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'autoJoin' => 'getAutoJoin', + 'joinOnce' => 'getJoinOnce', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'category' => 'getCategory', + 'creationStatus' => 'getCreationStatus', + 'vouchersGenerationStatus' => 'getVouchersGenerationStatus', + 'protected' => 'getProtected', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'object' => 'getObject', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'accessSettingsAssignments' => 'getAccessSettingsAssignments' + ]; + + /** + * 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 CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CREATION_STATUS_DONE = 'DONE'; + public const CREATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const CREATION_STATUS_FAILED = 'FAILED'; + public const CREATION_STATUS_DRAFT = 'DRAFT'; + public const CREATION_STATUS_MODIFYING = 'MODIFYING'; + public const VOUCHERS_GENERATION_STATUS_DONE = 'DONE'; + public const VOUCHERS_GENERATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const VOUCHERS_GENERATION_STATUS_FAILED = 'FAILED'; + public const VOUCHERS_GENERATION_STATUS_DRAFT = 'DRAFT'; + public const VOUCHERS_GENERATION_STATUS_MODIFYING = 'MODIFYING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCreationStatusAllowableValues() + { + return [ + self::CREATION_STATUS_DONE, + self::CREATION_STATUS_IN_PROGRESS, + self::CREATION_STATUS_FAILED, + self::CREATION_STATUS_DRAFT, + self::CREATION_STATUS_MODIFYING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVouchersGenerationStatusAllowableValues() + { + return [ + self::VOUCHERS_GENERATION_STATUS_DONE, + self::VOUCHERS_GENERATION_STATUS_IN_PROGRESS, + self::VOUCHERS_GENERATION_STATUS_FAILED, + self::VOUCHERS_GENERATION_STATUS_DRAFT, + self::VOUCHERS_GENERATION_STATUS_MODIFYING, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], 'LOYALTY_PROGRAM'); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('creationStatus', $data ?? [], null); + $this->setIfExists('vouchersGenerationStatus', $data ?? [], null); + $this->setIfExists('protected', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('accessSettingsAssignments', $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->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($this->container['creationStatus']) && !in_array($this->container['creationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'creationStatus', must be one of '%s'", + $this->container['creationStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($this->container['vouchersGenerationStatus']) && !in_array($this->container['vouchersGenerationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $this->container['vouchersGenerationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\LoyaltyCampaignVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\LoyaltyCampaignVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign. + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Unique category name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets creationStatus + * + * @return string|null + */ + public function getCreationStatus() + { + return $this->container['creationStatus']; + } + + /** + * Sets creationStatus + * + * @param string|null $creationStatus Indicates the status of the campaign creation. + * + * @return self + */ + public function setCreationStatus($creationStatus) + { + if (is_null($creationStatus)) { + array_push($this->openAPINullablesSetToNull, 'creationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($creationStatus) && !in_array($creationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'creationStatus', must be one of '%s'", + $creationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['creationStatus'] = $creationStatus; + + return $this; + } + + /** + * Gets vouchersGenerationStatus + * + * @return string|null + */ + public function getVouchersGenerationStatus() + { + return $this->container['vouchersGenerationStatus']; + } + + /** + * Sets vouchersGenerationStatus + * + * @param string|null $vouchersGenerationStatus Indicates the status of the campaign's voucher generation. + * + * @return self + */ + public function setVouchersGenerationStatus($vouchersGenerationStatus) + { + if (is_null($vouchersGenerationStatus)) { + array_push($this->openAPINullablesSetToNull, 'vouchersGenerationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersGenerationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($vouchersGenerationStatus) && !in_array($vouchersGenerationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $vouchersGenerationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['vouchersGenerationStatus'] = $vouchersGenerationStatus; + + return $this; + } + + /** + * Gets protected + * + * @return bool|null + */ + public function getProtected() + { + return $this->container['protected']; + } + + /** + * Sets protected + * + * @param bool|null $protected Indicates whether the resource can be deleted. + * + * @return self + */ + public function setProtected($protected) + { + if (is_null($protected)) { + array_push($this->openAPINullablesSetToNull, 'protected'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('protected', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['protected'] = $protected; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets accessSettingsAssignments + * + * @return \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null + */ + public function getAccessSettingsAssignments() + { + return $this->container['accessSettingsAssignments']; + } + + /** + * Sets accessSettingsAssignments + * + * @param \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null $accessSettingsAssignments accessSettingsAssignments + * + * @return self + */ + public function setAccessSettingsAssignments($accessSettingsAssignments) + { + if (is_null($accessSettingsAssignments)) { + throw new \InvalidArgumentException('non-nullable accessSettingsAssignments cannot be null'); + } + $this->container['accessSettingsAssignments'] = $accessSettingsAssignments; + + 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/LoyaltiesDeleteResponseBody.php b/src/Model/LoyaltiesDeleteResponseBody.php new file mode 100644 index 0000000..eed30c4 --- /dev/null +++ b/src/Model/LoyaltiesDeleteResponseBody.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesDeleteResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesDeleteResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/LoyaltiesEarningRulesCreateRequestBodyItem.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItem.php new file mode 100644 index 0000000..e37aa67 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItem.php @@ -0,0 +1,942 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'validationRuleId' => 'string', + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyalty', + 'event' => 'string', + 'source' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemSource', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'metadata' => 'object', + 'segment' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemSegment', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent', + 'loyaltyTier' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'validationRuleId' => null, + 'loyalty' => null, + 'event' => null, + 'source' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'metadata' => null, + 'segment' => null, + 'customEvent' => null, + 'loyaltyTier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'validationRuleId' => true, + 'loyalty' => false, + 'event' => false, + 'source' => false, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'metadata' => false, + 'segment' => true, + 'customEvent' => true, + 'loyaltyTier' => true + ]; + + /** + * 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 = [ + 'validationRuleId' => 'validation_rule_id', + 'loyalty' => 'loyalty', + 'event' => 'event', + 'source' => 'source', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'metadata' => 'metadata', + 'segment' => 'segment', + 'customEvent' => 'custom_event', + 'loyaltyTier' => 'loyalty_tier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'validationRuleId' => 'setValidationRuleId', + 'loyalty' => 'setLoyalty', + 'event' => 'setEvent', + 'source' => 'setSource', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'metadata' => 'setMetadata', + 'segment' => 'setSegment', + 'customEvent' => 'setCustomEvent', + 'loyaltyTier' => 'setLoyaltyTier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'validationRuleId' => 'getValidationRuleId', + 'loyalty' => 'getLoyalty', + 'event' => 'getEvent', + 'source' => 'getSource', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'metadata' => 'getMetadata', + 'segment' => 'getSegment', + 'customEvent' => 'getCustomEvent', + 'loyaltyTier' => 'getLoyaltyTier' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('validationRuleId', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('loyaltyTier', $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 validationRuleId + * + * @return string|null + */ + public function getValidationRuleId() + { + return $this->container['validationRuleId']; + } + + /** + * Sets validationRuleId + * + * @param string|null $validationRuleId A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + * + * @return self + */ + public function setValidationRuleId($validationRuleId) + { + if (is_null($validationRuleId)) { + array_push($this->openAPINullablesSetToNull, 'validationRuleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRuleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRuleId'] = $validationRuleId; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + throw new \InvalidArgumentException('non-nullable loyalty cannot be null'); + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + throw new \InvalidArgumentException('non-nullable event cannot be null'); + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemSource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemSource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + throw new \InvalidArgumentException('non-nullable source cannot be null'); + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemSegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemSegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.php new file mode 100644 index 0000000..8db64d8 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'schemaId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'schemaId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schemaId' => true + ]; + + /** + * 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 = [ + 'schemaId' => 'schema_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'schemaId' => 'setSchemaId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'schemaId' => 'getSchemaId' + ]; + + /** + * 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('schemaId', $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 schemaId + * + * @return string|null + */ + public function getSchemaId() + { + return $this->container['schemaId']; + } + + /** + * Sets schemaId + * + * @param string|null $schemaId Contains a unique identifier of a custom event schema. Assigned by the Voucherify API. + * + * @return self + */ + public function setSchemaId($schemaId) + { + if (is_null($schemaId)) { + array_push($this->openAPINullablesSetToNull, 'schemaId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('schemaId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['schemaId'] = $schemaId; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.php new file mode 100644 index 0000000..b21f240 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.php @@ -0,0 +1,715 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'points' => 'int', + 'calculationType' => 'string', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent', + 'orderItems' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems', + 'order' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder', + 'customer' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'points' => null, + 'calculationType' => null, + 'customEvent' => null, + 'orderItems' => null, + 'order' => null, + 'customer' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'points' => true, + 'calculationType' => false, + 'customEvent' => true, + 'orderItems' => false, + 'order' => false, + 'customer' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'points' => 'points', + 'calculationType' => 'calculation_type', + 'customEvent' => 'custom_event', + 'orderItems' => 'order_items', + 'order' => 'order', + 'customer' => 'customer' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'points' => 'setPoints', + 'calculationType' => 'setCalculationType', + 'customEvent' => 'setCustomEvent', + 'orderItems' => 'setOrderItems', + 'order' => 'setOrder', + 'customer' => 'setCustomer' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'points' => 'getPoints', + 'calculationType' => 'getCalculationType', + 'customEvent' => 'getCustomEvent', + 'orderItems' => 'getOrderItems', + 'order' => 'getOrder', + 'customer' => 'getCustomer' + ]; + + /** + * 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 TYPE_FIXED = 'FIXED'; + public const TYPE_PROPORTIONAL = 'PROPORTIONAL'; + public const CALCULATION_TYPE_CUSTOM_EVENT_METADATA = 'CUSTOM_EVENT_METADATA'; + public const CALCULATION_TYPE_ORDER_ITEMS_QUANTITY = 'ORDER_ITEMS_QUANTITY'; + public const CALCULATION_TYPE_ORDER_ITEMS_AMOUNT = 'ORDER_ITEMS_AMOUNT'; + public const CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT = 'ORDER_ITEMS_SUBTOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_AMOUNT = 'ORDER_AMOUNT'; + public const CALCULATION_TYPE_ORDER_TOTAL_AMOUNT = 'ORDER_TOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_METADATA = 'ORDER_METADATA'; + public const CALCULATION_TYPE_CUSTOMER_METADATA = 'CUSTOMER_METADATA'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_FIXED, + self::TYPE_PROPORTIONAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCalculationTypeAllowableValues() + { + return [ + self::CALCULATION_TYPE_CUSTOM_EVENT_METADATA, + self::CALCULATION_TYPE_ORDER_ITEMS_QUANTITY, + self::CALCULATION_TYPE_ORDER_ITEMS_AMOUNT, + self::CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_AMOUNT, + self::CALCULATION_TYPE_ORDER_TOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_METADATA, + self::CALCULATION_TYPE_CUSTOMER_METADATA, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('calculationType', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('orderItems', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('customer', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($this->container['calculationType']) && !in_array($this->container['calculationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'calculationType', must be one of '%s'", + $this->container['calculationType'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets calculationType + * + * @return string|null + */ + public function getCalculationType() + { + return $this->container['calculationType']; + } + + /** + * Sets calculationType + * + * @param string|null $calculationType calculationType + * + * @return self + */ + public function setCalculationType($calculationType) + { + if (is_null($calculationType)) { + throw new \InvalidArgumentException('non-nullable calculationType cannot be null'); + } + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!in_array($calculationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'calculationType', must be one of '%s'", + $calculationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['calculationType'] = $calculationType; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets orderItems + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems|null + */ + public function getOrderItems() + { + return $this->container['orderItems']; + } + + /** + * Sets orderItems + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems|null $orderItems orderItems + * + * @return self + */ + public function setOrderItems($orderItems) + { + if (is_null($orderItems)) { + throw new \InvalidArgumentException('non-nullable orderItems cannot be null'); + } + $this->container['orderItems'] = $orderItems; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.php new file mode 100644 index 0000000..b712f99 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.php new file mode 100644 index 0000000..04c95dd --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Custom event metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.php new file mode 100644 index 0000000..e566cbe --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.php new file mode 100644 index 0000000..b354b7d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Customer metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.php new file mode 100644 index 0000000..089fa4f --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount', + 'totalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount', + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'totalAmount' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'totalAmount' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'totalAmount' => 'total_amount', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'totalAmount' => 'setTotalAmount', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'totalAmount' => 'getTotalAmount', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('metadata', $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 amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount|null $totalAmount totalAmount + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.php new file mode 100644 index 0000000..ca5902e --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.php new file mode 100644 index 0000000..211e610 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity', + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount', + 'subtotalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'amount' => null, + 'subtotalAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'amount' => true, + 'subtotalAmount' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'amount' => 'amount', + 'subtotalAmount' => 'subtotal_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'amount' => 'setAmount', + 'subtotalAmount' => 'setSubtotalAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'amount' => 'getAmount', + 'subtotalAmount' => 'getSubtotalAmount' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('subtotalAmount', $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 quantity + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount|null $subtotalAmount subtotalAmount + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.php new file mode 100644 index 0000000..23db75a --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.php new file mode 100644 index 0000000..a5780eb --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.php new file mode 100644 index 0000000..47c4c02 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.php new file mode 100644 index 0000000..5032452 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the order metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Order metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.php new file mode 100644 index 0000000..884518d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.php new file mode 100644 index 0000000..abce9f9 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemSegment.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemSegment.php new file mode 100644 index 0000000..31eee15 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemSegment.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemSegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemSegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateRequestBodyItemSource.php b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemSource.php new file mode 100644 index 0000000..a5cfd5d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateRequestBodyItemSource.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesCreateRequestBodyItemSource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateRequestBodyItemSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner' + ]; + + /** + * 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('banner', $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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + 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/LoyaltiesEarningRulesCreateResponseBody.php b/src/Model/LoyaltiesEarningRulesCreateResponseBody.php new file mode 100644 index 0000000..7301c4f --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBody.php @@ -0,0 +1,1208 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyalty', + 'event' => 'string', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyCustomEvent', + 'segment' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodySegment', + 'loyaltyTier' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier', + 'source' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodySource', + 'object' => 'string', + 'automationId' => 'string', + 'startDate' => 'string', + 'expirationDate' => 'string', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'metadata' => 'object', + 'validationRuleId' => 'string', + 'updatedAt' => '\DateTime', + 'active' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'loyalty' => null, + 'event' => null, + 'customEvent' => null, + 'segment' => null, + 'loyaltyTier' => null, + 'source' => null, + 'object' => null, + 'automationId' => null, + 'startDate' => null, + 'expirationDate' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'metadata' => null, + 'validationRuleId' => null, + 'updatedAt' => 'date-time', + 'active' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'loyalty' => true, + 'event' => true, + 'customEvent' => true, + 'segment' => true, + 'loyaltyTier' => true, + 'source' => true, + 'object' => true, + 'automationId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'metadata' => true, + 'validationRuleId' => true, + 'updatedAt' => true, + 'active' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'loyalty' => 'loyalty', + 'event' => 'event', + 'customEvent' => 'custom_event', + 'segment' => 'segment', + 'loyaltyTier' => 'loyalty_tier', + 'source' => 'source', + 'object' => 'object', + 'automationId' => 'automation_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'metadata' => 'metadata', + 'validationRuleId' => 'validation_rule_id', + 'updatedAt' => 'updated_at', + 'active' => 'active' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'loyalty' => 'setLoyalty', + 'event' => 'setEvent', + 'customEvent' => 'setCustomEvent', + 'segment' => 'setSegment', + 'loyaltyTier' => 'setLoyaltyTier', + 'source' => 'setSource', + 'object' => 'setObject', + 'automationId' => 'setAutomationId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'metadata' => 'setMetadata', + 'validationRuleId' => 'setValidationRuleId', + 'updatedAt' => 'setUpdatedAt', + 'active' => 'setActive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'loyalty' => 'getLoyalty', + 'event' => 'getEvent', + 'customEvent' => 'getCustomEvent', + 'segment' => 'getSegment', + 'loyaltyTier' => 'getLoyaltyTier', + 'source' => 'getSource', + 'object' => 'getObject', + 'automationId' => 'getAutomationId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'metadata' => 'getMetadata', + 'validationRuleId' => 'getValidationRuleId', + 'updatedAt' => 'getUpdatedAt', + 'active' => 'getActive' + ]; + + /** + * 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 OBJECT_EARNING_RULE = 'earning_rule'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EARNING_RULE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'earning_rule'); + $this->setIfExists('automationId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('validationRuleId', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('active', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the earning rule object. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodySegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodySegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodySource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodySource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is earning_rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets automationId + * + * @return string|null + */ + public function getAutomationId() + { + return $this->container['automationId']; + } + + /** + * Sets automationId + * + * @param string|null $automationId For internal use by Voucherify. + * + * @return self + */ + public function setAutomationId($automationId) + { + if (is_null($automationId)) { + array_push($this->openAPINullablesSetToNull, 'automationId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('automationId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['automationId'] = $automationId; + + return $this; + } + + /** + * Gets startDate + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param string|null $startDate Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return string|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param string|null $expirationDate Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets validationRuleId + * + * @return string|null + */ + public function getValidationRuleId() + { + return $this->container['validationRuleId']; + } + + /** + * Sets validationRuleId + * + * @param string|null $validationRuleId A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + * + * @return self + */ + public function setValidationRuleId($validationRuleId) + { + if (is_null($validationRuleId)) { + array_push($this->openAPINullablesSetToNull, 'validationRuleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRuleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRuleId'] = $validationRuleId; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + 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/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.php new file mode 100644 index 0000000..6f4e94f --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'schemaId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'schemaId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schemaId' => true + ]; + + /** + * 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 = [ + 'schemaId' => 'schema_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'schemaId' => 'setSchemaId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'schemaId' => 'getSchemaId' + ]; + + /** + * 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('schemaId', $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 schemaId + * + * @return string|null + */ + public function getSchemaId() + { + return $this->container['schemaId']; + } + + /** + * Sets schemaId + * + * @param string|null $schemaId Unique identifier of the custom event schema + * + * @return self + */ + public function setSchemaId($schemaId) + { + if (is_null($schemaId)) { + array_push($this->openAPINullablesSetToNull, 'schemaId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('schemaId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['schemaId'] = $schemaId; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyalty.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyalty.php new file mode 100644 index 0000000..9989392 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyalty.php @@ -0,0 +1,743 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'calculationType' => 'string', + 'order' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder', + 'orderItems' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems', + 'customer' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'calculationType' => null, + 'order' => null, + 'orderItems' => null, + 'customer' => null, + 'customEvent' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'calculationType' => true, + 'order' => true, + 'orderItems' => true, + 'customer' => true, + 'customEvent' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'calculationType' => 'calculation_type', + 'order' => 'order', + 'orderItems' => 'order_items', + 'customer' => 'customer', + 'customEvent' => 'custom_event', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'calculationType' => 'setCalculationType', + 'order' => 'setOrder', + 'orderItems' => 'setOrderItems', + 'customer' => 'setCustomer', + 'customEvent' => 'setCustomEvent', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'calculationType' => 'getCalculationType', + 'order' => 'getOrder', + 'orderItems' => 'getOrderItems', + 'customer' => 'getCustomer', + 'customEvent' => 'getCustomEvent', + 'points' => 'getPoints' + ]; + + /** + * 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 TYPE_PROPORTIONAL = 'PROPORTIONAL'; + public const TYPE_FIXED = 'FIXED'; + public const CALCULATION_TYPE_ORDER_AMOUNT = 'ORDER_AMOUNT'; + public const CALCULATION_TYPE_ORDER_TOTAL_AMOUNT = 'ORDER_TOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_METADATA = 'ORDER_METADATA'; + public const CALCULATION_TYPE_ORDER_ITEMS_QUANTITY = 'ORDER_ITEMS_QUANTITY'; + public const CALCULATION_TYPE_ORDER_ITEMS_AMOUNT = 'ORDER_ITEMS_AMOUNT'; + public const CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT = 'ORDER_ITEMS_SUBTOTAL_AMOUNT'; + public const CALCULATION_TYPE_CUSTOMER_METADATA = 'CUSTOMER_METADATA'; + public const CALCULATION_TYPE_CUSTOM_EVENT_METADATA = 'CUSTOM_EVENT_METADATA'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PROPORTIONAL, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCalculationTypeAllowableValues() + { + return [ + self::CALCULATION_TYPE_ORDER_AMOUNT, + self::CALCULATION_TYPE_ORDER_TOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_METADATA, + self::CALCULATION_TYPE_ORDER_ITEMS_QUANTITY, + self::CALCULATION_TYPE_ORDER_ITEMS_AMOUNT, + self::CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT, + self::CALCULATION_TYPE_CUSTOMER_METADATA, + self::CALCULATION_TYPE_CUSTOM_EVENT_METADATA, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('calculationType', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('orderItems', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('points', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($this->container['calculationType']) && !in_array($this->container['calculationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'calculationType', must be one of '%s'", + $this->container['calculationType'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets calculationType + * + * @return string|null + */ + public function getCalculationType() + { + return $this->container['calculationType']; + } + + /** + * Sets calculationType + * + * @param string|null $calculationType calculationType + * + * @return self + */ + public function setCalculationType($calculationType) + { + if (is_null($calculationType)) { + array_push($this->openAPINullablesSetToNull, 'calculationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('calculationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($calculationType) && !in_array($calculationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'calculationType', must be one of '%s'", + $calculationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['calculationType'] = $calculationType; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets orderItems + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems|null + */ + public function getOrderItems() + { + return $this->container['orderItems']; + } + + /** + * Sets orderItems + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems|null $orderItems orderItems + * + * @return self + */ + public function setOrderItems($orderItems) + { + if (is_null($orderItems)) { + array_push($this->openAPINullablesSetToNull, 'orderItems'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItems', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItems'] = $orderItems; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.php new file mode 100644 index 0000000..99a8e9b --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.php new file mode 100644 index 0000000..f50608c --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Custom event metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.php new file mode 100644 index 0000000..ccff949 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.php new file mode 100644 index 0000000..620ce5f --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Customer metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.php new file mode 100644 index 0000000..d56cc93 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount', + 'totalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount', + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'totalAmount' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'totalAmount' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'totalAmount' => 'total_amount', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'totalAmount' => 'setTotalAmount', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'totalAmount' => 'getTotalAmount', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('metadata', $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 amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount|null $totalAmount totalAmount + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.php new file mode 100644 index 0000000..6f7f9b8 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.php new file mode 100644 index 0000000..608233b --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity', + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount', + 'subtotalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'amount' => null, + 'subtotalAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'amount' => true, + 'subtotalAmount' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'amount' => 'amount', + 'subtotalAmount' => 'subtotal_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'amount' => 'setAmount', + 'subtotalAmount' => 'setSubtotalAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'amount' => 'getAmount', + 'subtotalAmount' => 'getSubtotalAmount' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('subtotalAmount', $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 quantity + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount|null $subtotalAmount subtotalAmount + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.php new file mode 100644 index 0000000..bca9b80 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.php new file mode 100644 index 0000000..4978d24 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.php new file mode 100644 index 0000000..94468fc --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.php new file mode 100644 index 0000000..92c42bd --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the order metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Order metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.php new file mode 100644 index 0000000..4449036 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.php new file mode 100644 index 0000000..a4565e9 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateResponseBodySegment.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodySegment.php new file mode 100644 index 0000000..88b01bd --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodySegment.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodySegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodySegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesCreateResponseBodySource.php b/src/Model/LoyaltiesEarningRulesCreateResponseBodySource.php new file mode 100644 index 0000000..11abf97 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesCreateResponseBodySource.php @@ -0,0 +1,532 @@ + + */ +class LoyaltiesEarningRulesCreateResponseBodySource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesCreateResponseBodySource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string', + 'objectId' => 'string', + 'objectType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null, + 'objectId' => null, + 'objectType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true, + 'objectId' => true, + 'objectType' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner', + 'objectId' => 'object_id', + 'objectType' => 'object_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner', + 'objectId' => 'setObjectId', + 'objectType' => 'setObjectType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner', + 'objectId' => 'getObjectId', + 'objectType' => 'getObjectType' + ]; + + /** + * 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 OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectTypeAllowableValues() + { + return [ + self::OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('banner', $data ?? [], null); + $this->setIfExists('objectId', $data ?? [], null); + $this->setIfExists('objectType', $data ?? [], 'campaign'); + } + + /** + * 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->getObjectTypeAllowableValues(); + if (!is_null($this->container['objectType']) && !in_array($this->container['objectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'objectType', must be one of '%s'", + $this->container['objectType'], + 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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets objectId + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['objectId']; + } + + /** + * Sets objectId + * + * @param string|null $objectId A unique campaign identifier assigned by the Voucherify API. + * + * @return self + */ + public function setObjectId($objectId) + { + if (is_null($objectId)) { + array_push($this->openAPINullablesSetToNull, 'objectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['objectId'] = $objectId; + + return $this; + } + + /** + * Gets objectType + * + * @return string|null + */ + public function getObjectType() + { + return $this->container['objectType']; + } + + /** + * Sets objectType + * + * @param string|null $objectType Defines the object associated with the earning rule. Defaults to `campaign`. + * + * @return self + */ + public function setObjectType($objectType) + { + if (is_null($objectType)) { + array_push($this->openAPINullablesSetToNull, 'objectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectTypeAllowableValues(); + if (!is_null($objectType) && !in_array($objectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'objectType', must be one of '%s'", + $objectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['objectType'] = $objectType; + + 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/LoyaltiesEarningRulesDisableResponseBody.php b/src/Model/LoyaltiesEarningRulesDisableResponseBody.php new file mode 100644 index 0000000..b915a60 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBody.php @@ -0,0 +1,1167 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyalty', + 'event' => 'string', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyCustomEvent', + 'segment' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodySegment', + 'loyaltyTier' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier', + 'source' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodySource', + 'object' => 'string', + 'automationId' => 'string', + 'startDate' => 'string', + 'expirationDate' => 'string', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'metadata' => 'object', + 'updatedAt' => '\DateTime', + 'active' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'loyalty' => null, + 'event' => null, + 'customEvent' => null, + 'segment' => null, + 'loyaltyTier' => null, + 'source' => null, + 'object' => null, + 'automationId' => null, + 'startDate' => null, + 'expirationDate' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'metadata' => null, + 'updatedAt' => 'date-time', + 'active' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'loyalty' => true, + 'event' => true, + 'customEvent' => true, + 'segment' => true, + 'loyaltyTier' => true, + 'source' => true, + 'object' => true, + 'automationId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'metadata' => true, + 'updatedAt' => true, + 'active' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'loyalty' => 'loyalty', + 'event' => 'event', + 'customEvent' => 'custom_event', + 'segment' => 'segment', + 'loyaltyTier' => 'loyalty_tier', + 'source' => 'source', + 'object' => 'object', + 'automationId' => 'automation_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'metadata' => 'metadata', + 'updatedAt' => 'updated_at', + 'active' => 'active' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'loyalty' => 'setLoyalty', + 'event' => 'setEvent', + 'customEvent' => 'setCustomEvent', + 'segment' => 'setSegment', + 'loyaltyTier' => 'setLoyaltyTier', + 'source' => 'setSource', + 'object' => 'setObject', + 'automationId' => 'setAutomationId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'metadata' => 'setMetadata', + 'updatedAt' => 'setUpdatedAt', + 'active' => 'setActive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'loyalty' => 'getLoyalty', + 'event' => 'getEvent', + 'customEvent' => 'getCustomEvent', + 'segment' => 'getSegment', + 'loyaltyTier' => 'getLoyaltyTier', + 'source' => 'getSource', + 'object' => 'getObject', + 'automationId' => 'getAutomationId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'metadata' => 'getMetadata', + 'updatedAt' => 'getUpdatedAt', + 'active' => 'getActive' + ]; + + /** + * 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 OBJECT_EARNING_RULE = 'earning_rule'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EARNING_RULE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'earning_rule'); + $this->setIfExists('automationId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('active', $data ?? [], false); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the earning rule object. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodySegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodySegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodySource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodySource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is earning_rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets automationId + * + * @return string|null + */ + public function getAutomationId() + { + return $this->container['automationId']; + } + + /** + * Sets automationId + * + * @param string|null $automationId For internal use by Voucherify. + * + * @return self + */ + public function setAutomationId($automationId) + { + if (is_null($automationId)) { + array_push($this->openAPINullablesSetToNull, 'automationId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('automationId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['automationId'] = $automationId; + + return $this; + } + + /** + * Gets startDate + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param string|null $startDate Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return string|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param string|null $expirationDate Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + 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/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.php new file mode 100644 index 0000000..b4f69ba --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'schemaId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'schemaId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schemaId' => true + ]; + + /** + * 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 = [ + 'schemaId' => 'schema_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'schemaId' => 'setSchemaId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'schemaId' => 'getSchemaId' + ]; + + /** + * 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('schemaId', $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 schemaId + * + * @return string|null + */ + public function getSchemaId() + { + return $this->container['schemaId']; + } + + /** + * Sets schemaId + * + * @param string|null $schemaId Unique identifier of the custom event schema + * + * @return self + */ + public function setSchemaId($schemaId) + { + if (is_null($schemaId)) { + array_push($this->openAPINullablesSetToNull, 'schemaId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('schemaId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['schemaId'] = $schemaId; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyalty.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyalty.php new file mode 100644 index 0000000..783a52f --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyalty.php @@ -0,0 +1,743 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'calculationType' => 'string', + 'order' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder', + 'orderItems' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems', + 'customer' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'calculationType' => null, + 'order' => null, + 'orderItems' => null, + 'customer' => null, + 'customEvent' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'calculationType' => true, + 'order' => true, + 'orderItems' => true, + 'customer' => true, + 'customEvent' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'calculationType' => 'calculation_type', + 'order' => 'order', + 'orderItems' => 'order_items', + 'customer' => 'customer', + 'customEvent' => 'custom_event', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'calculationType' => 'setCalculationType', + 'order' => 'setOrder', + 'orderItems' => 'setOrderItems', + 'customer' => 'setCustomer', + 'customEvent' => 'setCustomEvent', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'calculationType' => 'getCalculationType', + 'order' => 'getOrder', + 'orderItems' => 'getOrderItems', + 'customer' => 'getCustomer', + 'customEvent' => 'getCustomEvent', + 'points' => 'getPoints' + ]; + + /** + * 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 TYPE_PROPORTIONAL = 'PROPORTIONAL'; + public const TYPE_FIXED = 'FIXED'; + public const CALCULATION_TYPE_ORDER_AMOUNT = 'ORDER_AMOUNT'; + public const CALCULATION_TYPE_ORDER_TOTAL_AMOUNT = 'ORDER_TOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_METADATA = 'ORDER_METADATA'; + public const CALCULATION_TYPE_ORDER_ITEMS_QUANTITY = 'ORDER_ITEMS_QUANTITY'; + public const CALCULATION_TYPE_ORDER_ITEMS_AMOUNT = 'ORDER_ITEMS_AMOUNT'; + public const CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT = 'ORDER_ITEMS_SUBTOTAL_AMOUNT'; + public const CALCULATION_TYPE_CUSTOMER_METADATA = 'CUSTOMER_METADATA'; + public const CALCULATION_TYPE_CUSTOM_EVENT_METADATA = 'CUSTOM_EVENT_METADATA'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PROPORTIONAL, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCalculationTypeAllowableValues() + { + return [ + self::CALCULATION_TYPE_ORDER_AMOUNT, + self::CALCULATION_TYPE_ORDER_TOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_METADATA, + self::CALCULATION_TYPE_ORDER_ITEMS_QUANTITY, + self::CALCULATION_TYPE_ORDER_ITEMS_AMOUNT, + self::CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT, + self::CALCULATION_TYPE_CUSTOMER_METADATA, + self::CALCULATION_TYPE_CUSTOM_EVENT_METADATA, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('calculationType', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('orderItems', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('points', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($this->container['calculationType']) && !in_array($this->container['calculationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'calculationType', must be one of '%s'", + $this->container['calculationType'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets calculationType + * + * @return string|null + */ + public function getCalculationType() + { + return $this->container['calculationType']; + } + + /** + * Sets calculationType + * + * @param string|null $calculationType calculationType + * + * @return self + */ + public function setCalculationType($calculationType) + { + if (is_null($calculationType)) { + array_push($this->openAPINullablesSetToNull, 'calculationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('calculationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($calculationType) && !in_array($calculationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'calculationType', must be one of '%s'", + $calculationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['calculationType'] = $calculationType; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets orderItems + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems|null + */ + public function getOrderItems() + { + return $this->container['orderItems']; + } + + /** + * Sets orderItems + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems|null $orderItems orderItems + * + * @return self + */ + public function setOrderItems($orderItems) + { + if (is_null($orderItems)) { + array_push($this->openAPINullablesSetToNull, 'orderItems'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItems', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItems'] = $orderItems; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.php new file mode 100644 index 0000000..afb8c48 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.php new file mode 100644 index 0000000..80cf5e2 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Custom event metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.php new file mode 100644 index 0000000..90d5d83 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.php new file mode 100644 index 0000000..5b665a3 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Customer metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.php new file mode 100644 index 0000000..5a999c1 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount', + 'totalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount', + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'totalAmount' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'totalAmount' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'totalAmount' => 'total_amount', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'totalAmount' => 'setTotalAmount', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'totalAmount' => 'getTotalAmount', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('metadata', $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 amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount|null $totalAmount totalAmount + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.php new file mode 100644 index 0000000..734557d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.php new file mode 100644 index 0000000..23893c1 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity', + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount', + 'subtotalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'amount' => null, + 'subtotalAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'amount' => true, + 'subtotalAmount' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'amount' => 'amount', + 'subtotalAmount' => 'subtotal_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'amount' => 'setAmount', + 'subtotalAmount' => 'setSubtotalAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'amount' => 'getAmount', + 'subtotalAmount' => 'getSubtotalAmount' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('subtotalAmount', $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 quantity + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount|null $subtotalAmount subtotalAmount + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.php new file mode 100644 index 0000000..ee5e7d2 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.php new file mode 100644 index 0000000..41b1bdb --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.php new file mode 100644 index 0000000..32025f3 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.php new file mode 100644 index 0000000..b65794a --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the order metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Order metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.php new file mode 100644 index 0000000..be42576 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.php new file mode 100644 index 0000000..8487b6d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesDisableResponseBodySegment.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodySegment.php new file mode 100644 index 0000000..22886b5 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodySegment.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodySegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodySegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesDisableResponseBodySource.php b/src/Model/LoyaltiesEarningRulesDisableResponseBodySource.php new file mode 100644 index 0000000..ef7a789 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesDisableResponseBodySource.php @@ -0,0 +1,532 @@ + + */ +class LoyaltiesEarningRulesDisableResponseBodySource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesDisableResponseBodySource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string', + 'objectId' => 'string', + 'objectType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null, + 'objectId' => null, + 'objectType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true, + 'objectId' => true, + 'objectType' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner', + 'objectId' => 'object_id', + 'objectType' => 'object_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner', + 'objectId' => 'setObjectId', + 'objectType' => 'setObjectType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner', + 'objectId' => 'getObjectId', + 'objectType' => 'getObjectType' + ]; + + /** + * 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 OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectTypeAllowableValues() + { + return [ + self::OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('banner', $data ?? [], null); + $this->setIfExists('objectId', $data ?? [], null); + $this->setIfExists('objectType', $data ?? [], 'campaign'); + } + + /** + * 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->getObjectTypeAllowableValues(); + if (!is_null($this->container['objectType']) && !in_array($this->container['objectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'objectType', must be one of '%s'", + $this->container['objectType'], + 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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets objectId + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['objectId']; + } + + /** + * Sets objectId + * + * @param string|null $objectId A unique campaign identifier assigned by the Voucherify API. + * + * @return self + */ + public function setObjectId($objectId) + { + if (is_null($objectId)) { + array_push($this->openAPINullablesSetToNull, 'objectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['objectId'] = $objectId; + + return $this; + } + + /** + * Gets objectType + * + * @return string|null + */ + public function getObjectType() + { + return $this->container['objectType']; + } + + /** + * Sets objectType + * + * @param string|null $objectType Defines the object associated with the earning rule. Defaults to `campaign`. + * + * @return self + */ + public function setObjectType($objectType) + { + if (is_null($objectType)) { + array_push($this->openAPINullablesSetToNull, 'objectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectTypeAllowableValues(); + if (!is_null($objectType) && !in_array($objectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'objectType', must be one of '%s'", + $objectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['objectType'] = $objectType; + + 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/LoyaltiesEarningRulesEnableResponseBody.php b/src/Model/LoyaltiesEarningRulesEnableResponseBody.php new file mode 100644 index 0000000..015f755 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBody.php @@ -0,0 +1,1167 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyalty', + 'event' => 'string', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyCustomEvent', + 'segment' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodySegment', + 'loyaltyTier' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier', + 'source' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodySource', + 'object' => 'string', + 'automationId' => 'string', + 'startDate' => 'string', + 'expirationDate' => 'string', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'metadata' => 'object', + 'updatedAt' => '\DateTime', + 'active' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'loyalty' => null, + 'event' => null, + 'customEvent' => null, + 'segment' => null, + 'loyaltyTier' => null, + 'source' => null, + 'object' => null, + 'automationId' => null, + 'startDate' => null, + 'expirationDate' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'metadata' => null, + 'updatedAt' => 'date-time', + 'active' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'loyalty' => true, + 'event' => true, + 'customEvent' => true, + 'segment' => true, + 'loyaltyTier' => true, + 'source' => true, + 'object' => true, + 'automationId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'metadata' => true, + 'updatedAt' => true, + 'active' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'loyalty' => 'loyalty', + 'event' => 'event', + 'customEvent' => 'custom_event', + 'segment' => 'segment', + 'loyaltyTier' => 'loyalty_tier', + 'source' => 'source', + 'object' => 'object', + 'automationId' => 'automation_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'metadata' => 'metadata', + 'updatedAt' => 'updated_at', + 'active' => 'active' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'loyalty' => 'setLoyalty', + 'event' => 'setEvent', + 'customEvent' => 'setCustomEvent', + 'segment' => 'setSegment', + 'loyaltyTier' => 'setLoyaltyTier', + 'source' => 'setSource', + 'object' => 'setObject', + 'automationId' => 'setAutomationId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'metadata' => 'setMetadata', + 'updatedAt' => 'setUpdatedAt', + 'active' => 'setActive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'loyalty' => 'getLoyalty', + 'event' => 'getEvent', + 'customEvent' => 'getCustomEvent', + 'segment' => 'getSegment', + 'loyaltyTier' => 'getLoyaltyTier', + 'source' => 'getSource', + 'object' => 'getObject', + 'automationId' => 'getAutomationId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'metadata' => 'getMetadata', + 'updatedAt' => 'getUpdatedAt', + 'active' => 'getActive' + ]; + + /** + * 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 OBJECT_EARNING_RULE = 'earning_rule'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EARNING_RULE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'earning_rule'); + $this->setIfExists('automationId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('active', $data ?? [], true); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the earning rule object. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodySegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodySegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodySource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodySource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is earning_rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets automationId + * + * @return string|null + */ + public function getAutomationId() + { + return $this->container['automationId']; + } + + /** + * Sets automationId + * + * @param string|null $automationId For internal use by Voucherify. + * + * @return self + */ + public function setAutomationId($automationId) + { + if (is_null($automationId)) { + array_push($this->openAPINullablesSetToNull, 'automationId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('automationId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['automationId'] = $automationId; + + return $this; + } + + /** + * Gets startDate + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param string|null $startDate Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return string|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param string|null $expirationDate Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + 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/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.php new file mode 100644 index 0000000..678012d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'schemaId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'schemaId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schemaId' => true + ]; + + /** + * 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 = [ + 'schemaId' => 'schema_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'schemaId' => 'setSchemaId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'schemaId' => 'getSchemaId' + ]; + + /** + * 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('schemaId', $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 schemaId + * + * @return string|null + */ + public function getSchemaId() + { + return $this->container['schemaId']; + } + + /** + * Sets schemaId + * + * @param string|null $schemaId Unique identifier of the custom event schema + * + * @return self + */ + public function setSchemaId($schemaId) + { + if (is_null($schemaId)) { + array_push($this->openAPINullablesSetToNull, 'schemaId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('schemaId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['schemaId'] = $schemaId; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyalty.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyalty.php new file mode 100644 index 0000000..40955d9 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyalty.php @@ -0,0 +1,743 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'calculationType' => 'string', + 'order' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder', + 'orderItems' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems', + 'customer' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'calculationType' => null, + 'order' => null, + 'orderItems' => null, + 'customer' => null, + 'customEvent' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'calculationType' => true, + 'order' => true, + 'orderItems' => true, + 'customer' => true, + 'customEvent' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'calculationType' => 'calculation_type', + 'order' => 'order', + 'orderItems' => 'order_items', + 'customer' => 'customer', + 'customEvent' => 'custom_event', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'calculationType' => 'setCalculationType', + 'order' => 'setOrder', + 'orderItems' => 'setOrderItems', + 'customer' => 'setCustomer', + 'customEvent' => 'setCustomEvent', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'calculationType' => 'getCalculationType', + 'order' => 'getOrder', + 'orderItems' => 'getOrderItems', + 'customer' => 'getCustomer', + 'customEvent' => 'getCustomEvent', + 'points' => 'getPoints' + ]; + + /** + * 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 TYPE_PROPORTIONAL = 'PROPORTIONAL'; + public const TYPE_FIXED = 'FIXED'; + public const CALCULATION_TYPE_ORDER_AMOUNT = 'ORDER_AMOUNT'; + public const CALCULATION_TYPE_ORDER_TOTAL_AMOUNT = 'ORDER_TOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_METADATA = 'ORDER_METADATA'; + public const CALCULATION_TYPE_ORDER_ITEMS_QUANTITY = 'ORDER_ITEMS_QUANTITY'; + public const CALCULATION_TYPE_ORDER_ITEMS_AMOUNT = 'ORDER_ITEMS_AMOUNT'; + public const CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT = 'ORDER_ITEMS_SUBTOTAL_AMOUNT'; + public const CALCULATION_TYPE_CUSTOMER_METADATA = 'CUSTOMER_METADATA'; + public const CALCULATION_TYPE_CUSTOM_EVENT_METADATA = 'CUSTOM_EVENT_METADATA'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PROPORTIONAL, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCalculationTypeAllowableValues() + { + return [ + self::CALCULATION_TYPE_ORDER_AMOUNT, + self::CALCULATION_TYPE_ORDER_TOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_METADATA, + self::CALCULATION_TYPE_ORDER_ITEMS_QUANTITY, + self::CALCULATION_TYPE_ORDER_ITEMS_AMOUNT, + self::CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT, + self::CALCULATION_TYPE_CUSTOMER_METADATA, + self::CALCULATION_TYPE_CUSTOM_EVENT_METADATA, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('calculationType', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('orderItems', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('points', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($this->container['calculationType']) && !in_array($this->container['calculationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'calculationType', must be one of '%s'", + $this->container['calculationType'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets calculationType + * + * @return string|null + */ + public function getCalculationType() + { + return $this->container['calculationType']; + } + + /** + * Sets calculationType + * + * @param string|null $calculationType calculationType + * + * @return self + */ + public function setCalculationType($calculationType) + { + if (is_null($calculationType)) { + array_push($this->openAPINullablesSetToNull, 'calculationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('calculationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($calculationType) && !in_array($calculationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'calculationType', must be one of '%s'", + $calculationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['calculationType'] = $calculationType; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets orderItems + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems|null + */ + public function getOrderItems() + { + return $this->container['orderItems']; + } + + /** + * Sets orderItems + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems|null $orderItems orderItems + * + * @return self + */ + public function setOrderItems($orderItems) + { + if (is_null($orderItems)) { + array_push($this->openAPINullablesSetToNull, 'orderItems'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItems', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItems'] = $orderItems; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.php new file mode 100644 index 0000000..7716d37 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.php new file mode 100644 index 0000000..b3d0219 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Custom event metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.php new file mode 100644 index 0000000..b116704 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.php new file mode 100644 index 0000000..875ccae --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Customer metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.php new file mode 100644 index 0000000..5ca5841 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount', + 'totalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount', + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'totalAmount' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'totalAmount' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'totalAmount' => 'total_amount', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'totalAmount' => 'setTotalAmount', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'totalAmount' => 'getTotalAmount', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('metadata', $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 amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount|null $totalAmount totalAmount + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.php new file mode 100644 index 0000000..193146a --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.php new file mode 100644 index 0000000..1df7262 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity', + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount', + 'subtotalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'amount' => null, + 'subtotalAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'amount' => true, + 'subtotalAmount' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'amount' => 'amount', + 'subtotalAmount' => 'subtotal_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'amount' => 'setAmount', + 'subtotalAmount' => 'setSubtotalAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'amount' => 'getAmount', + 'subtotalAmount' => 'getSubtotalAmount' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('subtotalAmount', $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 quantity + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount|null $subtotalAmount subtotalAmount + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.php new file mode 100644 index 0000000..b84220f --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.php new file mode 100644 index 0000000..2adba85 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.php new file mode 100644 index 0000000..0ca3ea3 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.php new file mode 100644 index 0000000..9b26d83 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the order metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Order metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.php new file mode 100644 index 0000000..82b90ed --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.php new file mode 100644 index 0000000..ace4b59 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesEnableResponseBodySegment.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodySegment.php new file mode 100644 index 0000000..8e852fe --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodySegment.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodySegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodySegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesEnableResponseBodySource.php b/src/Model/LoyaltiesEarningRulesEnableResponseBodySource.php new file mode 100644 index 0000000..42d3fda --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesEnableResponseBodySource.php @@ -0,0 +1,532 @@ + + */ +class LoyaltiesEarningRulesEnableResponseBodySource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesEnableResponseBodySource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string', + 'objectId' => 'string', + 'objectType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null, + 'objectId' => null, + 'objectType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true, + 'objectId' => true, + 'objectType' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner', + 'objectId' => 'object_id', + 'objectType' => 'object_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner', + 'objectId' => 'setObjectId', + 'objectType' => 'setObjectType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner', + 'objectId' => 'getObjectId', + 'objectType' => 'getObjectType' + ]; + + /** + * 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 OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectTypeAllowableValues() + { + return [ + self::OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('banner', $data ?? [], null); + $this->setIfExists('objectId', $data ?? [], null); + $this->setIfExists('objectType', $data ?? [], 'campaign'); + } + + /** + * 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->getObjectTypeAllowableValues(); + if (!is_null($this->container['objectType']) && !in_array($this->container['objectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'objectType', must be one of '%s'", + $this->container['objectType'], + 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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets objectId + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['objectId']; + } + + /** + * Sets objectId + * + * @param string|null $objectId A unique campaign identifier assigned by the Voucherify API. + * + * @return self + */ + public function setObjectId($objectId) + { + if (is_null($objectId)) { + array_push($this->openAPINullablesSetToNull, 'objectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['objectId'] = $objectId; + + return $this; + } + + /** + * Gets objectType + * + * @return string|null + */ + public function getObjectType() + { + return $this->container['objectType']; + } + + /** + * Sets objectType + * + * @param string|null $objectType Defines the object associated with the earning rule. Defaults to `campaign`. + * + * @return self + */ + public function setObjectType($objectType) + { + if (is_null($objectType)) { + array_push($this->openAPINullablesSetToNull, 'objectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectTypeAllowableValues(); + if (!is_null($objectType) && !in_array($objectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'objectType', must be one of '%s'", + $objectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['objectType'] = $objectType; + + 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/LoyaltiesEarningRulesGetResponseBody.php b/src/Model/LoyaltiesEarningRulesGetResponseBody.php new file mode 100644 index 0000000..5bfc0e6 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBody.php @@ -0,0 +1,1208 @@ + + */ +class LoyaltiesEarningRulesGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyalty', + 'event' => 'string', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyCustomEvent', + 'segment' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodySegment', + 'loyaltyTier' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyTier', + 'source' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodySource', + 'object' => 'string', + 'automationId' => 'string', + 'startDate' => 'string', + 'expirationDate' => 'string', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'metadata' => 'object', + 'validationRuleId' => 'string', + 'updatedAt' => '\DateTime', + 'active' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'loyalty' => null, + 'event' => null, + 'customEvent' => null, + 'segment' => null, + 'loyaltyTier' => null, + 'source' => null, + 'object' => null, + 'automationId' => null, + 'startDate' => null, + 'expirationDate' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'metadata' => null, + 'validationRuleId' => null, + 'updatedAt' => 'date-time', + 'active' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'loyalty' => true, + 'event' => true, + 'customEvent' => true, + 'segment' => true, + 'loyaltyTier' => true, + 'source' => true, + 'object' => true, + 'automationId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'metadata' => true, + 'validationRuleId' => true, + 'updatedAt' => true, + 'active' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'loyalty' => 'loyalty', + 'event' => 'event', + 'customEvent' => 'custom_event', + 'segment' => 'segment', + 'loyaltyTier' => 'loyalty_tier', + 'source' => 'source', + 'object' => 'object', + 'automationId' => 'automation_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'metadata' => 'metadata', + 'validationRuleId' => 'validation_rule_id', + 'updatedAt' => 'updated_at', + 'active' => 'active' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'loyalty' => 'setLoyalty', + 'event' => 'setEvent', + 'customEvent' => 'setCustomEvent', + 'segment' => 'setSegment', + 'loyaltyTier' => 'setLoyaltyTier', + 'source' => 'setSource', + 'object' => 'setObject', + 'automationId' => 'setAutomationId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'metadata' => 'setMetadata', + 'validationRuleId' => 'setValidationRuleId', + 'updatedAt' => 'setUpdatedAt', + 'active' => 'setActive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'loyalty' => 'getLoyalty', + 'event' => 'getEvent', + 'customEvent' => 'getCustomEvent', + 'segment' => 'getSegment', + 'loyaltyTier' => 'getLoyaltyTier', + 'source' => 'getSource', + 'object' => 'getObject', + 'automationId' => 'getAutomationId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'metadata' => 'getMetadata', + 'validationRuleId' => 'getValidationRuleId', + 'updatedAt' => 'getUpdatedAt', + 'active' => 'getActive' + ]; + + /** + * 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 OBJECT_EARNING_RULE = 'earning_rule'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EARNING_RULE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'earning_rule'); + $this->setIfExists('automationId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('validationRuleId', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('active', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the earning rule object. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodySegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodySegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodySource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodySource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is earning_rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets automationId + * + * @return string|null + */ + public function getAutomationId() + { + return $this->container['automationId']; + } + + /** + * Sets automationId + * + * @param string|null $automationId For internal use by Voucherify. + * + * @return self + */ + public function setAutomationId($automationId) + { + if (is_null($automationId)) { + array_push($this->openAPINullablesSetToNull, 'automationId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('automationId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['automationId'] = $automationId; + + return $this; + } + + /** + * Gets startDate + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param string|null $startDate Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return string|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param string|null $expirationDate Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets validationRuleId + * + * @return string|null + */ + public function getValidationRuleId() + { + return $this->container['validationRuleId']; + } + + /** + * Sets validationRuleId + * + * @param string|null $validationRuleId A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + * + * @return self + */ + public function setValidationRuleId($validationRuleId) + { + if (is_null($validationRuleId)) { + array_push($this->openAPINullablesSetToNull, 'validationRuleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRuleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRuleId'] = $validationRuleId; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + 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/LoyaltiesEarningRulesGetResponseBodyCustomEvent.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyCustomEvent.php new file mode 100644 index 0000000..fbfdb5d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyCustomEvent.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'schemaId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'schemaId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schemaId' => true + ]; + + /** + * 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 = [ + 'schemaId' => 'schema_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'schemaId' => 'setSchemaId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'schemaId' => 'getSchemaId' + ]; + + /** + * 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('schemaId', $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 schemaId + * + * @return string|null + */ + public function getSchemaId() + { + return $this->container['schemaId']; + } + + /** + * Sets schemaId + * + * @param string|null $schemaId Unique identifier of the custom event schema + * + * @return self + */ + public function setSchemaId($schemaId) + { + if (is_null($schemaId)) { + array_push($this->openAPINullablesSetToNull, 'schemaId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('schemaId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['schemaId'] = $schemaId; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyalty.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyalty.php new file mode 100644 index 0000000..d75d076 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyalty.php @@ -0,0 +1,743 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'calculationType' => 'string', + 'order' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder', + 'orderItems' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems', + 'customer' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'calculationType' => null, + 'order' => null, + 'orderItems' => null, + 'customer' => null, + 'customEvent' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'calculationType' => true, + 'order' => true, + 'orderItems' => true, + 'customer' => true, + 'customEvent' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'calculationType' => 'calculation_type', + 'order' => 'order', + 'orderItems' => 'order_items', + 'customer' => 'customer', + 'customEvent' => 'custom_event', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'calculationType' => 'setCalculationType', + 'order' => 'setOrder', + 'orderItems' => 'setOrderItems', + 'customer' => 'setCustomer', + 'customEvent' => 'setCustomEvent', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'calculationType' => 'getCalculationType', + 'order' => 'getOrder', + 'orderItems' => 'getOrderItems', + 'customer' => 'getCustomer', + 'customEvent' => 'getCustomEvent', + 'points' => 'getPoints' + ]; + + /** + * 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 TYPE_PROPORTIONAL = 'PROPORTIONAL'; + public const TYPE_FIXED = 'FIXED'; + public const CALCULATION_TYPE_ORDER_AMOUNT = 'ORDER_AMOUNT'; + public const CALCULATION_TYPE_ORDER_TOTAL_AMOUNT = 'ORDER_TOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_METADATA = 'ORDER_METADATA'; + public const CALCULATION_TYPE_ORDER_ITEMS_QUANTITY = 'ORDER_ITEMS_QUANTITY'; + public const CALCULATION_TYPE_ORDER_ITEMS_AMOUNT = 'ORDER_ITEMS_AMOUNT'; + public const CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT = 'ORDER_ITEMS_SUBTOTAL_AMOUNT'; + public const CALCULATION_TYPE_CUSTOMER_METADATA = 'CUSTOMER_METADATA'; + public const CALCULATION_TYPE_CUSTOM_EVENT_METADATA = 'CUSTOM_EVENT_METADATA'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PROPORTIONAL, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCalculationTypeAllowableValues() + { + return [ + self::CALCULATION_TYPE_ORDER_AMOUNT, + self::CALCULATION_TYPE_ORDER_TOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_METADATA, + self::CALCULATION_TYPE_ORDER_ITEMS_QUANTITY, + self::CALCULATION_TYPE_ORDER_ITEMS_AMOUNT, + self::CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT, + self::CALCULATION_TYPE_CUSTOMER_METADATA, + self::CALCULATION_TYPE_CUSTOM_EVENT_METADATA, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('calculationType', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('orderItems', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('points', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($this->container['calculationType']) && !in_array($this->container['calculationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'calculationType', must be one of '%s'", + $this->container['calculationType'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets calculationType + * + * @return string|null + */ + public function getCalculationType() + { + return $this->container['calculationType']; + } + + /** + * Sets calculationType + * + * @param string|null $calculationType calculationType + * + * @return self + */ + public function setCalculationType($calculationType) + { + if (is_null($calculationType)) { + array_push($this->openAPINullablesSetToNull, 'calculationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('calculationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($calculationType) && !in_array($calculationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'calculationType', must be one of '%s'", + $calculationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['calculationType'] = $calculationType; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets orderItems + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems|null + */ + public function getOrderItems() + { + return $this->container['orderItems']; + } + + /** + * Sets orderItems + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems|null $orderItems orderItems + * + * @return self + */ + public function setOrderItems($orderItems) + { + if (is_null($orderItems)) { + array_push($this->openAPINullablesSetToNull, 'orderItems'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItems', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItems'] = $orderItems; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.php new file mode 100644 index 0000000..a3b3069 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.php new file mode 100644 index 0000000..ead2369 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Custom event metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.php new file mode 100644 index 0000000..028886c --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.php new file mode 100644 index 0000000..eddc6ba --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Customer metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.php new file mode 100644 index 0000000..e304ec0 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount', + 'totalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount', + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'totalAmount' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'totalAmount' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'totalAmount' => 'total_amount', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'totalAmount' => 'setTotalAmount', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'totalAmount' => 'getTotalAmount', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('metadata', $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 amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount|null $totalAmount totalAmount + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.php new file mode 100644 index 0000000..a017c8b --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.php new file mode 100644 index 0000000..06e4c88 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity', + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount', + 'subtotalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'amount' => null, + 'subtotalAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'amount' => true, + 'subtotalAmount' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'amount' => 'amount', + 'subtotalAmount' => 'subtotal_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'amount' => 'setAmount', + 'subtotalAmount' => 'setSubtotalAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'amount' => 'getAmount', + 'subtotalAmount' => 'getSubtotalAmount' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('subtotalAmount', $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 quantity + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount|null $subtotalAmount subtotalAmount + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.php new file mode 100644 index 0000000..4bcd381 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.php new file mode 100644 index 0000000..5a2022f --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.php new file mode 100644 index 0000000..db3e3b7 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.php new file mode 100644 index 0000000..87a4ce6 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the order metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Order metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.php new file mode 100644 index 0000000..4d4a376 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.php b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.php new file mode 100644 index 0000000..ce6e436 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodyLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodyLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesGetResponseBodySegment.php b/src/Model/LoyaltiesEarningRulesGetResponseBodySegment.php new file mode 100644 index 0000000..6d8e414 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodySegment.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodySegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodySegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesGetResponseBodySource.php b/src/Model/LoyaltiesEarningRulesGetResponseBodySource.php new file mode 100644 index 0000000..5b90117 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesGetResponseBodySource.php @@ -0,0 +1,532 @@ + + */ +class LoyaltiesEarningRulesGetResponseBodySource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesGetResponseBodySource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string', + 'objectId' => 'string', + 'objectType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null, + 'objectId' => null, + 'objectType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true, + 'objectId' => true, + 'objectType' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner', + 'objectId' => 'object_id', + 'objectType' => 'object_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner', + 'objectId' => 'setObjectId', + 'objectType' => 'setObjectType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner', + 'objectId' => 'getObjectId', + 'objectType' => 'getObjectType' + ]; + + /** + * 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 OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectTypeAllowableValues() + { + return [ + self::OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('banner', $data ?? [], null); + $this->setIfExists('objectId', $data ?? [], null); + $this->setIfExists('objectType', $data ?? [], 'campaign'); + } + + /** + * 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->getObjectTypeAllowableValues(); + if (!is_null($this->container['objectType']) && !in_array($this->container['objectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'objectType', must be one of '%s'", + $this->container['objectType'], + 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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets objectId + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['objectId']; + } + + /** + * Sets objectId + * + * @param string|null $objectId A unique campaign identifier assigned by the Voucherify API. + * + * @return self + */ + public function setObjectId($objectId) + { + if (is_null($objectId)) { + array_push($this->openAPINullablesSetToNull, 'objectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['objectId'] = $objectId; + + return $this; + } + + /** + * Gets objectType + * + * @return string|null + */ + public function getObjectType() + { + return $this->container['objectType']; + } + + /** + * Sets objectType + * + * @param string|null $objectType Defines the object associated with the earning rule. Defaults to `campaign`. + * + * @return self + */ + public function setObjectType($objectType) + { + if (is_null($objectType)) { + array_push($this->openAPINullablesSetToNull, 'objectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectTypeAllowableValues(); + if (!is_null($objectType) && !in_array($objectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'objectType', must be one of '%s'", + $objectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['objectType'] = $objectType; + + 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/LoyaltiesEarningRulesListResponseBody.php b/src/Model/LoyaltiesEarningRulesListResponseBody.php new file mode 100644 index 0000000..6c5b07c --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesListResponseBody.php @@ -0,0 +1,573 @@ + + */ +class LoyaltiesEarningRulesListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\EarningRule[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about earning rules in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of earning rule objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\EarningRule[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\EarningRule[]|null $data Contains array of earning rule objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of earning rule objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesEarningRulesUpdateRequestBody.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBody.php new file mode 100644 index 0000000..3408381 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBody.php @@ -0,0 +1,806 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'validationRuleId' => 'string', + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyalty', + 'source' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodySource', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'validationRuleId' => null, + 'loyalty' => null, + 'source' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'validationRuleId' => true, + 'loyalty' => true, + 'source' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'metadata' => true + ]; + + /** + * 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 = [ + 'validationRuleId' => 'validation_rule_id', + 'loyalty' => 'loyalty', + 'source' => 'source', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'validationRuleId' => 'setValidationRuleId', + 'loyalty' => 'setLoyalty', + 'source' => 'setSource', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'validationRuleId' => 'getValidationRuleId', + 'loyalty' => 'getLoyalty', + 'source' => 'getSource', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('validationRuleId', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('metadata', $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 validationRuleId + * + * @return string|null + */ + public function getValidationRuleId() + { + return $this->container['validationRuleId']; + } + + /** + * Sets validationRuleId + * + * @param string|null $validationRuleId A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + * + * @return self + */ + public function setValidationRuleId($validationRuleId) + { + if (is_null($validationRuleId)) { + array_push($this->openAPINullablesSetToNull, 'validationRuleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRuleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRuleId'] = $validationRuleId; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodySource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodySource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.php new file mode 100644 index 0000000..719ecc7 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.php @@ -0,0 +1,743 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'calculationType' => 'string', + 'order' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder', + 'orderItems' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems', + 'customer' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'calculationType' => null, + 'order' => null, + 'orderItems' => null, + 'customer' => null, + 'customEvent' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'calculationType' => true, + 'order' => true, + 'orderItems' => true, + 'customer' => true, + 'customEvent' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'calculationType' => 'calculation_type', + 'order' => 'order', + 'orderItems' => 'order_items', + 'customer' => 'customer', + 'customEvent' => 'custom_event', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'calculationType' => 'setCalculationType', + 'order' => 'setOrder', + 'orderItems' => 'setOrderItems', + 'customer' => 'setCustomer', + 'customEvent' => 'setCustomEvent', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'calculationType' => 'getCalculationType', + 'order' => 'getOrder', + 'orderItems' => 'getOrderItems', + 'customer' => 'getCustomer', + 'customEvent' => 'getCustomEvent', + 'points' => 'getPoints' + ]; + + /** + * 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 TYPE_PROPORTIONAL = 'PROPORTIONAL'; + public const TYPE_FIXED = 'FIXED'; + public const CALCULATION_TYPE_ORDER_AMOUNT = 'ORDER_AMOUNT'; + public const CALCULATION_TYPE_ORDER_TOTAL_AMOUNT = 'ORDER_TOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_METADATA = 'ORDER_METADATA'; + public const CALCULATION_TYPE_ORDER_ITEMS_QUANTITY = 'ORDER_ITEMS_QUANTITY'; + public const CALCULATION_TYPE_ORDER_ITEMS_AMOUNT = 'ORDER_ITEMS_AMOUNT'; + public const CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT = 'ORDER_ITEMS_SUBTOTAL_AMOUNT'; + public const CALCULATION_TYPE_CUSTOMER_METADATA = 'CUSTOMER_METADATA'; + public const CALCULATION_TYPE_CUSTOM_EVENT_METADATA = 'CUSTOM_EVENT_METADATA'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PROPORTIONAL, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCalculationTypeAllowableValues() + { + return [ + self::CALCULATION_TYPE_ORDER_AMOUNT, + self::CALCULATION_TYPE_ORDER_TOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_METADATA, + self::CALCULATION_TYPE_ORDER_ITEMS_QUANTITY, + self::CALCULATION_TYPE_ORDER_ITEMS_AMOUNT, + self::CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT, + self::CALCULATION_TYPE_CUSTOMER_METADATA, + self::CALCULATION_TYPE_CUSTOM_EVENT_METADATA, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('calculationType', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('orderItems', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('points', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($this->container['calculationType']) && !in_array($this->container['calculationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'calculationType', must be one of '%s'", + $this->container['calculationType'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets calculationType + * + * @return string|null + */ + public function getCalculationType() + { + return $this->container['calculationType']; + } + + /** + * Sets calculationType + * + * @param string|null $calculationType calculationType + * + * @return self + */ + public function setCalculationType($calculationType) + { + if (is_null($calculationType)) { + array_push($this->openAPINullablesSetToNull, 'calculationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('calculationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($calculationType) && !in_array($calculationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'calculationType', must be one of '%s'", + $calculationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['calculationType'] = $calculationType; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets orderItems + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems|null + */ + public function getOrderItems() + { + return $this->container['orderItems']; + } + + /** + * Sets orderItems + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems|null $orderItems orderItems + * + * @return self + */ + public function setOrderItems($orderItems) + { + if (is_null($orderItems)) { + array_push($this->openAPINullablesSetToNull, 'orderItems'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItems', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItems'] = $orderItems; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.php new file mode 100644 index 0000000..3ff49ff --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.php new file mode 100644 index 0000000..cd80c0f --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Custom event metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.php new file mode 100644 index 0000000..d891d6a --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.php new file mode 100644 index 0000000..69388e1 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Customer metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.php new file mode 100644 index 0000000..42e068e --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount', + 'totalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount', + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'totalAmount' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'totalAmount' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'totalAmount' => 'total_amount', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'totalAmount' => 'setTotalAmount', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'totalAmount' => 'getTotalAmount', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('metadata', $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 amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount|null $totalAmount totalAmount + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.php new file mode 100644 index 0000000..d040a58 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.php new file mode 100644 index 0000000..59e8b05 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity', + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount', + 'subtotalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'amount' => null, + 'subtotalAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'amount' => true, + 'subtotalAmount' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'amount' => 'amount', + 'subtotalAmount' => 'subtotal_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'amount' => 'setAmount', + 'subtotalAmount' => 'setSubtotalAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'amount' => 'getAmount', + 'subtotalAmount' => 'getSubtotalAmount' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('subtotalAmount', $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 quantity + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount|null $subtotalAmount subtotalAmount + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.php new file mode 100644 index 0000000..177122d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.php new file mode 100644 index 0000000..1f4b155 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.php new file mode 100644 index 0000000..1e6f61c --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.php new file mode 100644 index 0000000..69ff86a --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the order metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Order metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.php new file mode 100644 index 0000000..47e0e3e --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesUpdateRequestBodySource.php b/src/Model/LoyaltiesEarningRulesUpdateRequestBodySource.php new file mode 100644 index 0000000..492b5f3 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateRequestBodySource.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesUpdateRequestBodySource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateRequestBodySource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner' + ]; + + /** + * 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('banner', $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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + 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/LoyaltiesEarningRulesUpdateResponseBody.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBody.php new file mode 100644 index 0000000..c8fe1f0 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBody.php @@ -0,0 +1,1208 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyalty', + 'event' => 'string', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyCustomEvent', + 'segment' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodySegment', + 'loyaltyTier' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier', + 'source' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodySource', + 'object' => 'string', + 'automationId' => 'string', + 'startDate' => 'string', + 'expirationDate' => 'string', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'metadata' => 'object', + 'validationRuleId' => 'string', + 'updatedAt' => '\DateTime', + 'active' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'loyalty' => null, + 'event' => null, + 'customEvent' => null, + 'segment' => null, + 'loyaltyTier' => null, + 'source' => null, + 'object' => null, + 'automationId' => null, + 'startDate' => null, + 'expirationDate' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'metadata' => null, + 'validationRuleId' => null, + 'updatedAt' => 'date-time', + 'active' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'loyalty' => true, + 'event' => true, + 'customEvent' => true, + 'segment' => true, + 'loyaltyTier' => true, + 'source' => true, + 'object' => true, + 'automationId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'metadata' => true, + 'validationRuleId' => true, + 'updatedAt' => true, + 'active' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'loyalty' => 'loyalty', + 'event' => 'event', + 'customEvent' => 'custom_event', + 'segment' => 'segment', + 'loyaltyTier' => 'loyalty_tier', + 'source' => 'source', + 'object' => 'object', + 'automationId' => 'automation_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'metadata' => 'metadata', + 'validationRuleId' => 'validation_rule_id', + 'updatedAt' => 'updated_at', + 'active' => 'active' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'loyalty' => 'setLoyalty', + 'event' => 'setEvent', + 'customEvent' => 'setCustomEvent', + 'segment' => 'setSegment', + 'loyaltyTier' => 'setLoyaltyTier', + 'source' => 'setSource', + 'object' => 'setObject', + 'automationId' => 'setAutomationId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'metadata' => 'setMetadata', + 'validationRuleId' => 'setValidationRuleId', + 'updatedAt' => 'setUpdatedAt', + 'active' => 'setActive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'loyalty' => 'getLoyalty', + 'event' => 'getEvent', + 'customEvent' => 'getCustomEvent', + 'segment' => 'getSegment', + 'loyaltyTier' => 'getLoyaltyTier', + 'source' => 'getSource', + 'object' => 'getObject', + 'automationId' => 'getAutomationId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'metadata' => 'getMetadata', + 'validationRuleId' => 'getValidationRuleId', + 'updatedAt' => 'getUpdatedAt', + 'active' => 'getActive' + ]; + + /** + * 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 OBJECT_EARNING_RULE = 'earning_rule'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EARNING_RULE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('loyalty', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'earning_rule'); + $this->setIfExists('automationId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('validationRuleId', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('active', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the earning rule object. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodySegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodySegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodySource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodySource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is earning_rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets automationId + * + * @return string|null + */ + public function getAutomationId() + { + return $this->container['automationId']; + } + + /** + * Sets automationId + * + * @param string|null $automationId For internal use by Voucherify. + * + * @return self + */ + public function setAutomationId($automationId) + { + if (is_null($automationId)) { + array_push($this->openAPINullablesSetToNull, 'automationId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('automationId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['automationId'] = $automationId; + + return $this; + } + + /** + * Gets startDate + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param string|null $startDate Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return string|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param string|null $expirationDate Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets validationRuleId + * + * @return string|null + */ + public function getValidationRuleId() + { + return $this->container['validationRuleId']; + } + + /** + * Sets validationRuleId + * + * @param string|null $validationRuleId A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + * + * @return self + */ + public function setValidationRuleId($validationRuleId) + { + if (is_null($validationRuleId)) { + array_push($this->openAPINullablesSetToNull, 'validationRuleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRuleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRuleId'] = $validationRuleId; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + 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/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.php new file mode 100644 index 0000000..066347e --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'schemaId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'schemaId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'schemaId' => true + ]; + + /** + * 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 = [ + 'schemaId' => 'schema_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'schemaId' => 'setSchemaId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'schemaId' => 'getSchemaId' + ]; + + /** + * 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('schemaId', $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 schemaId + * + * @return string|null + */ + public function getSchemaId() + { + return $this->container['schemaId']; + } + + /** + * Sets schemaId + * + * @param string|null $schemaId Unique identifier of the custom event schema + * + * @return self + */ + public function setSchemaId($schemaId) + { + if (is_null($schemaId)) { + array_push($this->openAPINullablesSetToNull, 'schemaId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('schemaId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['schemaId'] = $schemaId; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.php new file mode 100644 index 0000000..a4e0825 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.php @@ -0,0 +1,743 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'calculationType' => 'string', + 'order' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder', + 'orderItems' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems', + 'customer' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'calculationType' => null, + 'order' => null, + 'orderItems' => null, + 'customer' => null, + 'customEvent' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'calculationType' => true, + 'order' => true, + 'orderItems' => true, + 'customer' => true, + 'customEvent' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'calculationType' => 'calculation_type', + 'order' => 'order', + 'orderItems' => 'order_items', + 'customer' => 'customer', + 'customEvent' => 'custom_event', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'calculationType' => 'setCalculationType', + 'order' => 'setOrder', + 'orderItems' => 'setOrderItems', + 'customer' => 'setCustomer', + 'customEvent' => 'setCustomEvent', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'calculationType' => 'getCalculationType', + 'order' => 'getOrder', + 'orderItems' => 'getOrderItems', + 'customer' => 'getCustomer', + 'customEvent' => 'getCustomEvent', + 'points' => 'getPoints' + ]; + + /** + * 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 TYPE_PROPORTIONAL = 'PROPORTIONAL'; + public const TYPE_FIXED = 'FIXED'; + public const CALCULATION_TYPE_ORDER_AMOUNT = 'ORDER_AMOUNT'; + public const CALCULATION_TYPE_ORDER_TOTAL_AMOUNT = 'ORDER_TOTAL_AMOUNT'; + public const CALCULATION_TYPE_ORDER_METADATA = 'ORDER_METADATA'; + public const CALCULATION_TYPE_ORDER_ITEMS_QUANTITY = 'ORDER_ITEMS_QUANTITY'; + public const CALCULATION_TYPE_ORDER_ITEMS_AMOUNT = 'ORDER_ITEMS_AMOUNT'; + public const CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT = 'ORDER_ITEMS_SUBTOTAL_AMOUNT'; + public const CALCULATION_TYPE_CUSTOMER_METADATA = 'CUSTOMER_METADATA'; + public const CALCULATION_TYPE_CUSTOM_EVENT_METADATA = 'CUSTOM_EVENT_METADATA'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_PROPORTIONAL, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCalculationTypeAllowableValues() + { + return [ + self::CALCULATION_TYPE_ORDER_AMOUNT, + self::CALCULATION_TYPE_ORDER_TOTAL_AMOUNT, + self::CALCULATION_TYPE_ORDER_METADATA, + self::CALCULATION_TYPE_ORDER_ITEMS_QUANTITY, + self::CALCULATION_TYPE_ORDER_ITEMS_AMOUNT, + self::CALCULATION_TYPE_ORDER_ITEMS_SUBTOTAL_AMOUNT, + self::CALCULATION_TYPE_CUSTOMER_METADATA, + self::CALCULATION_TYPE_CUSTOM_EVENT_METADATA, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('calculationType', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('orderItems', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('points', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($this->container['calculationType']) && !in_array($this->container['calculationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'calculationType', must be one of '%s'", + $this->container['calculationType'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets calculationType + * + * @return string|null + */ + public function getCalculationType() + { + return $this->container['calculationType']; + } + + /** + * Sets calculationType + * + * @param string|null $calculationType calculationType + * + * @return self + */ + public function setCalculationType($calculationType) + { + if (is_null($calculationType)) { + array_push($this->openAPINullablesSetToNull, 'calculationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('calculationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCalculationTypeAllowableValues(); + if (!is_null($calculationType) && !in_array($calculationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'calculationType', must be one of '%s'", + $calculationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['calculationType'] = $calculationType; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets orderItems + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems|null + */ + public function getOrderItems() + { + return $this->container['orderItems']; + } + + /** + * Sets orderItems + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems|null $orderItems orderItems + * + * @return self + */ + public function setOrderItems($orderItems) + { + if (is_null($orderItems)) { + array_push($this->openAPINullablesSetToNull, 'orderItems'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orderItems', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orderItems'] = $orderItems; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.php new file mode 100644 index 0000000..f50200a --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.php new file mode 100644 index 0000000..e0908cb --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Custom event metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.php new file mode 100644 index 0000000..addae82 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'metadata' => true + ]; + + /** + * 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 = [ + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'metadata' => 'getMetadata' + ]; + + /** + * 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('metadata', $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 metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.php new file mode 100644 index 0000000..bc3614c --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the customer metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Customer metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.php new file mode 100644 index 0000000..f5bf201 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount', + 'totalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount', + 'metadata' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'totalAmount' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'totalAmount' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'totalAmount' => 'total_amount', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'totalAmount' => 'setTotalAmount', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'totalAmount' => 'getTotalAmount', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('metadata', $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 amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount|null $totalAmount totalAmount + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.php new file mode 100644 index 0000000..b39e473 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.php new file mode 100644 index 0000000..e5df7d4 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity', + 'amount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount', + 'subtotalAmount' => '\OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'amount' => null, + 'subtotalAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'amount' => true, + 'subtotalAmount' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'amount' => 'amount', + 'subtotalAmount' => 'subtotal_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'amount' => 'setAmount', + 'subtotalAmount' => 'setSubtotalAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'amount' => 'getAmount', + 'subtotalAmount' => 'getSubtotalAmount' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('subtotalAmount', $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 quantity + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets amount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param \OpenAPI\Client\Model\LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount|null $subtotalAmount subtotalAmount + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.php new file mode 100644 index 0000000..d3e64e1 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.php new file mode 100644 index 0000000..229fc51 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.php new file mode 100644 index 0000000..9c8ffbf --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.php @@ -0,0 +1,577 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'object' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'object' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'object' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'object' => 'object', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'object' => 'setObject', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'object' => 'getObject', + 'id' => 'getId' + ]; + + /** + * 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 OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + public const OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('id', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of object taken under consideration. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.php new file mode 100644 index 0000000..687ac9d --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int', + 'property' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null, + 'property' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true, + 'property' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points', + 'property' => 'property' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints', + 'property' => 'setProperty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints', + 'property' => 'getProperty' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('property', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every For how many increments of the order metadata property to grant points for. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets property + * + * @return string|null + */ + public function getProperty() + { + return $this->container['property']; + } + + /** + * Sets property + * + * @param string|null $property Order metadata property. + * + * @return self + */ + public function setProperty($property) + { + if (is_null($property)) { + array_push($this->openAPINullablesSetToNull, 'property'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('property', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['property'] = $property; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.php new file mode 100644 index 0000000..21ee6fe --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'every' => 'int', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'every' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'every' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'every' => 'every', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'every' => 'setEvery', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'every' => 'getEvery', + 'points' => 'getPoints' + ]; + + /** + * 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('every', $data ?? [], null); + $this->setIfExists('points', $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 every + * + * @return int|null + */ + public function getEvery() + { + return $this->container['every']; + } + + /** + * Sets every + * + * @param int|null $every Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. + * + * @return self + */ + public function setEvery($every) + { + if (is_null($every)) { + array_push($this->openAPINullablesSetToNull, 'every'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('every', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['every'] = $every; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points to be awarded, i.e. how many points to be added to the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.php new file mode 100644 index 0000000..4eec608 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesUpdateResponseBodySegment.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodySegment.php new file mode 100644 index 0000000..226b248 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodySegment.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodySegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodySegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Contains a unique identifier of a customer segment. Assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesEarningRulesUpdateResponseBodySource.php b/src/Model/LoyaltiesEarningRulesUpdateResponseBodySource.php new file mode 100644 index 0000000..8156e00 --- /dev/null +++ b/src/Model/LoyaltiesEarningRulesUpdateResponseBodySource.php @@ -0,0 +1,532 @@ + + */ +class LoyaltiesEarningRulesUpdateResponseBodySource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesEarningRulesUpdateResponseBodySource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string', + 'objectId' => 'string', + 'objectType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null, + 'objectId' => null, + 'objectType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true, + 'objectId' => true, + 'objectType' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner', + 'objectId' => 'object_id', + 'objectType' => 'object_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner', + 'objectId' => 'setObjectId', + 'objectType' => 'setObjectType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner', + 'objectId' => 'getObjectId', + 'objectType' => 'getObjectType' + ]; + + /** + * 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 OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectTypeAllowableValues() + { + return [ + self::OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('banner', $data ?? [], null); + $this->setIfExists('objectId', $data ?? [], null); + $this->setIfExists('objectType', $data ?? [], 'campaign'); + } + + /** + * 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->getObjectTypeAllowableValues(); + if (!is_null($this->container['objectType']) && !in_array($this->container['objectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'objectType', must be one of '%s'", + $this->container['objectType'], + 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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets objectId + * + * @return string|null + */ + public function getObjectId() + { + return $this->container['objectId']; + } + + /** + * Sets objectId + * + * @param string|null $objectId A unique campaign identifier assigned by the Voucherify API. + * + * @return self + */ + public function setObjectId($objectId) + { + if (is_null($objectId)) { + array_push($this->openAPINullablesSetToNull, 'objectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['objectId'] = $objectId; + + return $this; + } + + /** + * Gets objectType + * + * @return string|null + */ + public function getObjectType() + { + return $this->container['objectType']; + } + + /** + * Sets objectType + * + * @param string|null $objectType Defines the object associated with the earning rule. Defaults to `campaign`. + * + * @return self + */ + public function setObjectType($objectType) + { + if (is_null($objectType)) { + array_push($this->openAPINullablesSetToNull, 'objectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('objectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectTypeAllowableValues(); + if (!is_null($objectType) && !in_array($objectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'objectType', must be one of '%s'", + $objectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['objectType'] = $objectType; + + 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/LoyaltiesGetCampaignResponseBody.php b/src/Model/LoyaltiesGetCampaignResponseBody.php new file mode 100644 index 0000000..0ef3106 --- /dev/null +++ b/src/Model/LoyaltiesGetCampaignResponseBody.php @@ -0,0 +1,1745 @@ + + */ +class LoyaltiesGetCampaignResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesGetCampaignResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'campaignType' => 'string', + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\LoyaltyCampaignVoucher', + 'autoJoin' => 'bool', + 'joinOnce' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'active' => 'bool', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'category' => 'string', + 'creationStatus' => 'string', + 'vouchersGenerationStatus' => 'string', + 'protected' => 'bool', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'object' => 'string', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'accessSettingsAssignments' => '\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'description' => null, + 'campaignType' => null, + 'type' => null, + 'voucher' => null, + 'autoJoin' => null, + 'joinOnce' => null, + 'useVoucherMetadataSchema' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'active' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'category' => null, + 'creationStatus' => null, + 'vouchersGenerationStatus' => null, + 'protected' => null, + 'categoryId' => null, + 'categories' => null, + 'object' => null, + 'loyaltyTiersExpiration' => null, + 'validationRulesAssignments' => null, + 'accessSettingsAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'description' => true, + 'campaignType' => true, + 'type' => true, + 'voucher' => false, + 'autoJoin' => true, + 'joinOnce' => true, + 'useVoucherMetadataSchema' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'active' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'category' => true, + 'creationStatus' => true, + 'vouchersGenerationStatus' => true, + 'protected' => true, + 'categoryId' => true, + 'categories' => true, + 'object' => true, + 'loyaltyTiersExpiration' => false, + 'validationRulesAssignments' => false, + 'accessSettingsAssignments' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'campaignType' => 'campaign_type', + 'type' => 'type', + 'voucher' => 'voucher', + 'autoJoin' => 'auto_join', + 'joinOnce' => 'join_once', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'active' => 'active', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'category' => 'category', + 'creationStatus' => 'creation_status', + 'vouchersGenerationStatus' => 'vouchers_generation_status', + 'protected' => 'protected', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'object' => 'object', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'accessSettingsAssignments' => 'access_settings_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'campaignType' => 'setCampaignType', + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'autoJoin' => 'setAutoJoin', + 'joinOnce' => 'setJoinOnce', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'category' => 'setCategory', + 'creationStatus' => 'setCreationStatus', + 'vouchersGenerationStatus' => 'setVouchersGenerationStatus', + 'protected' => 'setProtected', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'object' => 'setObject', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'accessSettingsAssignments' => 'setAccessSettingsAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'campaignType' => 'getCampaignType', + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'autoJoin' => 'getAutoJoin', + 'joinOnce' => 'getJoinOnce', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'category' => 'getCategory', + 'creationStatus' => 'getCreationStatus', + 'vouchersGenerationStatus' => 'getVouchersGenerationStatus', + 'protected' => 'getProtected', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'object' => 'getObject', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'accessSettingsAssignments' => 'getAccessSettingsAssignments' + ]; + + /** + * 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 CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CREATION_STATUS_DONE = 'DONE'; + public const CREATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const CREATION_STATUS_FAILED = 'FAILED'; + public const CREATION_STATUS_DRAFT = 'DRAFT'; + public const CREATION_STATUS_MODIFYING = 'MODIFYING'; + public const VOUCHERS_GENERATION_STATUS_DONE = 'DONE'; + public const VOUCHERS_GENERATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const VOUCHERS_GENERATION_STATUS_FAILED = 'FAILED'; + public const VOUCHERS_GENERATION_STATUS_DRAFT = 'DRAFT'; + public const VOUCHERS_GENERATION_STATUS_MODIFYING = 'MODIFYING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCreationStatusAllowableValues() + { + return [ + self::CREATION_STATUS_DONE, + self::CREATION_STATUS_IN_PROGRESS, + self::CREATION_STATUS_FAILED, + self::CREATION_STATUS_DRAFT, + self::CREATION_STATUS_MODIFYING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVouchersGenerationStatusAllowableValues() + { + return [ + self::VOUCHERS_GENERATION_STATUS_DONE, + self::VOUCHERS_GENERATION_STATUS_IN_PROGRESS, + self::VOUCHERS_GENERATION_STATUS_FAILED, + self::VOUCHERS_GENERATION_STATUS_DRAFT, + self::VOUCHERS_GENERATION_STATUS_MODIFYING, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], 'LOYALTY_PROGRAM'); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('creationStatus', $data ?? [], null); + $this->setIfExists('vouchersGenerationStatus', $data ?? [], null); + $this->setIfExists('protected', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('accessSettingsAssignments', $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->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($this->container['creationStatus']) && !in_array($this->container['creationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'creationStatus', must be one of '%s'", + $this->container['creationStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($this->container['vouchersGenerationStatus']) && !in_array($this->container['vouchersGenerationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $this->container['vouchersGenerationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\LoyaltyCampaignVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\LoyaltyCampaignVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign. + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Unique category name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets creationStatus + * + * @return string|null + */ + public function getCreationStatus() + { + return $this->container['creationStatus']; + } + + /** + * Sets creationStatus + * + * @param string|null $creationStatus Indicates the status of the campaign creation. + * + * @return self + */ + public function setCreationStatus($creationStatus) + { + if (is_null($creationStatus)) { + array_push($this->openAPINullablesSetToNull, 'creationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($creationStatus) && !in_array($creationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'creationStatus', must be one of '%s'", + $creationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['creationStatus'] = $creationStatus; + + return $this; + } + + /** + * Gets vouchersGenerationStatus + * + * @return string|null + */ + public function getVouchersGenerationStatus() + { + return $this->container['vouchersGenerationStatus']; + } + + /** + * Sets vouchersGenerationStatus + * + * @param string|null $vouchersGenerationStatus Indicates the status of the campaign's voucher generation. + * + * @return self + */ + public function setVouchersGenerationStatus($vouchersGenerationStatus) + { + if (is_null($vouchersGenerationStatus)) { + array_push($this->openAPINullablesSetToNull, 'vouchersGenerationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersGenerationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($vouchersGenerationStatus) && !in_array($vouchersGenerationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $vouchersGenerationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['vouchersGenerationStatus'] = $vouchersGenerationStatus; + + return $this; + } + + /** + * Gets protected + * + * @return bool|null + */ + public function getProtected() + { + return $this->container['protected']; + } + + /** + * Sets protected + * + * @param bool|null $protected Indicates whether the resource can be deleted. + * + * @return self + */ + public function setProtected($protected) + { + if (is_null($protected)) { + array_push($this->openAPINullablesSetToNull, 'protected'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('protected', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['protected'] = $protected; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets accessSettingsAssignments + * + * @return \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null + */ + public function getAccessSettingsAssignments() + { + return $this->container['accessSettingsAssignments']; + } + + /** + * Sets accessSettingsAssignments + * + * @param \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null $accessSettingsAssignments accessSettingsAssignments + * + * @return self + */ + public function setAccessSettingsAssignments($accessSettingsAssignments) + { + if (is_null($accessSettingsAssignments)) { + throw new \InvalidArgumentException('non-nullable accessSettingsAssignments cannot be null'); + } + $this->container['accessSettingsAssignments'] = $accessSettingsAssignments; + + 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/LoyaltiesListCampaignsResponseBody.php b/src/Model/LoyaltiesListCampaignsResponseBody.php new file mode 100644 index 0000000..39aa5d3 --- /dev/null +++ b/src/Model/LoyaltiesListCampaignsResponseBody.php @@ -0,0 +1,573 @@ + + */ +class LoyaltiesListCampaignsResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesListCampaignsResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'campaigns' => '\OpenAPI\Client\Model\LoyaltyCampaign[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'campaigns' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'campaigns' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'campaigns' => 'campaigns', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'campaigns' => 'setCampaigns', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'campaigns' => 'getCampaigns', + 'total' => 'getTotal' + ]; + + /** + * 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 DATA_REF_CAMPAIGNS = 'campaigns'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_CAMPAIGNS, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'campaigns'); + $this->setIfExists('campaigns', $data ?? [], null); + $this->setIfExists('total', $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->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about loyalty campaigns in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of loyalty campaign objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets campaigns + * + * @return \OpenAPI\Client\Model\LoyaltyCampaign[]|null + */ + public function getCampaigns() + { + return $this->container['campaigns']; + } + + /** + * Sets campaigns + * + * @param \OpenAPI\Client\Model\LoyaltyCampaign[]|null $campaigns Contains an array of loyalty campaign objects. + * + * @return self + */ + public function setCampaigns($campaigns) + { + if (is_null($campaigns)) { + array_push($this->openAPINullablesSetToNull, 'campaigns'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaigns', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaigns'] = $campaigns; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of loyalty campaign objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesListMembersResponseBody.php b/src/Model/LoyaltiesListMembersResponseBody.php new file mode 100644 index 0000000..d86fd60 --- /dev/null +++ b/src/Model/LoyaltiesListMembersResponseBody.php @@ -0,0 +1,573 @@ + + */ +class LoyaltiesListMembersResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesListMembersResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'vouchers' => '\OpenAPI\Client\Model\LoyaltyMember[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'vouchers' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'vouchers' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'vouchers' => 'vouchers', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'vouchers' => 'setVouchers', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'vouchers' => 'getVouchers', + 'total' => 'getTotal' + ]; + + /** + * 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 DATA_REF_VOUCHERS = 'vouchers'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_VOUCHERS, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'vouchers'); + $this->setIfExists('vouchers', $data ?? [], null); + $this->setIfExists('total', $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->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about members in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of voucher objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets vouchers + * + * @return \OpenAPI\Client\Model\LoyaltyMember[]|null + */ + public function getVouchers() + { + return $this->container['vouchers']; + } + + /** + * Sets vouchers + * + * @param \OpenAPI\Client\Model\LoyaltyMember[]|null $vouchers Contains array of voucher objects representing loyalty cards, in other words, loyalty program members. + * + * @return self + */ + public function setVouchers($vouchers) + { + if (is_null($vouchers)) { + array_push($this->openAPINullablesSetToNull, 'vouchers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchers'] = $vouchers; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of voucher objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesLoyaltyTierReward.php b/src/Model/LoyaltiesLoyaltyTierReward.php new file mode 100644 index 0000000..0bff269 --- /dev/null +++ b/src/Model/LoyaltiesLoyaltyTierReward.php @@ -0,0 +1,520 @@ + + */ +class LoyaltiesLoyaltyTierReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesLoyaltyTierReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reward' => '\OpenAPI\Client\Model\Reward', + 'assignment' => '\OpenAPI\Client\Model\RewardAssignment', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reward' => null, + 'assignment' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reward' => false, + 'assignment' => false, + 'object' => 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 = [ + 'reward' => 'reward', + 'assignment' => 'assignment', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reward' => 'setReward', + 'assignment' => 'setAssignment', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reward' => 'getReward', + 'assignment' => 'getAssignment', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_LOYALTY_TIER_REWARD = 'loyalty_tier_reward'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_LOYALTY_TIER_REWARD, + ]; + } + + /** + * 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('reward', $data ?? [], null); + $this->setIfExists('assignment', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'loyalty_tier_reward'); + } + + /** + * 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 = []; + + if ($this->container['reward'] === null) { + $invalidProperties[] = "'reward' can't be null"; + } + if ($this->container['assignment'] === null) { + $invalidProperties[] = "'assignment' can't be null"; + } + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 reward + * + * @return \OpenAPI\Client\Model\Reward + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\Reward $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets assignment + * + * @return \OpenAPI\Client\Model\RewardAssignment + */ + public function getAssignment() + { + return $this->container['assignment']; + } + + /** + * Sets assignment + * + * @param \OpenAPI\Client\Model\RewardAssignment $assignment assignment + * + * @return self + */ + public function setAssignment($assignment) + { + if (is_null($assignment)) { + throw new \InvalidArgumentException('non-nullable assignment cannot be null'); + } + $this->container['assignment'] = $assignment; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object The type of the object represented by JSON. This object stores information about the loyalty tier reward. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/LoyaltiesMemberActivityListResponseBody.php b/src/Model/LoyaltiesMemberActivityListResponseBody.php new file mode 100644 index 0000000..85305e7 --- /dev/null +++ b/src/Model/LoyaltiesMemberActivityListResponseBody.php @@ -0,0 +1,614 @@ + + */ +class LoyaltiesMemberActivityListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMemberActivityListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\MemberActivity[]', + 'hasMore' => 'bool', + 'moreStartingAfter' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'hasMore' => null, + 'moreStartingAfter' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'hasMore' => true, + 'moreStartingAfter' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'hasMore' => 'has_more', + 'moreStartingAfter' => 'more_starting_after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'hasMore' => 'setHasMore', + 'moreStartingAfter' => 'setMoreStartingAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'hasMore' => 'getHasMore', + 'moreStartingAfter' => 'getMoreStartingAfter' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('hasMore', $data ?? [], null); + $this->setIfExists('moreStartingAfter', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about member activities in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of member activity objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\MemberActivity[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\MemberActivity[]|null $data Array of member activity objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + return $this; + } + + /** + * Gets moreStartingAfter + * + * @return string|null + */ + public function getMoreStartingAfter() + { + return $this->container['moreStartingAfter']; + } + + /** + * Sets moreStartingAfter + * + * @param string|null $moreStartingAfter Returns an ID that can be used to return another page of results. Use the event id in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. + * + * @return self + */ + public function setMoreStartingAfter($moreStartingAfter) + { + if (is_null($moreStartingAfter)) { + array_push($this->openAPINullablesSetToNull, 'moreStartingAfter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreStartingAfter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreStartingAfter'] = $moreStartingAfter; + + 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/LoyaltiesMembersBalanceUpdateRequestBody.php b/src/Model/LoyaltiesMembersBalanceUpdateRequestBody.php new file mode 100644 index 0000000..aaafcd1 --- /dev/null +++ b/src/Model/LoyaltiesMembersBalanceUpdateRequestBody.php @@ -0,0 +1,618 @@ + + */ +class LoyaltiesMembersBalanceUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersBalanceUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'expirationType' => 'string', + 'expirationDate' => '\DateTime', + 'reason' => 'string', + 'sourceId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'expirationType' => null, + 'expirationDate' => 'date-time', + 'reason' => null, + 'sourceId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'expirationType' => true, + 'expirationDate' => true, + 'reason' => true, + 'sourceId' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'expirationType' => 'expiration_type', + 'expirationDate' => 'expiration_date', + 'reason' => 'reason', + 'sourceId' => 'source_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'expirationType' => 'setExpirationType', + 'expirationDate' => 'setExpirationDate', + 'reason' => 'setReason', + 'sourceId' => 'setSourceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'expirationType' => 'getExpirationType', + 'expirationDate' => 'getExpirationDate', + 'reason' => 'getReason', + 'sourceId' => 'getSourceId' + ]; + + /** + * 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 EXPIRATION_TYPE_PROGRAM_RULES = 'PROGRAM_RULES'; + public const EXPIRATION_TYPE_CUSTOM_DATE = 'CUSTOM_DATE'; + public const EXPIRATION_TYPE_NON_EXPIRING = 'NON_EXPIRING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExpirationTypeAllowableValues() + { + return [ + self::EXPIRATION_TYPE_PROGRAM_RULES, + self::EXPIRATION_TYPE_CUSTOM_DATE, + self::EXPIRATION_TYPE_NON_EXPIRING, + ]; + } + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('expirationType', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('sourceId', $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->getExpirationTypeAllowableValues(); + if (!is_null($this->container['expirationType']) && !in_array($this->container['expirationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'expirationType', must be one of '%s'", + $this->container['expirationType'], + 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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Incremental balance to be added to/subtracted from the loyalty card. - To add points: 100 - To subtract points, add a minus: -100 + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets expirationType + * + * @return string|null + */ + public function getExpirationType() + { + return $this->container['expirationType']; + } + + /** + * Sets expirationType + * + * @param string|null $expirationType expirationType + * + * @return self + */ + public function setExpirationType($expirationType) + { + if (is_null($expirationType)) { + array_push($this->openAPINullablesSetToNull, 'expirationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExpirationTypeAllowableValues(); + if (!is_null($expirationType) && !in_array($expirationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'expirationType', must be one of '%s'", + $expirationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['expirationType'] = $expirationType; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason Reason for the transfer. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + 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/LoyaltiesMembersBalanceUpdateResponseBody.php b/src/Model/LoyaltiesMembersBalanceUpdateResponseBody.php new file mode 100644 index 0000000..a3e8e09 --- /dev/null +++ b/src/Model/LoyaltiesMembersBalanceUpdateResponseBody.php @@ -0,0 +1,782 @@ + + */ +class LoyaltiesMembersBalanceUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersBalanceUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'total' => 'int', + 'balance' => 'int', + 'type' => 'string', + 'object' => 'string', + 'relatedObject' => '\OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject', + 'operationType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'total' => null, + 'balance' => null, + 'type' => null, + 'object' => null, + 'relatedObject' => null, + 'operationType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'total' => true, + 'balance' => true, + 'type' => true, + 'object' => true, + 'relatedObject' => true, + 'operationType' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'total' => 'total', + 'balance' => 'balance', + 'type' => 'type', + 'object' => 'object', + 'relatedObject' => 'related_object', + 'operationType' => 'operation_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'total' => 'setTotal', + 'balance' => 'setBalance', + 'type' => 'setType', + 'object' => 'setObject', + 'relatedObject' => 'setRelatedObject', + 'operationType' => 'setOperationType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'total' => 'getTotal', + 'balance' => 'getBalance', + 'type' => 'getType', + 'object' => 'getObject', + 'relatedObject' => 'getRelatedObject', + 'operationType' => 'getOperationType' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'loyalty_card'; + public const TYPE_GIFT_VOUCHER = 'gift_voucher'; + public const OBJECT_BALANCE = 'balance'; + public const OPERATION_TYPE_MANUAL = 'MANUAL'; + public const OPERATION_TYPE_AUTOMATIC = 'AUTOMATIC'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + self::TYPE_GIFT_VOUCHER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_BALANCE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperationTypeAllowableValues() + { + return [ + self::OPERATION_TYPE_MANUAL, + self::OPERATION_TYPE_AUTOMATIC, + ]; + } + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'balance'); + $this->setIfExists('relatedObject', $data ?? [], null); + $this->setIfExists('operationType', $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 = []; + + if (!is_null($this->container['balance']) && ($this->container['balance'] < 0)) { + $invalidProperties[] = "invalid value for 'balance', must be bigger than or equal to 0."; + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['object']) && !preg_match("/balance/", $this->container['object'])) { + $invalidProperties[] = "invalid value for 'object', must be conform to the pattern /balance/."; + } + + $allowedValues = $this->getOperationTypeAllowableValues(); + if (!is_null($this->container['operationType']) && !in_array($this->container['operationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operationType', must be one of '%s'", + $this->container['operationType'], + 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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The incremental points removed or added to the current balance on the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total The total of points accrued over the lifetime of the loyalty card. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance The balance after adding/removing points. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($balance) && ($balance < 0)) { + throw new \InvalidArgumentException('invalid value for $balance when calling LoyaltiesMembersBalanceUpdateResponseBody., must be bigger than or equal to 0.'); + } + + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of voucher being modified. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is balance. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($object) && (!preg_match("/balance/", $object))) { + throw new \InvalidArgumentException("invalid value for \$object when calling LoyaltiesMembersBalanceUpdateResponseBody., must conform to the pattern /balance/."); + } + + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObject + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject|null + */ + public function getRelatedObject() + { + return $this->container['relatedObject']; + } + + /** + * Sets relatedObject + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject|null $relatedObject relatedObject + * + * @return self + */ + public function setRelatedObject($relatedObject) + { + if (is_null($relatedObject)) { + array_push($this->openAPINullablesSetToNull, 'relatedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObject'] = $relatedObject; + + return $this; + } + + /** + * Gets operationType + * + * @return string|null + */ + public function getOperationType() + { + return $this->container['operationType']; + } + + /** + * Sets operationType + * + * @param string|null $operationType operationType + * + * @return self + */ + public function setOperationType($operationType) + { + if (is_null($operationType)) { + array_push($this->openAPINullablesSetToNull, 'operationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('operationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOperationTypeAllowableValues(); + if (!is_null($operationType) && !in_array($operationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operationType', must be one of '%s'", + $operationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operationType'] = $operationType; + + 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/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.php b/src/Model/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.php new file mode 100644 index 0000000..e0e653d --- /dev/null +++ b/src/Model/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.php @@ -0,0 +1,491 @@ + + */ +class LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'id' => 'getId' + ]; + + /** + * 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 TYPE_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_VOUCHER, + ]; + } + + /** + * 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('type', $data ?? [], 'voucher'); + $this->setIfExists('id', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The object being modified. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltiesMembersCreateRequestBody.php b/src/Model/LoyaltiesMembersCreateRequestBody.php new file mode 100644 index 0000000..c6178ea --- /dev/null +++ b/src/Model/LoyaltiesMembersCreateRequestBody.php @@ -0,0 +1,575 @@ + + */ +class LoyaltiesMembersCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'voucher' => 'string', + 'sourceId' => 'string', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'metadata' => 'object', + 'channel' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'voucher' => null, + 'sourceId' => null, + 'customer' => null, + 'metadata' => null, + 'channel' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'voucher' => true, + 'sourceId' => true, + 'customer' => false, + 'metadata' => true, + 'channel' => true + ]; + + /** + * 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 = [ + 'voucher' => 'voucher', + 'sourceId' => 'source_id', + 'customer' => 'customer', + 'metadata' => 'metadata', + 'channel' => 'channel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'voucher' => 'setVoucher', + 'sourceId' => 'setSourceId', + 'customer' => 'setCustomer', + 'metadata' => 'setMetadata', + 'channel' => 'setChannel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'voucher' => 'getVoucher', + 'sourceId' => 'getSourceId', + 'customer' => 'getCustomer', + 'metadata' => 'getMetadata', + 'channel' => 'getChannel' + ]; + + /** + * 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('voucher', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('channel', $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 voucher + * + * @return string|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param string|null $voucher Code of voucher being published. + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + array_push($this->openAPINullablesSetToNull, 'voucher'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucher', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel Specify the distribution channel. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + 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/LoyaltiesMembersCreateResponseBody.php b/src/Model/LoyaltiesMembersCreateResponseBody.php new file mode 100644 index 0000000..85e5d39 --- /dev/null +++ b/src/Model/LoyaltiesMembersCreateResponseBody.php @@ -0,0 +1,1488 @@ + + */ +class LoyaltiesMembersCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => 'object', + 'gift' => 'object', + 'loyaltyCard' => '\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyRedemption' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => true, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'LOYALTY_CARD'); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return object|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param object|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + array_push($this->openAPINullablesSetToNull, 'discount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return object|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param object|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode This is always false for loyalty members. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique identifier of the customer who owns the voucher. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersCreateResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + 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/LoyaltiesMembersCreateResponseBodyLoyaltyCard.php b/src/Model/LoyaltiesMembersCreateResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..cacd910 --- /dev/null +++ b/src/Model/LoyaltiesMembersCreateResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesMembersCreateResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersCreateResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/LoyaltiesMembersCreateResponseBodyPublish.php b/src/Model/LoyaltiesMembersCreateResponseBodyPublish.php new file mode 100644 index 0000000..34dfbed --- /dev/null +++ b/src/Model/LoyaltiesMembersCreateResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesMembersCreateResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersCreateResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication event counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersCreateResponseBodyRedemption.php b/src/Model/LoyaltiesMembersCreateResponseBodyRedemption.php new file mode 100644 index 0000000..d916365 --- /dev/null +++ b/src/Model/LoyaltiesMembersCreateResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class LoyaltiesMembersCreateResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersCreateResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersGetResponseBody.php b/src/Model/LoyaltiesMembersGetResponseBody.php new file mode 100644 index 0000000..42d7714 --- /dev/null +++ b/src/Model/LoyaltiesMembersGetResponseBody.php @@ -0,0 +1,1488 @@ + + */ +class LoyaltiesMembersGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => 'object', + 'gift' => 'object', + 'loyaltyCard' => '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyRedemption' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => true, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'LOYALTY_CARD'); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return object|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param object|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + array_push($this->openAPINullablesSetToNull, 'discount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return object|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param object|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode This is always false for loyalty members. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique identifier of the customer who owns the voucher. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersGetResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + 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/LoyaltiesMembersGetResponseBodyLoyaltyCard.php b/src/Model/LoyaltiesMembersGetResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..4735397 --- /dev/null +++ b/src/Model/LoyaltiesMembersGetResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesMembersGetResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersGetResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/LoyaltiesMembersGetResponseBodyPublish.php b/src/Model/LoyaltiesMembersGetResponseBodyPublish.php new file mode 100644 index 0000000..7afcb41 --- /dev/null +++ b/src/Model/LoyaltiesMembersGetResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesMembersGetResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersGetResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication event counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersGetResponseBodyRedemption.php b/src/Model/LoyaltiesMembersGetResponseBodyRedemption.php new file mode 100644 index 0000000..201a18e --- /dev/null +++ b/src/Model/LoyaltiesMembersGetResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class LoyaltiesMembersGetResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersGetResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersPointsExpirationListResponseBody.php b/src/Model/LoyaltiesMembersPointsExpirationListResponseBody.php new file mode 100644 index 0000000..785856a --- /dev/null +++ b/src/Model/LoyaltiesMembersPointsExpirationListResponseBody.php @@ -0,0 +1,623 @@ + + */ +class LoyaltiesMembersPointsExpirationListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersPointsExpirationListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBodyDataItem[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['object']) && !preg_match("/list/", $this->container['object'])) { + $invalidProperties[] = "invalid value for 'object', must be conform to the pattern /list/."; + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['dataRef']) && !preg_match("/data/", $this->container['dataRef'])) { + $invalidProperties[] = "invalid value for 'dataRef', must be conform to the pattern /data/."; + } + + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($object) && (!preg_match("/list/", $object))) { + throw new \InvalidArgumentException("invalid value for \$object when calling LoyaltiesMembersPointsExpirationListResponseBody., must conform to the pattern /list/."); + } + + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($dataRef) && (!preg_match("/data/", $dataRef))) { + throw new \InvalidArgumentException("invalid value for \$dataRef when calling LoyaltiesMembersPointsExpirationListResponseBody., must conform to the pattern /data/."); + } + + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBodyDataItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBodyDataItem[]|null $data Contains array of loyalty points expiration buckets. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of point expiration buckets. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.php b/src/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.php new file mode 100644 index 0000000..b783ed0 --- /dev/null +++ b/src/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.php @@ -0,0 +1,747 @@ + + */ +class LoyaltiesMembersPointsExpirationListResponseBodyDataItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersPointsExpirationListResponseBodyDataItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'voucherId' => 'string', + 'campaignId' => 'string', + 'bucket' => '\OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'expiresAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'voucherId' => null, + 'campaignId' => null, + 'bucket' => null, + 'createdAt' => 'date-time', + 'status' => null, + 'expiresAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'voucherId' => false, + 'campaignId' => false, + 'bucket' => false, + 'createdAt' => false, + 'status' => false, + 'expiresAt' => false, + 'updatedAt' => false, + 'object' => 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 = [ + 'id' => 'id', + 'voucherId' => 'voucher_id', + 'campaignId' => 'campaign_id', + 'bucket' => 'bucket', + 'createdAt' => 'created_at', + 'status' => 'status', + 'expiresAt' => 'expires_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'voucherId' => 'setVoucherId', + 'campaignId' => 'setCampaignId', + 'bucket' => 'setBucket', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'expiresAt' => 'setExpiresAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'voucherId' => 'getVoucherId', + 'campaignId' => 'getCampaignId', + 'bucket' => 'getBucket', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'expiresAt' => 'getExpiresAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_LOYALTY_POINTS_BUCKET = 'loyalty_points_bucket'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_LOYALTY_POINTS_BUCKET, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('bucket', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('expiresAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'loyalty_points_bucket'); + } + + /** + * 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 = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['voucherId'] === null) { + $invalidProperties[] = "'voucherId' can't be null"; + } + if ($this->container['campaignId'] === null) { + $invalidProperties[] = "'campaignId' can't be null"; + } + if ($this->container['bucket'] === null) { + $invalidProperties[] = "'bucket' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['expiresAt'] === null) { + $invalidProperties[] = "'expiresAt' can't be null"; + } + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if (!preg_match("/loyalty_points_bucket/", $this->container['object'])) { + $invalidProperties[] = "invalid value for 'object', must be conform to the pattern /loyalty_points_bucket/."; + } + + 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Unique loyalty points bucket ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets voucherId + * + * @return string + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param string $voucherId Unique parent loyalty card ID. + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + throw new \InvalidArgumentException('non-nullable voucherId cannot be null'); + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets campaignId + * + * @return string + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string $campaignId Unique parent campaign ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + throw new \InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets bucket + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket + */ + public function getBucket() + { + return $this->container['bucket']; + } + + /** + * Sets bucket + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket $bucket bucket + * + * @return self + */ + public function setBucket($bucket) + { + if (is_null($bucket)) { + throw new \InvalidArgumentException('non-nullable bucket cannot be null'); + } + $this->container['bucket'] = $bucket; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime $createdAt Timestamp representing the date and time when the loyalty points bucket object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Loyalty points bucket point status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets expiresAt + * + * @return \DateTime + */ + public function getExpiresAt() + { + return $this->container['expiresAt']; + } + + /** + * Sets expiresAt + * + * @param \DateTime $expiresAt Date when the number of points defined in the bucket object are due to expire. + * + * @return self + */ + public function setExpiresAt($expiresAt) + { + if (is_null($expiresAt)) { + throw new \InvalidArgumentException('non-nullable expiresAt cannot be null'); + } + $this->container['expiresAt'] = $expiresAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the loyalty points bucket object was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object The type of the object represented by JSON. This object stores information about the loyalty points bucket. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + + if ((!preg_match("/loyalty_points_bucket/", $object))) { + throw new \InvalidArgumentException("invalid value for \$object when calling LoyaltiesMembersPointsExpirationListResponseBodyDataItem., must conform to the pattern /loyalty_points_bucket/."); + } + + $this->container['object'] = $object; + + 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/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.php b/src/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.php new file mode 100644 index 0000000..eb27941 --- /dev/null +++ b/src/Model/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.php @@ -0,0 +1,414 @@ + + */ +class LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalPoints' => 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 = [ + 'totalPoints' => 'total_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalPoints' => 'setTotalPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalPoints' => 'getTotalPoints' + ]; + + /** + * 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('totalPoints', $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 = []; + + if ($this->container['totalPoints'] === null) { + $invalidProperties[] = "'totalPoints' can't be null"; + } + 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 totalPoints + * + * @return int + */ + public function getTotalPoints() + { + return $this->container['totalPoints']; + } + + /** + * Sets totalPoints + * + * @param int $totalPoints Total number of points in the loyalty points bucket. + * + * @return self + */ + public function setTotalPoints($totalPoints) + { + if (is_null($totalPoints)) { + throw new \InvalidArgumentException('non-nullable totalPoints cannot be null'); + } + $this->container['totalPoints'] = $totalPoints; + + 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/LoyaltiesMembersRedemptionRedeemRequestBody.php b/src/Model/LoyaltiesMembersRedemptionRedeemRequestBody.php new file mode 100644 index 0000000..c3eeab0 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemRequestBody.php @@ -0,0 +1,493 @@ + + */ +class LoyaltiesMembersRedemptionRedeemRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reward' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBodyReward', + 'order' => '\OpenAPI\Client\Model\Order', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reward' => null, + 'order' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reward' => true, + 'order' => false, + 'metadata' => true + ]; + + /** + * 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 = [ + 'reward' => 'reward', + 'order' => 'order', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reward' => 'setReward', + 'order' => 'setOrder', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reward' => 'getReward', + 'order' => 'getOrder', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('reward', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('metadata', $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 reward + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBodyReward|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemRequestBodyReward|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + array_push($this->openAPINullablesSetToNull, 'reward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can send in the request body to check against vouchers requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Advanced_ → _Redemption metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesMembersRedemptionRedeemRequestBodyReward.php b/src/Model/LoyaltiesMembersRedemptionRedeemRequestBodyReward.php new file mode 100644 index 0000000..816a214 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemRequestBodyReward.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesMembersRedemptionRedeemRequestBodyReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemRequestBodyReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'points' => 'getPoints' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('points', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesMembersRedemptionRedeemResponseBody.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBody.php new file mode 100644 index 0000000..dcadf5e --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBody.php @@ -0,0 +1,1430 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'date' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => 'object', + 'amount' => 'int', + 'redemption' => 'string', + 'result' => 'string', + 'status' => 'string', + 'relatedRedemptions' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions', + 'failureCode' => 'string', + 'failureMessage' => 'string', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'channel' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyChannel', + 'customer' => '\OpenAPI\Client\Model\SimpleCustomer', + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string', + 'voucher' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucher', + 'promotionTier' => '\OpenAPI\Client\Model\PromotionTier', + 'reward' => '\OpenAPI\Client\Model\RedemptionRewardResult', + 'gift' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'date' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'amount' => null, + 'redemption' => null, + 'result' => null, + 'status' => null, + 'relatedRedemptions' => null, + 'failureCode' => null, + 'failureMessage' => null, + 'order' => null, + 'channel' => null, + 'customer' => null, + 'relatedObjectType' => null, + 'relatedObjectId' => null, + 'voucher' => null, + 'promotionTier' => null, + 'reward' => null, + 'gift' => null, + 'loyaltyCard' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'date' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => true, + 'amount' => true, + 'redemption' => true, + 'result' => true, + 'status' => true, + 'relatedRedemptions' => true, + 'failureCode' => true, + 'failureMessage' => true, + 'order' => false, + 'channel' => true, + 'customer' => false, + 'relatedObjectType' => true, + 'relatedObjectId' => true, + 'voucher' => true, + 'promotionTier' => false, + 'reward' => false, + 'gift' => true, + 'loyaltyCard' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'date' => 'date', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'amount' => 'amount', + 'redemption' => 'redemption', + 'result' => 'result', + 'status' => 'status', + 'relatedRedemptions' => 'related_redemptions', + 'failureCode' => 'failure_code', + 'failureMessage' => 'failure_message', + 'order' => 'order', + 'channel' => 'channel', + 'customer' => 'customer', + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id', + 'voucher' => 'voucher', + 'promotionTier' => 'promotion_tier', + 'reward' => 'reward', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'date' => 'setDate', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'amount' => 'setAmount', + 'redemption' => 'setRedemption', + 'result' => 'setResult', + 'status' => 'setStatus', + 'relatedRedemptions' => 'setRelatedRedemptions', + 'failureCode' => 'setFailureCode', + 'failureMessage' => 'setFailureMessage', + 'order' => 'setOrder', + 'channel' => 'setChannel', + 'customer' => 'setCustomer', + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId', + 'voucher' => 'setVoucher', + 'promotionTier' => 'setPromotionTier', + 'reward' => 'setReward', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'date' => 'getDate', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'amount' => 'getAmount', + 'redemption' => 'getRedemption', + 'result' => 'getResult', + 'status' => 'getStatus', + 'relatedRedemptions' => 'getRelatedRedemptions', + 'failureCode' => 'getFailureCode', + 'failureMessage' => 'getFailureMessage', + 'order' => 'getOrder', + 'channel' => 'getChannel', + 'customer' => 'getCustomer', + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId', + 'voucher' => 'getVoucher', + 'promotionTier' => 'getPromotionTier', + 'reward' => 'getReward', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard' + ]; + + /** + * 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 OBJECT_REDEMPTION = 'redemption'; + public const RESULT_SUCCESS = 'SUCCESS'; + public const RESULT_FAILURE = 'FAILURE'; + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_ROLLED_BACK = 'ROLLED_BACK'; + public const RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_REDEMPTION = 'redemption'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REDEMPTION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + self::RESULT_FAILURE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + self::STATUS_ROLLED_BACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_REDEMPTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'redemption'); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('relatedRedemptions', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('failureMessage', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('promotionTier', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + array_push($this->openAPINullablesSetToNull, 'date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the redeeming customer. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the redemption. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets redemption + * + * @return string|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param string|null $redemption Unique redemption ID of the parent redemption. + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result Redemption result. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($result) && !in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Redemption status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets relatedRedemptions + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions|null + */ + public function getRelatedRedemptions() + { + return $this->container['relatedRedemptions']; + } + + /** + * Sets relatedRedemptions + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions|null $relatedRedemptions relatedRedemptions + * + * @return self + */ + public function setRelatedRedemptions($relatedRedemptions) + { + if (is_null($relatedRedemptions)) { + array_push($this->openAPINullablesSetToNull, 'relatedRedemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedRedemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedRedemptions'] = $relatedRedemptions; + + return $this; + } + + /** + * Gets failureCode + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param string|null $failureCode If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets failureMessage + * + * @return string|null + */ + public function getFailureMessage() + { + return $this->container['failureMessage']; + } + + /** + * Sets failureMessage + * + * @param string|null $failureMessage If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + * + * @return self + */ + public function setFailureMessage($failureMessage) + { + if (is_null($failureMessage)) { + array_push($this->openAPINullablesSetToNull, 'failureMessage'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureMessage', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureMessage'] = $failureMessage; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets channel + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyChannel|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyChannel|null $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Defines the related object. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + array_push($this->openAPINullablesSetToNull, 'voucher'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucher', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets promotionTier + * + * @return \OpenAPI\Client\Model\PromotionTier|null + */ + public function getPromotionTier() + { + return $this->container['promotionTier']; + } + + /** + * Sets promotionTier + * + * @param \OpenAPI\Client\Model\PromotionTier|null $promotionTier promotionTier + * + * @return self + */ + public function setPromotionTier($promotionTier) + { + if (is_null($promotionTier)) { + throw new \InvalidArgumentException('non-nullable promotionTier cannot be null'); + } + $this->container['promotionTier'] = $promotionTier; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\RedemptionRewardResult|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\RedemptionRewardResult|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.php new file mode 100644 index 0000000..35ad2d5 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.php @@ -0,0 +1,493 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyChannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyChannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channelId' => 'string', + 'channelType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channelId' => null, + 'channelType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channelId' => true, + 'channelType' => true + ]; + + /** + * 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 = [ + 'channelId' => 'channel_id', + 'channelType' => 'channel_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channelId' => 'setChannelId', + 'channelType' => 'setChannelType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channelId' => 'getChannelId', + 'channelType' => 'getChannelType' + ]; + + /** + * 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 CHANNEL_TYPE_USER = 'USER'; + public const CHANNEL_TYPE_API = 'API'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelTypeAllowableValues() + { + return [ + self::CHANNEL_TYPE_USER, + self::CHANNEL_TYPE_API, + ]; + } + + /** + * 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('channelId', $data ?? [], null); + $this->setIfExists('channelType', $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->getChannelTypeAllowableValues(); + if (!is_null($this->container['channelType']) && !in_array($this->container['channelType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channelType', must be one of '%s'", + $this->container['channelType'], + 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 channelId + * + * @return string|null + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param string|null $channelId Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API. + * + * @return self + */ + public function setChannelId($channelId) + { + if (is_null($channelId)) { + array_push($this->openAPINullablesSetToNull, 'channelId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets channelType + * + * @return string|null + */ + public function getChannelType() + { + return $this->container['channelType']; + } + + /** + * Sets channelType + * + * @param string|null $channelType The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + * + * @return self + */ + public function setChannelType($channelType) + { + if (is_null($channelType)) { + array_push($this->openAPINullablesSetToNull, 'channelType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelTypeAllowableValues(); + if (!is_null($channelType) && !in_array($channelType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channelType', must be one of '%s'", + $channelType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channelType'] = $channelType; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyGift.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyGift.php new file mode 100644 index 0000000..c4a4b41 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyGift.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; + + /** + * 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('amount', $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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..85bdac6 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points subtracted from the loyalty card as a result of the redemption. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.php new file mode 100644 index 0000000..4a40dd6 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.php @@ -0,0 +1,458 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rollbacks' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem[]', + 'redemptions' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rollbacks' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rollbacks' => true, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'rollbacks' => 'rollbacks', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rollbacks' => 'setRollbacks', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rollbacks' => 'getRollbacks', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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('rollbacks', $data ?? [], null); + $this->setIfExists('redemptions', $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 rollbacks + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem[]|null + */ + public function getRollbacks() + { + return $this->container['rollbacks']; + } + + /** + * Sets rollbacks + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem[]|null $rollbacks rollbacks + * + * @return self + */ + public function setRollbacks($rollbacks) + { + if (is_null($rollbacks)) { + array_push($this->openAPINullablesSetToNull, 'rollbacks'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbacks', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbacks'] = $rollbacks; + + return $this; + } + + /** + * Gets redemptions + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.php new file mode 100644 index 0000000..a2ebd20 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.php @@ -0,0 +1,444 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.php new file mode 100644 index 0000000..53c5d46 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.php @@ -0,0 +1,444 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique rollback redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.php new file mode 100644 index 0000000..9b7469a --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.php @@ -0,0 +1,1635 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish', + 'redemption' => '\OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'holder' => '\OpenAPI\Client\Model\SimpleCustomer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null, + 'holder' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => false, + 'holder' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'holder' => 'holder' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'holder' => 'setHolder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'holder' => 'getHolder' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('holder', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets holder + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getHolder() + { + return $this->container['holder']; + } + + /** + * Sets holder + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $holder holder + * + * @return self + */ + public function setHolder($holder) + { + if (is_null($holder)) { + throw new \InvalidArgumentException('non-nullable holder cannot be null'); + } + $this->container['holder'] = $holder; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.php new file mode 100644 index 0000000..fcffbce --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.php @@ -0,0 +1,534 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.php new file mode 100644 index 0000000..8c3bd10 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.php new file mode 100644 index 0000000..d882599 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.php @@ -0,0 +1,500 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.php b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.php new file mode 100644 index 0000000..5dbbc25 --- /dev/null +++ b/src/Model/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.php @@ -0,0 +1,582 @@ + + */ +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersRewardsListResponseBody.php b/src/Model/LoyaltiesMembersRewardsListResponseBody.php new file mode 100644 index 0000000..c6c53a0 --- /dev/null +++ b/src/Model/LoyaltiesMembersRewardsListResponseBody.php @@ -0,0 +1,614 @@ + + */ +class LoyaltiesMembersRewardsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRewardsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBodyDataItem[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['total']) && ($this->container['total'] < 0)) { + $invalidProperties[] = "invalid value for 'total', must be bigger than or equal to 0."; + } + + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of loyalty reward objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBodyDataItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersRewardsListResponseBodyDataItem[]|null $data Contains array of loyalty reward objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of loyalty reward objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($total) && ($total < 0)) { + throw new \InvalidArgumentException('invalid value for $total when calling LoyaltiesMembersRewardsListResponseBody., must be bigger than or equal to 0.'); + } + + $this->container['total'] = $total; + + 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/LoyaltiesMembersRewardsListResponseBodyDataItem.php b/src/Model/LoyaltiesMembersRewardsListResponseBodyDataItem.php new file mode 100644 index 0000000..c1aa980 --- /dev/null +++ b/src/Model/LoyaltiesMembersRewardsListResponseBodyDataItem.php @@ -0,0 +1,510 @@ + + */ +class LoyaltiesMembersRewardsListResponseBodyDataItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersRewardsListResponseBodyDataItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reward' => '\OpenAPI\Client\Model\Reward', + 'assignment' => '\OpenAPI\Client\Model\RewardAssignment', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reward' => null, + 'assignment' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reward' => false, + 'assignment' => false, + 'object' => 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 = [ + 'reward' => 'reward', + 'assignment' => 'assignment', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reward' => 'setReward', + 'assignment' => 'setAssignment', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reward' => 'getReward', + 'assignment' => 'getAssignment', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_LOYALTY_REWARD = 'loyalty_reward'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_LOYALTY_REWARD, + ]; + } + + /** + * 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('reward', $data ?? [], null); + $this->setIfExists('assignment', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'loyalty_reward'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 reward + * + * @return \OpenAPI\Client\Model\Reward|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\Reward|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets assignment + * + * @return \OpenAPI\Client\Model\RewardAssignment|null + */ + public function getAssignment() + { + return $this->container['assignment']; + } + + /** + * Sets assignment + * + * @param \OpenAPI\Client\Model\RewardAssignment|null $assignment assignment + * + * @return self + */ + public function setAssignment($assignment) + { + if (is_null($assignment)) { + throw new \InvalidArgumentException('non-nullable assignment cannot be null'); + } + $this->container['assignment'] = $assignment; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/LoyaltiesMembersTiersListResponseBody.php b/src/Model/LoyaltiesMembersTiersListResponseBody.php new file mode 100644 index 0000000..f4fc1d8 --- /dev/null +++ b/src/Model/LoyaltiesMembersTiersListResponseBody.php @@ -0,0 +1,605 @@ + + */ +class LoyaltiesMembersTiersListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTiersListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\LoyaltyTier[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of loyalty tier objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\LoyaltyTier[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\LoyaltyTier[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of loyalty tier objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesMembersTransactionsExportCreateRequestBody.php b/src/Model/LoyaltiesMembersTransactionsExportCreateRequestBody.php new file mode 100644 index 0000000..3acac1d --- /dev/null +++ b/src/Model/LoyaltiesMembersTransactionsExportCreateRequestBody.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesMembersTransactionsExportCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransactionsExportCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'parameters' => true + ]; + + /** + * 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 = [ + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'parameters' => 'getParameters' + ]; + + /** + * 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('parameters', $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 parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.php b/src/Model/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.php new file mode 100644 index 0000000..149d327 --- /dev/null +++ b/src/Model/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.php @@ -0,0 +1,571 @@ + + */ +class LoyaltiesMembersTransactionsExportCreateRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransactionsExportCreateRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\ExportVoucherTransactionsFilters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const FIELDS_ID = 'id'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_TYPE = 'type'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_REASON = 'reason'; + public const FIELDS_SOURCE = 'source'; + public const FIELDS_BALANCE = 'balance'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_RELATED_TRANSACTION_ID = 'related_transaction_id'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_DETAILS = 'details'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_ID, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_VOUCHER_ID, + self::FIELDS_TYPE, + self::FIELDS_SOURCE_ID, + self::FIELDS_REASON, + self::FIELDS_SOURCE, + self::FIELDS_BALANCE, + self::FIELDS_AMOUNT, + self::FIELDS_RELATED_TRANSACTION_ID, + self::FIELDS_CREATED_AT, + self::FIELDS_DETAILS, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\ExportVoucherTransactionsFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\ExportVoucherTransactionsFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + 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/LoyaltiesMembersTransactionsExportCreateResponseBody.php b/src/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.php new file mode 100644 index 0000000..7dd763a --- /dev/null +++ b/src/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.php @@ -0,0 +1,842 @@ + + */ +class LoyaltiesMembersTransactionsExportCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransactionsExportCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'channel' => 'string', + 'result' => 'object', + 'userId' => 'string', + 'exportedObject' => 'string', + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'status' => null, + 'channel' => null, + 'result' => null, + 'userId' => null, + 'exportedObject' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'status' => true, + 'channel' => true, + 'result' => true, + 'userId' => true, + 'exportedObject' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'status' => 'status', + 'channel' => 'channel', + 'result' => 'result', + 'userId' => 'user_id', + 'exportedObject' => 'exported_object', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'channel' => 'setChannel', + 'result' => 'setResult', + 'userId' => 'setUserId', + 'exportedObject' => 'setExportedObject', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'channel' => 'getChannel', + 'result' => 'getResult', + 'userId' => 'getUserId', + 'exportedObject' => 'getExportedObject', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_EXPORT = 'export'; + public const STATUS_SCHEDULED = 'SCHEDULED'; + public const EXPORTED_OBJECT_VOUCHER_TRANSACTIONS = 'voucher_transactions'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EXPORT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SCHEDULED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportedObjectAllowableValues() + { + return [ + self::EXPORTED_OBJECT_VOUCHER_TRANSACTIONS, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'export'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], 'SCHEDULED'); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('userId', $data ?? [], null); + $this->setIfExists('exportedObject', $data ?? [], 'voucher_transactions'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($this->container['exportedObject']) && !in_array($this->container['exportedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exportedObject', must be one of '%s'", + $this->container['exportedObject'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique export ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of object being represented. This object stores information about the export. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel through which the export was triggered. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets result + * + * @return object|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param object|null $result Contains the URL of the CSV file. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets userId + * + * @return string|null + */ + public function getUserId() + { + return $this->container['userId']; + } + + /** + * Sets userId + * + * @param string|null $userId Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. + * + * @return self + */ + public function setUserId($userId) + { + if (is_null($userId)) { + array_push($this->openAPINullablesSetToNull, 'userId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('userId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['userId'] = $userId; + + return $this; + } + + /** + * Gets exportedObject + * + * @return string|null + */ + public function getExportedObject() + { + return $this->container['exportedObject']; + } + + /** + * Sets exportedObject + * + * @param string|null $exportedObject The type of object to be exported. + * + * @return self + */ + public function setExportedObject($exportedObject) + { + if (is_null($exportedObject)) { + array_push($this->openAPINullablesSetToNull, 'exportedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exportedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($exportedObject) && !in_array($exportedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exportedObject', must be one of '%s'", + $exportedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exportedObject'] = $exportedObject; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransactionsExportCreateResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.php b/src/Model/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.php new file mode 100644 index 0000000..9a8e3a2 --- /dev/null +++ b/src/Model/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.php @@ -0,0 +1,571 @@ + + */ +class LoyaltiesMembersTransactionsExportCreateResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransactionsExportCreateResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\ExportVoucherTransactionsFilters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const FIELDS_ID = 'id'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_TYPE = 'type'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_REASON = 'reason'; + public const FIELDS_SOURCE = 'source'; + public const FIELDS_BALANCE = 'balance'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_RELATED_TRANSACTION_ID = 'related_transaction_id'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_DETAILS = 'details'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_ID, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_VOUCHER_ID, + self::FIELDS_TYPE, + self::FIELDS_SOURCE_ID, + self::FIELDS_REASON, + self::FIELDS_SOURCE, + self::FIELDS_BALANCE, + self::FIELDS_AMOUNT, + self::FIELDS_RELATED_TRANSACTION_ID, + self::FIELDS_CREATED_AT, + self::FIELDS_DETAILS, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\ExportVoucherTransactionsFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\ExportVoucherTransactionsFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + 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/LoyaltiesMembersTransactionsListResponseBody.php b/src/Model/LoyaltiesMembersTransactionsListResponseBody.php new file mode 100644 index 0000000..4d1f154 --- /dev/null +++ b/src/Model/LoyaltiesMembersTransactionsListResponseBody.php @@ -0,0 +1,623 @@ + + */ +class LoyaltiesMembersTransactionsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransactionsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\LoyaltyCardTransaction[]', + 'hasMore' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'hasMore' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'hasMore' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'hasMore' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'hasMore' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'hasMore' => 'getHasMore' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('hasMore', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['object']) && !preg_match("/list/", $this->container['object'])) { + $invalidProperties[] = "invalid value for 'object', must be conform to the pattern /list/."; + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['dataRef']) && !preg_match("/data/", $this->container['dataRef'])) { + $invalidProperties[] = "invalid value for 'dataRef', must be conform to the pattern /data/."; + } + + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($object) && (!preg_match("/list/", $object))) { + throw new \InvalidArgumentException("invalid value for \$object when calling LoyaltiesMembersTransactionsListResponseBody., must conform to the pattern /list/."); + } + + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of transaction objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($dataRef) && (!preg_match("/data/", $dataRef))) { + throw new \InvalidArgumentException("invalid value for \$dataRef when calling LoyaltiesMembersTransactionsListResponseBody., must conform to the pattern /data/."); + } + + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransaction[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransaction[]|null $data A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the has_more flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + 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/LoyaltiesMembersTransfersCreateResponseBody.php b/src/Model/LoyaltiesMembersTransfersCreateResponseBody.php new file mode 100644 index 0000000..fbac755 --- /dev/null +++ b/src/Model/LoyaltiesMembersTransfersCreateResponseBody.php @@ -0,0 +1,1416 @@ + + */ +class LoyaltiesMembersTransfersCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransfersCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'type' => 'string', + 'loyaltyCard' => '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'publish' => '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyRedemption', + 'active' => 'string', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssets', + 'isReferralCode' => 'bool', + 'holderId' => 'string', + 'updatedAt' => '\DateTime', + 'createdAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'categories' => null, + 'type' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'publish' => null, + 'redemption' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'holderId' => null, + 'updatedAt' => 'date-time', + 'createdAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'categories' => true, + 'type' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'publish' => true, + 'redemption' => true, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => true, + 'isReferralCode' => true, + 'holderId' => true, + 'updatedAt' => true, + 'createdAt' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'type' => 'type', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'holderId' => 'holder_id', + 'updatedAt' => 'updated_at', + 'createdAt' => 'created_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'type' => 'setType', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'holderId' => 'setHolderId', + 'updatedAt' => 'setUpdatedAt', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'type' => 'getType', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'holderId' => 'getHolderId', + 'updatedAt' => 'getUpdatedAt', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'LOYALTY_CARD'); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('createdAt', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['validityTimeframe'] === null) { + $invalidProperties[] = "'validityTimeframe' can't be null"; + } + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets active + * + * @return string|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param string|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date. - `true` indicates an active voucher - `false` indicates an inactive voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + array_push($this->openAPINullablesSetToNull, 'assets'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assets', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + 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/LoyaltiesMembersTransfersCreateResponseBodyAssets.php b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssets.php new file mode 100644 index 0000000..a7cf7cb --- /dev/null +++ b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssets.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesMembersTransfersCreateResponseBodyAssets implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransfersCreateResponseBodyAssets'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'qr' => '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssetsQr', + 'barcode' => '\OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'qr' => null, + 'barcode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'qr' => true, + 'barcode' => true + ]; + + /** + * 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 = [ + 'qr' => 'qr', + 'barcode' => 'barcode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'qr' => 'setQr', + 'barcode' => 'setBarcode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'qr' => 'getQr', + 'barcode' => 'getBarcode' + ]; + + /** + * 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('qr', $data ?? [], null); + $this->setIfExists('barcode', $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 qr + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssetsQr|null + */ + public function getQr() + { + return $this->container['qr']; + } + + /** + * Sets qr + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssetsQr|null $qr qr + * + * @return self + */ + public function setQr($qr) + { + if (is_null($qr)) { + array_push($this->openAPINullablesSetToNull, 'qr'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qr', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['qr'] = $qr; + + return $this; + } + + /** + * Gets barcode + * + * @return \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode|null + */ + public function getBarcode() + { + return $this->container['barcode']; + } + + /** + * Sets barcode + * + * @param \OpenAPI\Client\Model\LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode|null $barcode barcode + * + * @return self + */ + public function setBarcode($barcode) + { + if (is_null($barcode)) { + array_push($this->openAPINullablesSetToNull, 'barcode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('barcode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['barcode'] = $barcode; + + 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/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.php b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.php new file mode 100644 index 0000000..fa7b229 --- /dev/null +++ b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'url' => 'getUrl' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('url', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Encrypted voucher code ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.php b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.php new file mode 100644 index 0000000..bef2f50 --- /dev/null +++ b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesMembersTransfersCreateResponseBodyAssetsQr implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransfersCreateResponseBodyAssetsQr'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'url' => 'getUrl' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('url', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Encrypted voucher code ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.php b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..770a761 --- /dev/null +++ b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => 'string', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => null, + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return string|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param string|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/LoyaltiesMembersTransfersCreateResponseBodyPublish.php b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyPublish.php new file mode 100644 index 0000000..bfe631f --- /dev/null +++ b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyPublish.php @@ -0,0 +1,573 @@ + + */ +class LoyaltiesMembersTransfersCreateResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransfersCreateResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'entries' => 'string[]', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'entries' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'entries' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'entries' => 'entries', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'entries' => 'setEntries', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'entries' => 'getEntries', + 'url' => 'getUrl' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('entries', $data ?? [], null); + $this->setIfExists('url', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets entries + * + * @return string[]|null + */ + public function getEntries() + { + return $this->container['entries']; + } + + /** + * Sets entries + * + * @param string[]|null $entries entries + * + * @return self + */ + public function setEntries($entries) + { + if (is_null($entries)) { + array_push($this->openAPINullablesSetToNull, 'entries'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('entries', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['entries'] = $entries; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesMembersTransfersCreateResponseBodyRedemption.php b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyRedemption.php new file mode 100644 index 0000000..af2452c --- /dev/null +++ b/src/Model/LoyaltiesMembersTransfersCreateResponseBodyRedemption.php @@ -0,0 +1,614 @@ + + */ +class LoyaltiesMembersTransfersCreateResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesMembersTransfersCreateResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedPoints' => 'int', + 'redeemedQuantity' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedPoints' => null, + 'redeemedQuantity' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedPoints' => true, + 'redeemedQuantity' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedPoints' => 'redeemed_points', + 'redeemedQuantity' => 'redeemed_quantity', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A null value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltiesPointsExpirationExportCreateRequestBody.php b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBody.php new file mode 100644 index 0000000..c1c2539 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBody.php @@ -0,0 +1,411 @@ + + */ +class LoyaltiesPointsExpirationExportCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'parameters' => 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 = [ + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'parameters' => 'getParameters' + ]; + + /** + * 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('parameters', $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 parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + 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/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.php b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.php new file mode 100644 index 0000000..6b7a1c6 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.php @@ -0,0 +1,559 @@ + + */ +class LoyaltiesPointsExpirationExportCreateRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_EXPIRES_AT = 'expires_at'; + public const ORDER_EXPIRES_AT2 = '-expires_at'; + public const FIELDS_ID = 'id'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_POINTS = 'points'; + public const FIELDS_STATUS = 'status'; + public const FIELDS_EXPIRES_AT = 'expires_at'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_EXPIRES_AT, + self::ORDER_EXPIRES_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_ID, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_VOUCHER_ID, + self::FIELDS_POINTS, + self::FIELDS_STATUS, + self::FIELDS_EXPIRES_AT, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + 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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.php b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.php new file mode 100644 index 0000000..9f44748 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.php @@ -0,0 +1,534 @@ + + */ +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'voucherId' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId', + 'campaignId' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'voucherId' => null, + 'campaignId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'voucherId' => true, + 'campaignId' => true + ]; + + /** + * 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 = [ + 'junction' => 'junction', + 'voucherId' => 'voucher_id', + 'campaignId' => 'campaign_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'voucherId' => 'setVoucherId', + 'campaignId' => 'setCampaignId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'voucherId' => 'getVoucherId', + 'campaignId' => 'getCampaignId' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('campaignId', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets voucherId + * + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId|null $voucherId voucherId + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + array_push($this->openAPINullablesSetToNull, 'voucherId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + 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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.php b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.php new file mode 100644 index 0000000..992687a --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions' + ]; + + /** + * 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' => true + ]; + + /** + * 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\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.php b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.php new file mode 100644 index 0000000..c7fdfeb --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot' + ]; + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isNot', $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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of the resource values that should be included in the results. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of the resource values that should be included in the results. + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Specify the exact resource value. + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results should omit this value. + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isNot'] = $isNot; + + 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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.php b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.php new file mode 100644 index 0000000..b644998 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions' + ]; + + /** + * 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' => true + ]; + + /** + * 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\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.php b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.php new file mode 100644 index 0000000..251a1af --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot' + ]; + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isNot', $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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of the resource values that should be included in the results. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of the resource values that should be included in the results. + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Specify the exact resource value. + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results should omit this value. + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isNot'] = $isNot; + + 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/LoyaltiesPointsExpirationExportCreateResponseBody.php b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBody.php new file mode 100644 index 0000000..11d24c6 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBody.php @@ -0,0 +1,869 @@ + + */ +class LoyaltiesPointsExpirationExportCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'channel' => 'string', + 'exportedObject' => 'string', + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParameters', + 'result' => 'object', + 'userId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'status' => null, + 'channel' => null, + 'exportedObject' => null, + 'parameters' => null, + 'result' => null, + 'userId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'status' => true, + 'channel' => true, + 'exportedObject' => true, + 'parameters' => false, + 'result' => true, + 'userId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'status' => 'status', + 'channel' => 'channel', + 'exportedObject' => 'exported_object', + 'parameters' => 'parameters', + 'result' => 'result', + 'userId' => 'user_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'channel' => 'setChannel', + 'exportedObject' => 'setExportedObject', + 'parameters' => 'setParameters', + 'result' => 'setResult', + 'userId' => 'setUserId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'channel' => 'getChannel', + 'exportedObject' => 'getExportedObject', + 'parameters' => 'getParameters', + 'result' => 'getResult', + 'userId' => 'getUserId' + ]; + + /** + * 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 OBJECT_EXPORT = 'export'; + public const STATUS_SCHEDULED = 'SCHEDULED'; + public const CHANNEL_API = 'API'; + public const CHANNEL_WEBSITE = 'WEBSITE'; + public const EXPORTED_OBJECT_POINTS_EXPIRATION = 'points_expiration'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EXPORT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SCHEDULED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_API, + self::CHANNEL_WEBSITE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportedObjectAllowableValues() + { + return [ + self::EXPORTED_OBJECT_POINTS_EXPIRATION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'export'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], 'SCHEDULED'); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('exportedObject', $data ?? [], 'points_expiration'); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('userId', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($this->container['exportedObject']) && !in_array($this->container['exportedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exportedObject', must be one of '%s'", + $this->container['exportedObject'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique export ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of object being represented. This object stores information about the export. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the export. Informs you whether the export has already been completed. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel through which the export was triggered. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets exportedObject + * + * @return string|null + */ + public function getExportedObject() + { + return $this->container['exportedObject']; + } + + /** + * Sets exportedObject + * + * @param string|null $exportedObject The type of exported object. + * + * @return self + */ + public function setExportedObject($exportedObject) + { + if (is_null($exportedObject)) { + array_push($this->openAPINullablesSetToNull, 'exportedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exportedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($exportedObject) && !in_array($exportedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exportedObject', must be one of '%s'", + $exportedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exportedObject'] = $exportedObject; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets result + * + * @return object|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param object|null $result Always null. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets userId + * + * @return string|null + */ + public function getUserId() + { + return $this->container['userId']; + } + + /** + * Sets userId + * + * @param string|null $userId `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard. `user_id` is returned when the channel value is `WEBSITE`. + * + * @return self + */ + public function setUserId($userId) + { + if (is_null($userId)) { + array_push($this->openAPINullablesSetToNull, 'userId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('userId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['userId'] = $userId; + + 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/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.php b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.php new file mode 100644 index 0000000..513e0bf --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.php @@ -0,0 +1,559 @@ + + */ +class LoyaltiesPointsExpirationExportCreateResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_EXPIRES_AT = 'expires_at'; + public const ORDER_EXPIRES_AT2 = '-expires_at'; + public const FIELDS_ID = 'id'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_POINTS = 'points'; + public const FIELDS_STATUS = 'status'; + public const FIELDS_EXPIRES_AT = 'expires_at'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_EXPIRES_AT, + self::ORDER_EXPIRES_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_ID, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_VOUCHER_ID, + self::FIELDS_POINTS, + self::FIELDS_STATUS, + self::FIELDS_EXPIRES_AT, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + 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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.php b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.php new file mode 100644 index 0000000..3cc6357 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.php @@ -0,0 +1,534 @@ + + */ +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'voucherId' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId', + 'campaignId' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'voucherId' => null, + 'campaignId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'voucherId' => true, + 'campaignId' => true + ]; + + /** + * 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 = [ + 'junction' => 'junction', + 'voucherId' => 'voucher_id', + 'campaignId' => 'campaign_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'voucherId' => 'setVoucherId', + 'campaignId' => 'setCampaignId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'voucherId' => 'getVoucherId', + 'campaignId' => 'getCampaignId' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('campaignId', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets voucherId + * + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId|null $voucherId voucherId + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + array_push($this->openAPINullablesSetToNull, 'voucherId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + 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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.php b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.php new file mode 100644 index 0000000..c8fad23 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions' + ]; + + /** + * 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' => true + ]; + + /** + * 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\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.php b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.php new file mode 100644 index 0000000..62a4ec2 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot' + ]; + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isNot', $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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of the resource values that should be included in the results. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of the resource values that should be included in the results. + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Specify the exact resource value. + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results should omit this value. + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isNot'] = $isNot; + + 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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.php b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.php new file mode 100644 index 0000000..10455f4 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions' + ]; + + /** + * 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' => true + ]; + + /** + * 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\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.php b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.php new file mode 100644 index 0000000..2b18230 --- /dev/null +++ b/src/Model/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot' + ]; + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isNot', $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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of the resource values that should be included in the results. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of the resource values that should be excluded from the results. + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Specify the exact resource value. + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results should omit this value. + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isNot'] = $isNot; + + 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/LoyaltiesRewardAssignmentsGetResponseBody.php b/src/Model/LoyaltiesRewardAssignmentsGetResponseBody.php new file mode 100644 index 0000000..3e9150d --- /dev/null +++ b/src/Model/LoyaltiesRewardAssignmentsGetResponseBody.php @@ -0,0 +1,769 @@ + + */ +class LoyaltiesRewardAssignmentsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardAssignmentsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'rewardId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'rewardId' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'rewardId' => 'reward_id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward_assignment'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'campaign'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward assignment ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId() + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Associated reward ID. + * + * @return self + */ + public function setRewardId($rewardId) + { + if (is_null($rewardId)) { + array_push($this->openAPINullablesSetToNull, 'rewardId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewardId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the reward assignment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Related object ID to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Related object type to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/LoyaltiesRewardAssignmentsGetResponseBodyParameters.php b/src/Model/LoyaltiesRewardAssignmentsGetResponseBodyParameters.php new file mode 100644 index 0000000..245709f --- /dev/null +++ b/src/Model/LoyaltiesRewardAssignmentsGetResponseBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardAssignmentsGetResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardAssignmentsGetResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.php b/src/Model/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.php new file mode 100644 index 0000000..f9c7ff1 --- /dev/null +++ b/src/Model/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of points required to redeem the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesRewardAssignmentsListResponseBody.php b/src/Model/LoyaltiesRewardAssignmentsListResponseBody.php new file mode 100644 index 0000000..261522b --- /dev/null +++ b/src/Model/LoyaltiesRewardAssignmentsListResponseBody.php @@ -0,0 +1,573 @@ + + */ +class LoyaltiesRewardAssignmentsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardAssignmentsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\RewardAssignment[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of reward assignment objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\RewardAssignment[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\RewardAssignment[]|null $data Contains array of reward assignment objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of reward assignment objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesRewardAssignmentsRewardGetResponseBody.php b/src/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.php new file mode 100644 index 0000000..d5639c7 --- /dev/null +++ b/src/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.php @@ -0,0 +1,885 @@ + + */ +class LoyaltiesRewardAssignmentsRewardGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardAssignmentsRewardGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'stock' => 'int', + 'redeemed' => 'int', + 'attributes' => '\OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes', + 'metadata' => 'object', + 'type' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardType', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'stock' => null, + 'redeemed' => null, + 'attributes' => null, + 'metadata' => null, + 'type' => null, + 'parameters' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'stock' => true, + 'redeemed' => true, + 'attributes' => true, + 'metadata' => true, + 'type' => true, + 'parameters' => false, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'stock' => 'stock', + 'redeemed' => 'redeemed', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'type' => 'type', + 'parameters' => 'parameters', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'stock' => 'setStock', + 'redeemed' => 'setRedeemed', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'type' => 'setType', + 'parameters' => 'setParameters', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'stock' => 'getStock', + 'redeemed' => 'getRedeemed', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'type' => 'getType', + 'parameters' => 'getParameters', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_CAMPAIGN = 'CAMPAIGN'; + public const TYPE_COIN = 'COIN'; + public const TYPE_MATERIAL = 'MATERIAL'; + public const OBJECT_REWARD = 'reward'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_CAMPAIGN, + self::TYPE_COIN, + self::TYPE_MATERIAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('stock', $data ?? [], null); + $this->setIfExists('redeemed', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Reward name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets stock + * + * @return int|null + */ + public function getStock() + { + return $this->container['stock']; + } + + /** + * Sets stock + * + * @param int|null $stock Configurable for **material rewards**. The number of units of the product that you want to share as reward. + * + * @return self + */ + public function setStock($stock) + { + if (is_null($stock)) { + array_push($this->openAPINullablesSetToNull, 'stock'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stock', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['stock'] = $stock; + + return $this; + } + + /** + * Gets redeemed + * + * @return int|null + */ + public function getRedeemed() + { + return $this->container['redeemed']; + } + + /** + * Sets redeemed + * + * @param int|null $redeemed Defines the number of already invoked (successful) reward redemptions. + * + * @return self + */ + public function setRedeemed($redeemed) + { + if (is_null($redeemed)) { + array_push($this->openAPINullablesSetToNull, 'redeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemed'] = $redeemed; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Reward type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardType|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardType|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object The type of the object represented by the JSON. This object stores information about the reward. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.php b/src/Model/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.php new file mode 100644 index 0000000..f291c8b --- /dev/null +++ b/src/Model/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'imageUrl' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'imageUrl' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'imageUrl' => true, + 'description' => true + ]; + + /** + * 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 = [ + 'imageUrl' => 'image_url', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'imageUrl' => 'setImageUrl', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'imageUrl' => 'getImageUrl', + 'description' => 'getDescription' + ]; + + /** + * 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('imageUrl', $data ?? [], null); + $this->setIfExists('description', $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 imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a material reward. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + 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/LoyaltiesRewardsCreateAssignmentItemRequestBody.php b/src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBody.php new file mode 100644 index 0000000..d713692 --- /dev/null +++ b/src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBody.php @@ -0,0 +1,499 @@ + + */ +class LoyaltiesRewardsCreateAssignmentItemRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsCreateAssignmentItemRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reward' => 'string', + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters', + 'validationRules' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reward' => null, + 'parameters' => null, + 'validationRules' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reward' => true, + 'parameters' => true, + 'validationRules' => true + ]; + + /** + * 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 = [ + 'reward' => 'reward', + 'parameters' => 'parameters', + 'validationRules' => 'validation_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reward' => 'setReward', + 'parameters' => 'setParameters', + 'validationRules' => 'setValidationRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reward' => 'getReward', + 'parameters' => 'getParameters', + 'validationRules' => 'getValidationRules' + ]; + + /** + * 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('reward', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('validationRules', $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 reward + * + * @return string|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param string|null $reward The ID of the reward that will be assigned to the campaign. + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + array_push($this->openAPINullablesSetToNull, 'reward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets validationRules + * + * @return string[]|null + */ + public function getValidationRules() + { + return $this->container['validationRules']; + } + + /** + * Sets validationRules + * + * @param string[]|null $validationRules validationRules + * + * @return self + */ + public function setValidationRules($validationRules) + { + if (is_null($validationRules)) { + array_push($this->openAPINullablesSetToNull, 'validationRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRules'] = $validationRules; + + 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/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.php b/src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.php new file mode 100644 index 0000000..5416c07 --- /dev/null +++ b/src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.php b/src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.php new file mode 100644 index 0000000..86cbc98 --- /dev/null +++ b/src/Model/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesRewardsCreateAssignmentResponseBody.php b/src/Model/LoyaltiesRewardsCreateAssignmentResponseBody.php new file mode 100644 index 0000000..e8c7545 --- /dev/null +++ b/src/Model/LoyaltiesRewardsCreateAssignmentResponseBody.php @@ -0,0 +1,769 @@ + + */ +class LoyaltiesRewardsCreateAssignmentResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsCreateAssignmentResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'rewardId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'rewardId' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'rewardId' => 'reward_id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward_assignment'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'campaign'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward assignment ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId() + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Associated reward ID. + * + * @return self + */ + public function setRewardId($rewardId) + { + if (is_null($rewardId)) { + array_push($this->openAPINullablesSetToNull, 'rewardId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewardId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the reward assignment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Related object ID to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Related object type to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.php b/src/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.php new file mode 100644 index 0000000..5e16e51 --- /dev/null +++ b/src/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsCreateAssignmentResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsCreateAssignmentResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.php b/src/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.php new file mode 100644 index 0000000..739cf19 --- /dev/null +++ b/src/Model/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of points required to redeem the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesRewardsGetResponseBody.php b/src/Model/LoyaltiesRewardsGetResponseBody.php new file mode 100644 index 0000000..e448d75 --- /dev/null +++ b/src/Model/LoyaltiesRewardsGetResponseBody.php @@ -0,0 +1,769 @@ + + */ +class LoyaltiesRewardsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'rewardId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'rewardId' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'rewardId' => 'reward_id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward_assignment'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'campaign'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward assignment ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId() + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Associated reward ID. + * + * @return self + */ + public function setRewardId($rewardId) + { + if (is_null($rewardId)) { + array_push($this->openAPINullablesSetToNull, 'rewardId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewardId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the reward assignment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Related object ID to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Related object type to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/LoyaltiesRewardsGetResponseBodyParameters.php b/src/Model/LoyaltiesRewardsGetResponseBodyParameters.php new file mode 100644 index 0000000..591dec5 --- /dev/null +++ b/src/Model/LoyaltiesRewardsGetResponseBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsGetResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsGetResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsGetResponseBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/LoyaltiesRewardsGetResponseBodyParametersLoyalty.php b/src/Model/LoyaltiesRewardsGetResponseBodyParametersLoyalty.php new file mode 100644 index 0000000..55274d5 --- /dev/null +++ b/src/Model/LoyaltiesRewardsGetResponseBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsGetResponseBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsGetResponseBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of points required to redeem the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesRewardsListAssignmentsResponseBody.php b/src/Model/LoyaltiesRewardsListAssignmentsResponseBody.php new file mode 100644 index 0000000..3f7a8df --- /dev/null +++ b/src/Model/LoyaltiesRewardsListAssignmentsResponseBody.php @@ -0,0 +1,573 @@ + + */ +class LoyaltiesRewardsListAssignmentsResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsListAssignmentsResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\RewardAssignment[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of reward assignment objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\RewardAssignment[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\RewardAssignment[]|null $data Contains array of reward assignment objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of reward assignment objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesRewardsUpdateAssignmentRequestBody.php b/src/Model/LoyaltiesRewardsUpdateAssignmentRequestBody.php new file mode 100644 index 0000000..6eab9e1 --- /dev/null +++ b/src/Model/LoyaltiesRewardsUpdateAssignmentRequestBody.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsUpdateAssignmentRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsUpdateAssignmentRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'parameters' => true + ]; + + /** + * 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 = [ + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'parameters' => 'getParameters' + ]; + + /** + * 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('parameters', $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 parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.php b/src/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.php new file mode 100644 index 0000000..2867803 --- /dev/null +++ b/src/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsUpdateAssignmentRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsUpdateAssignmentRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.php b/src/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.php new file mode 100644 index 0000000..42ef929 --- /dev/null +++ b/src/Model/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how many points are required to obtain the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesRewardsUpdateAssignmentResponseBody.php b/src/Model/LoyaltiesRewardsUpdateAssignmentResponseBody.php new file mode 100644 index 0000000..8abd0ea --- /dev/null +++ b/src/Model/LoyaltiesRewardsUpdateAssignmentResponseBody.php @@ -0,0 +1,769 @@ + + */ +class LoyaltiesRewardsUpdateAssignmentResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsUpdateAssignmentResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'parameters' => '\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'rewardId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'rewardId' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'rewardId' => 'reward_id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward_assignment'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'campaign'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward assignment ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId() + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Associated reward ID. + * + * @return self + */ + public function setRewardId($rewardId) + { + if (is_null($rewardId)) { + array_push($this->openAPINullablesSetToNull, 'rewardId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewardId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the reward assignment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Related object ID to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Related object type to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.php b/src/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.php new file mode 100644 index 0000000..79bb618 --- /dev/null +++ b/src/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsUpdateAssignmentResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsUpdateAssignmentResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.php b/src/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.php new file mode 100644 index 0000000..c9226c1 --- /dev/null +++ b/src/Model/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of points required to redeem the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesTiersCreateInBulkRequestBodyItem.php b/src/Model/LoyaltiesTiersCreateInBulkRequestBodyItem.php new file mode 100644 index 0000000..741df2f --- /dev/null +++ b/src/Model/LoyaltiesTiersCreateInBulkRequestBodyItem.php @@ -0,0 +1,574 @@ + + */ +class LoyaltiesTiersCreateInBulkRequestBodyItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTiersCreateInBulkRequestBodyItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'earningRules' => 'array', + 'rewards' => 'array', + 'points' => '\OpenAPI\Client\Model\LoyaltyTierBasePoints', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'earningRules' => null, + 'rewards' => null, + 'points' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'earningRules' => true, + 'rewards' => true, + 'points' => true, + 'metadata' => 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 = [ + 'name' => 'name', + 'earningRules' => 'earning_rules', + 'rewards' => 'rewards', + 'points' => 'points', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'earningRules' => 'setEarningRules', + 'rewards' => 'setRewards', + 'points' => 'setPoints', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'earningRules' => 'getEarningRules', + 'rewards' => 'getRewards', + 'points' => 'getPoints', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('earningRules', $data ?? [], null); + $this->setIfExists('rewards', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('metadata', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Loyalty Tier name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets earningRules + * + * @return array|null + */ + public function getEarningRules() + { + return $this->container['earningRules']; + } + + /** + * Sets earningRules + * + * @param array|null $earningRules Contains a list of earning rule IDs and their points mapping for the given earning rule. + * + * @return self + */ + public function setEarningRules($earningRules) + { + if (is_null($earningRules)) { + array_push($this->openAPINullablesSetToNull, 'earningRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('earningRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['earningRules'] = $earningRules; + + return $this; + } + + /** + * Gets rewards + * + * @return array|null + */ + public function getRewards() + { + return $this->container['rewards']; + } + + /** + * Sets rewards + * + * @param array|null $rewards Contains a list of reward IDs and their points mapping for the given reward. + * + * @return self + */ + public function setRewards($rewards) + { + if (is_null($rewards)) { + array_push($this->openAPINullablesSetToNull, 'rewards'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewards', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewards'] = $rewards; + + return $this; + } + + /** + * Gets points + * + * @return \OpenAPI\Client\Model\LoyaltyTierBasePoints|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param \OpenAPI\Client\Model\LoyaltyTierBasePoints|null $points points + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + 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/LoyaltiesTiersEarningRulesListResponseBody.php b/src/Model/LoyaltiesTiersEarningRulesListResponseBody.php new file mode 100644 index 0000000..3519823 --- /dev/null +++ b/src/Model/LoyaltiesTiersEarningRulesListResponseBody.php @@ -0,0 +1,605 @@ + + */ +class LoyaltiesTiersEarningRulesListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTiersEarningRulesListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\EarningRule[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about earning rules in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of earning rule objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\EarningRule[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\EarningRule[]|null $data Contains array of earning rule objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of earning rule objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesTiersGetResponseBody.php b/src/Model/LoyaltiesTiersGetResponseBody.php new file mode 100644 index 0000000..5bf582f --- /dev/null +++ b/src/Model/LoyaltiesTiersGetResponseBody.php @@ -0,0 +1,894 @@ + + */ +class LoyaltiesTiersGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTiersGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'earningRules' => 'array', + 'rewards' => 'array', + 'points' => '\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyPoints', + 'id' => 'string', + 'campaignId' => 'string', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'config' => '\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyConfig', + 'expiration' => '\OpenAPI\Client\Model\LoyaltyTierExpiration', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'earningRules' => null, + 'rewards' => null, + 'points' => null, + 'id' => null, + 'campaignId' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'config' => null, + 'expiration' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'earningRules' => true, + 'rewards' => true, + 'points' => true, + 'id' => true, + 'campaignId' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'config' => true, + 'expiration' => false, + 'object' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'earningRules' => 'earning_rules', + 'rewards' => 'rewards', + 'points' => 'points', + 'id' => 'id', + 'campaignId' => 'campaign_id', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'config' => 'config', + 'expiration' => 'expiration', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'earningRules' => 'setEarningRules', + 'rewards' => 'setRewards', + 'points' => 'setPoints', + 'id' => 'setId', + 'campaignId' => 'setCampaignId', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'config' => 'setConfig', + 'expiration' => 'setExpiration', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'earningRules' => 'getEarningRules', + 'rewards' => 'getRewards', + 'points' => 'getPoints', + 'id' => 'getId', + 'campaignId' => 'getCampaignId', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'config' => 'getConfig', + 'expiration' => 'getExpiration', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_LOYALTY_TIER = 'loyalty_tier'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_LOYALTY_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('name', $data ?? [], null); + $this->setIfExists('earningRules', $data ?? [], null); + $this->setIfExists('rewards', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('config', $data ?? [], null); + $this->setIfExists('expiration', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'loyalty_tier'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Loyalty Tier name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets earningRules + * + * @return array|null + */ + public function getEarningRules() + { + return $this->container['earningRules']; + } + + /** + * Sets earningRules + * + * @param array|null $earningRules Contains a list of earning rule IDs and their points mapping for the given earning rule. + * + * @return self + */ + public function setEarningRules($earningRules) + { + if (is_null($earningRules)) { + array_push($this->openAPINullablesSetToNull, 'earningRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('earningRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['earningRules'] = $earningRules; + + return $this; + } + + /** + * Gets rewards + * + * @return array|null + */ + public function getRewards() + { + return $this->container['rewards']; + } + + /** + * Sets rewards + * + * @param array|null $rewards Contains a list of reward IDs and their points mapping for the given reward. + * + * @return self + */ + public function setRewards($rewards) + { + if (is_null($rewards)) { + array_push($this->openAPINullablesSetToNull, 'rewards'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewards', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewards'] = $rewards; + + return $this; + } + + /** + * Gets points + * + * @return \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyPoints|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyPoints|null $points points + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Unique parent campaign ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets config + * + * @return \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyConfig|null + */ + public function getConfig() + { + return $this->container['config']; + } + + /** + * Sets config + * + * @param \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyConfig|null $config config + * + * @return self + */ + public function setConfig($config) + { + if (is_null($config)) { + array_push($this->openAPINullablesSetToNull, 'config'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('config', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['config'] = $config; + + return $this; + } + + /** + * Gets expiration + * + * @return \OpenAPI\Client\Model\LoyaltyTierExpiration|null + */ + public function getExpiration() + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param \OpenAPI\Client\Model\LoyaltyTierExpiration|null $expiration expiration + * + * @return self + */ + public function setExpiration($expiration) + { + if (is_null($expiration)) { + throw new \InvalidArgumentException('non-nullable expiration cannot be null'); + } + $this->container['expiration'] = $expiration; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the loyalty. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/LoyaltiesTiersGetResponseBodyConfig.php b/src/Model/LoyaltiesTiersGetResponseBodyConfig.php new file mode 100644 index 0000000..003c428 --- /dev/null +++ b/src/Model/LoyaltiesTiersGetResponseBodyConfig.php @@ -0,0 +1,418 @@ + + */ +class LoyaltiesTiersGetResponseBodyConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTiersGetResponseBodyConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => '\OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyConfigPoints' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyConfigPoints|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param \OpenAPI\Client\Model\LoyaltiesTiersGetResponseBodyConfigPoints|null $points points + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltiesTiersGetResponseBodyConfigPoints.php b/src/Model/LoyaltiesTiersGetResponseBodyConfigPoints.php new file mode 100644 index 0000000..57573e7 --- /dev/null +++ b/src/Model/LoyaltiesTiersGetResponseBodyConfigPoints.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesTiersGetResponseBodyConfigPoints implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTiersGetResponseBodyConfigPoints'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => 'int', + 'to' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from' => true, + 'to' => true + ]; + + /** + * 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 = [ + 'from' => 'from', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'to' => 'getTo' + ]; + + /** + * 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('from', $data ?? [], null); + $this->setIfExists('to', $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 from + * + * @return int|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param int|null $from Bottom points threshold value. + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return int|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param int|null $to Top points threshold value. + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['to'] = $to; + + 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/LoyaltiesTiersGetResponseBodyPoints.php b/src/Model/LoyaltiesTiersGetResponseBodyPoints.php new file mode 100644 index 0000000..97e1c0e --- /dev/null +++ b/src/Model/LoyaltiesTiersGetResponseBodyPoints.php @@ -0,0 +1,459 @@ + + */ +class LoyaltiesTiersGetResponseBodyPoints implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTiersGetResponseBodyPoints'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => 'int', + 'to' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from' => true, + 'to' => true + ]; + + /** + * 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 = [ + 'from' => 'from', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'to' => 'getTo' + ]; + + /** + * 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('from', $data ?? [], null); + $this->setIfExists('to', $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 from + * + * @return int|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param int|null $from Bottom points threshold value. + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return int|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param int|null $to Top points threshold value. + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['to'] = $to; + + 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/LoyaltiesTiersListResponseBody.php b/src/Model/LoyaltiesTiersListResponseBody.php new file mode 100644 index 0000000..90ecc30 --- /dev/null +++ b/src/Model/LoyaltiesTiersListResponseBody.php @@ -0,0 +1,605 @@ + + */ +class LoyaltiesTiersListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTiersListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\LoyaltyTier[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of loyalty tier objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\LoyaltyTier[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\LoyaltyTier[]|null $data This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer's tiers. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of loyalty tier objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesTiersRewardsListResponseBody.php b/src/Model/LoyaltiesTiersRewardsListResponseBody.php new file mode 100644 index 0000000..da54708 --- /dev/null +++ b/src/Model/LoyaltiesTiersRewardsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class LoyaltiesTiersRewardsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTiersRewardsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\LoyaltiesLoyaltyTierReward[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about loyalty tier rewards in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of loyalty tier reward objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\LoyaltiesLoyaltyTierReward[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\LoyaltiesLoyaltyTierReward[]|null $data Contains array of loyalty tier reward objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of loyalty tier reward objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/LoyaltiesTransferPoints.php b/src/Model/LoyaltiesTransferPoints.php new file mode 100644 index 0000000..4110ae8 --- /dev/null +++ b/src/Model/LoyaltiesTransferPoints.php @@ -0,0 +1,540 @@ + + */ +class LoyaltiesTransferPoints implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesTransferPoints'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'points' => 'int', + 'reason' => 'string', + 'sourceId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'points' => null, + 'reason' => null, + 'sourceId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'points' => true, + 'reason' => true, + 'sourceId' => true + ]; + + /** + * 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 = [ + 'code' => 'code', + 'points' => 'points', + 'reason' => 'reason', + 'sourceId' => 'source_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'points' => 'setPoints', + 'reason' => 'setReason', + 'sourceId' => 'setSourceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'points' => 'getPoints', + 'reason' => 'getReason', + 'sourceId' => 'getSourceId' + ]; + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('sourceId', $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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Unique loyalty card code from which the user wants to transfer loyalty points (source). + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source). + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason Reason for the transfer. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + 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/LoyaltiesUpdateCampaignRequestBody.php b/src/Model/LoyaltiesUpdateCampaignRequestBody.php new file mode 100644 index 0000000..2cf3f50 --- /dev/null +++ b/src/Model/LoyaltiesUpdateCampaignRequestBody.php @@ -0,0 +1,1080 @@ + + */ +class LoyaltiesUpdateCampaignRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesUpdateCampaignRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'description' => 'string', + 'category' => 'string', + 'metadata' => 'object', + 'unsetMetadataFields' => 'string[]', + 'categoryId' => 'string', + 'activityDurationAfterPublishing' => 'string', + 'joinOnce' => 'bool', + 'autoJoin' => 'bool', + 'type' => 'string', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'options' => '\OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBodyOptions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'description' => null, + 'category' => null, + 'metadata' => null, + 'unsetMetadataFields' => null, + 'categoryId' => null, + 'activityDurationAfterPublishing' => null, + 'joinOnce' => null, + 'autoJoin' => null, + 'type' => null, + 'loyaltyTiersExpiration' => null, + 'options' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'description' => true, + 'category' => true, + 'metadata' => true, + 'unsetMetadataFields' => true, + 'categoryId' => true, + 'activityDurationAfterPublishing' => true, + 'joinOnce' => true, + 'autoJoin' => true, + 'type' => true, + 'loyaltyTiersExpiration' => false, + 'options' => true + ]; + + /** + * 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 = [ + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'description' => 'description', + 'category' => 'category', + 'metadata' => 'metadata', + 'unsetMetadataFields' => 'unset_metadata_fields', + 'categoryId' => 'category_id', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'joinOnce' => 'join_once', + 'autoJoin' => 'auto_join', + 'type' => 'type', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'options' => 'options' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'description' => 'setDescription', + 'category' => 'setCategory', + 'metadata' => 'setMetadata', + 'unsetMetadataFields' => 'setUnsetMetadataFields', + 'categoryId' => 'setCategoryId', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'joinOnce' => 'setJoinOnce', + 'autoJoin' => 'setAutoJoin', + 'type' => 'setType', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'options' => 'setOptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'description' => 'getDescription', + 'category' => 'getCategory', + 'metadata' => 'getMetadata', + 'unsetMetadataFields' => 'getUnsetMetadataFields', + 'categoryId' => 'getCategoryId', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'joinOnce' => 'getJoinOnce', + 'autoJoin' => 'getAutoJoin', + 'type' => 'getType', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'options' => 'getOptions' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * 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('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('unsetMetadataFields', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('options', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The category assigned to the campaign. Either pass this parameter OR the `category_id`. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets unsetMetadataFields + * + * @return string[]|null + */ + public function getUnsetMetadataFields() + { + return $this->container['unsetMetadataFields']; + } + + /** + * Sets unsetMetadataFields + * + * @param string[]|null $unsetMetadataFields Determine which metadata should be removed from campaign. + * + * @return self + */ + public function setUnsetMetadataFields($unsetMetadataFields) + { + if (is_null($unsetMetadataFields)) { + array_push($this->openAPINullablesSetToNull, 'unsetMetadataFields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unsetMetadataFields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unsetMetadataFields'] = $unsetMetadataFields; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets options + * + * @return \OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBodyOptions|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \OpenAPI\Client\Model\LoyaltiesUpdateCampaignRequestBodyOptions|null $options options + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + array_push($this->openAPINullablesSetToNull, 'options'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('options', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['options'] = $options; + + 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/LoyaltiesUpdateCampaignRequestBodyOptions.php b/src/Model/LoyaltiesUpdateCampaignRequestBodyOptions.php new file mode 100644 index 0000000..70b13a2 --- /dev/null +++ b/src/Model/LoyaltiesUpdateCampaignRequestBodyOptions.php @@ -0,0 +1,417 @@ + + */ +class LoyaltiesUpdateCampaignRequestBodyOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesUpdateCampaignRequestBodyOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'recalculateTiers' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'recalculateTiers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'recalculateTiers' => true + ]; + + /** + * 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 = [ + 'recalculateTiers' => 'recalculate_tiers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'recalculateTiers' => 'setRecalculateTiers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'recalculateTiers' => 'getRecalculateTiers' + ]; + + /** + * 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('recalculateTiers', $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 recalculateTiers + * + * @return bool|null + */ + public function getRecalculateTiers() + { + return $this->container['recalculateTiers']; + } + + /** + * Sets recalculateTiers + * + * @param bool|null $recalculateTiers Determine if tiers should be recalculated or no. + * + * @return self + */ + public function setRecalculateTiers($recalculateTiers) + { + if (is_null($recalculateTiers)) { + array_push($this->openAPINullablesSetToNull, 'recalculateTiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('recalculateTiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['recalculateTiers'] = $recalculateTiers; + + 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/LoyaltiesUpdateCampaignResponseBody.php b/src/Model/LoyaltiesUpdateCampaignResponseBody.php new file mode 100644 index 0000000..a334c8a --- /dev/null +++ b/src/Model/LoyaltiesUpdateCampaignResponseBody.php @@ -0,0 +1,1745 @@ + + */ +class LoyaltiesUpdateCampaignResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltiesUpdateCampaignResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'campaignType' => 'string', + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\LoyaltyCampaignVoucher', + 'autoJoin' => 'bool', + 'joinOnce' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'active' => 'bool', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'category' => 'string', + 'creationStatus' => 'string', + 'vouchersGenerationStatus' => 'string', + 'protected' => 'bool', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'object' => 'string', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'accessSettingsAssignments' => '\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'description' => null, + 'campaignType' => null, + 'type' => null, + 'voucher' => null, + 'autoJoin' => null, + 'joinOnce' => null, + 'useVoucherMetadataSchema' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'active' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'category' => null, + 'creationStatus' => null, + 'vouchersGenerationStatus' => null, + 'protected' => null, + 'categoryId' => null, + 'categories' => null, + 'object' => null, + 'loyaltyTiersExpiration' => null, + 'validationRulesAssignments' => null, + 'accessSettingsAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'description' => true, + 'campaignType' => true, + 'type' => true, + 'voucher' => false, + 'autoJoin' => true, + 'joinOnce' => true, + 'useVoucherMetadataSchema' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'active' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'category' => true, + 'creationStatus' => true, + 'vouchersGenerationStatus' => true, + 'protected' => true, + 'categoryId' => true, + 'categories' => true, + 'object' => true, + 'loyaltyTiersExpiration' => false, + 'validationRulesAssignments' => false, + 'accessSettingsAssignments' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'campaignType' => 'campaign_type', + 'type' => 'type', + 'voucher' => 'voucher', + 'autoJoin' => 'auto_join', + 'joinOnce' => 'join_once', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'active' => 'active', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'category' => 'category', + 'creationStatus' => 'creation_status', + 'vouchersGenerationStatus' => 'vouchers_generation_status', + 'protected' => 'protected', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'object' => 'object', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'accessSettingsAssignments' => 'access_settings_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'campaignType' => 'setCampaignType', + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'autoJoin' => 'setAutoJoin', + 'joinOnce' => 'setJoinOnce', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'category' => 'setCategory', + 'creationStatus' => 'setCreationStatus', + 'vouchersGenerationStatus' => 'setVouchersGenerationStatus', + 'protected' => 'setProtected', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'object' => 'setObject', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'accessSettingsAssignments' => 'setAccessSettingsAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'campaignType' => 'getCampaignType', + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'autoJoin' => 'getAutoJoin', + 'joinOnce' => 'getJoinOnce', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'category' => 'getCategory', + 'creationStatus' => 'getCreationStatus', + 'vouchersGenerationStatus' => 'getVouchersGenerationStatus', + 'protected' => 'getProtected', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'object' => 'getObject', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'accessSettingsAssignments' => 'getAccessSettingsAssignments' + ]; + + /** + * 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 CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CREATION_STATUS_DONE = 'DONE'; + public const CREATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const CREATION_STATUS_FAILED = 'FAILED'; + public const CREATION_STATUS_DRAFT = 'DRAFT'; + public const CREATION_STATUS_MODIFYING = 'MODIFYING'; + public const VOUCHERS_GENERATION_STATUS_DONE = 'DONE'; + public const VOUCHERS_GENERATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const VOUCHERS_GENERATION_STATUS_FAILED = 'FAILED'; + public const VOUCHERS_GENERATION_STATUS_DRAFT = 'DRAFT'; + public const VOUCHERS_GENERATION_STATUS_MODIFYING = 'MODIFYING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCreationStatusAllowableValues() + { + return [ + self::CREATION_STATUS_DONE, + self::CREATION_STATUS_IN_PROGRESS, + self::CREATION_STATUS_FAILED, + self::CREATION_STATUS_DRAFT, + self::CREATION_STATUS_MODIFYING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVouchersGenerationStatusAllowableValues() + { + return [ + self::VOUCHERS_GENERATION_STATUS_DONE, + self::VOUCHERS_GENERATION_STATUS_IN_PROGRESS, + self::VOUCHERS_GENERATION_STATUS_FAILED, + self::VOUCHERS_GENERATION_STATUS_DRAFT, + self::VOUCHERS_GENERATION_STATUS_MODIFYING, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], 'LOYALTY_PROGRAM'); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('creationStatus', $data ?? [], null); + $this->setIfExists('vouchersGenerationStatus', $data ?? [], null); + $this->setIfExists('protected', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('accessSettingsAssignments', $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->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($this->container['creationStatus']) && !in_array($this->container['creationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'creationStatus', must be one of '%s'", + $this->container['creationStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($this->container['vouchersGenerationStatus']) && !in_array($this->container['vouchersGenerationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $this->container['vouchersGenerationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\LoyaltyCampaignVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\LoyaltyCampaignVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign. + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Unique category name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets creationStatus + * + * @return string|null + */ + public function getCreationStatus() + { + return $this->container['creationStatus']; + } + + /** + * Sets creationStatus + * + * @param string|null $creationStatus Indicates the status of the campaign creation. + * + * @return self + */ + public function setCreationStatus($creationStatus) + { + if (is_null($creationStatus)) { + array_push($this->openAPINullablesSetToNull, 'creationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($creationStatus) && !in_array($creationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'creationStatus', must be one of '%s'", + $creationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['creationStatus'] = $creationStatus; + + return $this; + } + + /** + * Gets vouchersGenerationStatus + * + * @return string|null + */ + public function getVouchersGenerationStatus() + { + return $this->container['vouchersGenerationStatus']; + } + + /** + * Sets vouchersGenerationStatus + * + * @param string|null $vouchersGenerationStatus Indicates the status of the campaign's voucher generation. + * + * @return self + */ + public function setVouchersGenerationStatus($vouchersGenerationStatus) + { + if (is_null($vouchersGenerationStatus)) { + array_push($this->openAPINullablesSetToNull, 'vouchersGenerationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersGenerationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($vouchersGenerationStatus) && !in_array($vouchersGenerationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $vouchersGenerationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['vouchersGenerationStatus'] = $vouchersGenerationStatus; + + return $this; + } + + /** + * Gets protected + * + * @return bool|null + */ + public function getProtected() + { + return $this->container['protected']; + } + + /** + * Sets protected + * + * @param bool|null $protected Indicates whether the resource can be deleted. + * + * @return self + */ + public function setProtected($protected) + { + if (is_null($protected)) { + array_push($this->openAPINullablesSetToNull, 'protected'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('protected', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['protected'] = $protected; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets accessSettingsAssignments + * + * @return \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null + */ + public function getAccessSettingsAssignments() + { + return $this->container['accessSettingsAssignments']; + } + + /** + * Sets accessSettingsAssignments + * + * @param \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null $accessSettingsAssignments accessSettingsAssignments + * + * @return self + */ + public function setAccessSettingsAssignments($accessSettingsAssignments) + { + if (is_null($accessSettingsAssignments)) { + throw new \InvalidArgumentException('non-nullable accessSettingsAssignments cannot be null'); + } + $this->container['accessSettingsAssignments'] = $accessSettingsAssignments; + + 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/LoyaltyCampaign.php b/src/Model/LoyaltyCampaign.php new file mode 100644 index 0000000..18c60d0 --- /dev/null +++ b/src/Model/LoyaltyCampaign.php @@ -0,0 +1,1744 @@ + + */ +class LoyaltyCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'campaignType' => 'string', + 'type' => 'string', + 'voucher' => '\OpenAPI\Client\Model\LoyaltyCampaignVoucher', + 'autoJoin' => 'bool', + 'joinOnce' => 'bool', + 'useVoucherMetadataSchema' => 'bool', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'activityDurationAfterPublishing' => 'string', + 'vouchersCount' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'active' => 'bool', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'category' => 'string', + 'creationStatus' => 'string', + 'vouchersGenerationStatus' => 'string', + 'protected' => 'bool', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'object' => 'string', + 'loyaltyTiersExpiration' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAll', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'accessSettingsAssignments' => '\OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'description' => null, + 'campaignType' => null, + 'type' => null, + 'voucher' => null, + 'autoJoin' => null, + 'joinOnce' => null, + 'useVoucherMetadataSchema' => null, + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'activityDurationAfterPublishing' => null, + 'vouchersCount' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'active' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'category' => null, + 'creationStatus' => null, + 'vouchersGenerationStatus' => null, + 'protected' => null, + 'categoryId' => null, + 'categories' => null, + 'object' => null, + 'loyaltyTiersExpiration' => null, + 'validationRulesAssignments' => null, + 'accessSettingsAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'description' => true, + 'campaignType' => true, + 'type' => true, + 'voucher' => false, + 'autoJoin' => true, + 'joinOnce' => true, + 'useVoucherMetadataSchema' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'activityDurationAfterPublishing' => true, + 'vouchersCount' => true, + 'startDate' => true, + 'expirationDate' => true, + 'active' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'category' => true, + 'creationStatus' => true, + 'vouchersGenerationStatus' => true, + 'protected' => true, + 'categoryId' => true, + 'categories' => true, + 'object' => true, + 'loyaltyTiersExpiration' => false, + 'validationRulesAssignments' => false, + 'accessSettingsAssignments' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'campaignType' => 'campaign_type', + 'type' => 'type', + 'voucher' => 'voucher', + 'autoJoin' => 'auto_join', + 'joinOnce' => 'join_once', + 'useVoucherMetadataSchema' => 'use_voucher_metadata_schema', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'activityDurationAfterPublishing' => 'activity_duration_after_publishing', + 'vouchersCount' => 'vouchers_count', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'active' => 'active', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'category' => 'category', + 'creationStatus' => 'creation_status', + 'vouchersGenerationStatus' => 'vouchers_generation_status', + 'protected' => 'protected', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'object' => 'object', + 'loyaltyTiersExpiration' => 'loyalty_tiers_expiration', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'accessSettingsAssignments' => 'access_settings_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'description' => 'setDescription', + 'campaignType' => 'setCampaignType', + 'type' => 'setType', + 'voucher' => 'setVoucher', + 'autoJoin' => 'setAutoJoin', + 'joinOnce' => 'setJoinOnce', + 'useVoucherMetadataSchema' => 'setUseVoucherMetadataSchema', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'activityDurationAfterPublishing' => 'setActivityDurationAfterPublishing', + 'vouchersCount' => 'setVouchersCount', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'category' => 'setCategory', + 'creationStatus' => 'setCreationStatus', + 'vouchersGenerationStatus' => 'setVouchersGenerationStatus', + 'protected' => 'setProtected', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'object' => 'setObject', + 'loyaltyTiersExpiration' => 'setLoyaltyTiersExpiration', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'accessSettingsAssignments' => 'setAccessSettingsAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'description' => 'getDescription', + 'campaignType' => 'getCampaignType', + 'type' => 'getType', + 'voucher' => 'getVoucher', + 'autoJoin' => 'getAutoJoin', + 'joinOnce' => 'getJoinOnce', + 'useVoucherMetadataSchema' => 'getUseVoucherMetadataSchema', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'activityDurationAfterPublishing' => 'getActivityDurationAfterPublishing', + 'vouchersCount' => 'getVouchersCount', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'category' => 'getCategory', + 'creationStatus' => 'getCreationStatus', + 'vouchersGenerationStatus' => 'getVouchersGenerationStatus', + 'protected' => 'getProtected', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'object' => 'getObject', + 'loyaltyTiersExpiration' => 'getLoyaltyTiersExpiration', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'accessSettingsAssignments' => 'getAccessSettingsAssignments' + ]; + + /** + * 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 CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const TYPE__STATIC = 'STATIC'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const CREATION_STATUS_DONE = 'DONE'; + public const CREATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const CREATION_STATUS_FAILED = 'FAILED'; + public const CREATION_STATUS_DRAFT = 'DRAFT'; + public const CREATION_STATUS_MODIFYING = 'MODIFYING'; + public const VOUCHERS_GENERATION_STATUS_DONE = 'DONE'; + public const VOUCHERS_GENERATION_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const VOUCHERS_GENERATION_STATUS_FAILED = 'FAILED'; + public const VOUCHERS_GENERATION_STATUS_DRAFT = 'DRAFT'; + public const VOUCHERS_GENERATION_STATUS_MODIFYING = 'MODIFYING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCampaignTypeAllowableValues() + { + return [ + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getCreationStatusAllowableValues() + { + return [ + self::CREATION_STATUS_DONE, + self::CREATION_STATUS_IN_PROGRESS, + self::CREATION_STATUS_FAILED, + self::CREATION_STATUS_DRAFT, + self::CREATION_STATUS_MODIFYING, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVouchersGenerationStatusAllowableValues() + { + return [ + self::VOUCHERS_GENERATION_STATUS_DONE, + self::VOUCHERS_GENERATION_STATUS_IN_PROGRESS, + self::VOUCHERS_GENERATION_STATUS_FAILED, + self::VOUCHERS_GENERATION_STATUS_DRAFT, + self::VOUCHERS_GENERATION_STATUS_MODIFYING, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], 'LOYALTY_PROGRAM'); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('autoJoin', $data ?? [], null); + $this->setIfExists('joinOnce', $data ?? [], null); + $this->setIfExists('useVoucherMetadataSchema', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('activityDurationAfterPublishing', $data ?? [], null); + $this->setIfExists('vouchersCount', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('creationStatus', $data ?? [], null); + $this->setIfExists('vouchersGenerationStatus', $data ?? [], null); + $this->setIfExists('protected', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + $this->setIfExists('loyaltyTiersExpiration', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('accessSettingsAssignments', $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->getCampaignTypeAllowableValues(); + if (!is_null($this->container['campaignType']) && !in_array($this->container['campaignType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'campaignType', must be one of '%s'", + $this->container['campaignType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($this->container['creationStatus']) && !in_array($this->container['creationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'creationStatus', must be one of '%s'", + $this->container['creationStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($this->container['vouchersGenerationStatus']) && !in_array($this->container['vouchersGenerationStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $this->container['vouchersGenerationStatus'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Campaign name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An optional field to keep any extra textual information about the campaign such as a campaign description and details. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets campaignType + * + * @return string|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param string|null $campaignType Type of campaign. + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCampaignTypeAllowableValues(); + if (!is_null($campaignType) && !in_array($campaignType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'campaignType', must be one of '%s'", + $campaignType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\LoyaltyCampaignVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\LoyaltyCampaignVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets autoJoin + * + * @return bool|null + */ + public function getAutoJoin() + { + return $this->container['autoJoin']; + } + + /** + * Sets autoJoin + * + * @param bool|null $autoJoin Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. + * + * @return self + */ + public function setAutoJoin($autoJoin) + { + if (is_null($autoJoin)) { + array_push($this->openAPINullablesSetToNull, 'autoJoin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('autoJoin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['autoJoin'] = $autoJoin; + + return $this; + } + + /** + * Gets joinOnce + * + * @return bool|null + */ + public function getJoinOnce() + { + return $this->container['joinOnce']; + } + + /** + * Sets joinOnce + * + * @param bool|null $joinOnce If this value is set to `true`, customers will be able to join the campaign only once. + * + * @return self + */ + public function setJoinOnce($joinOnce) + { + if (is_null($joinOnce)) { + array_push($this->openAPINullablesSetToNull, 'joinOnce'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('joinOnce', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['joinOnce'] = $joinOnce; + + return $this; + } + + /** + * Gets useVoucherMetadataSchema + * + * @return bool|null + */ + public function getUseVoucherMetadataSchema() + { + return $this->container['useVoucherMetadataSchema']; + } + + /** + * Sets useVoucherMetadataSchema + * + * @param bool|null $useVoucherMetadataSchema Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. + * + * @return self + */ + public function setUseVoucherMetadataSchema($useVoucherMetadataSchema) + { + if (is_null($useVoucherMetadataSchema)) { + array_push($this->openAPINullablesSetToNull, 'useVoucherMetadataSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('useVoucherMetadataSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['useVoucherMetadataSchema'] = $useVoucherMetadataSchema; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets activityDurationAfterPublishing + * + * @return string|null + */ + public function getActivityDurationAfterPublishing() + { + return $this->container['activityDurationAfterPublishing']; + } + + /** + * Sets activityDurationAfterPublishing + * + * @param string|null $activityDurationAfterPublishing Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. + * + * @return self + */ + public function setActivityDurationAfterPublishing($activityDurationAfterPublishing) + { + if (is_null($activityDurationAfterPublishing)) { + array_push($this->openAPINullablesSetToNull, 'activityDurationAfterPublishing'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('activityDurationAfterPublishing', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['activityDurationAfterPublishing'] = $activityDurationAfterPublishing; + + return $this; + } + + /** + * Gets vouchersCount + * + * @return int|null + */ + public function getVouchersCount() + { + return $this->container['vouchersCount']; + } + + /** + * Sets vouchersCount + * + * @param int|null $vouchersCount Total number of unique vouchers in campaign. + * + * @return self + */ + public function setVouchersCount($vouchersCount) + { + if (is_null($vouchersCount)) { + array_push($this->openAPINullablesSetToNull, 'vouchersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersCount'] = $vouchersCount; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Unique category name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets creationStatus + * + * @return string|null + */ + public function getCreationStatus() + { + return $this->container['creationStatus']; + } + + /** + * Sets creationStatus + * + * @param string|null $creationStatus Indicates the status of the campaign creation. + * + * @return self + */ + public function setCreationStatus($creationStatus) + { + if (is_null($creationStatus)) { + array_push($this->openAPINullablesSetToNull, 'creationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('creationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getCreationStatusAllowableValues(); + if (!is_null($creationStatus) && !in_array($creationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'creationStatus', must be one of '%s'", + $creationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['creationStatus'] = $creationStatus; + + return $this; + } + + /** + * Gets vouchersGenerationStatus + * + * @return string|null + */ + public function getVouchersGenerationStatus() + { + return $this->container['vouchersGenerationStatus']; + } + + /** + * Sets vouchersGenerationStatus + * + * @param string|null $vouchersGenerationStatus Indicates the status of the campaign's voucher generation. + * + * @return self + */ + public function setVouchersGenerationStatus($vouchersGenerationStatus) + { + if (is_null($vouchersGenerationStatus)) { + array_push($this->openAPINullablesSetToNull, 'vouchersGenerationStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersGenerationStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getVouchersGenerationStatusAllowableValues(); + if (!is_null($vouchersGenerationStatus) && !in_array($vouchersGenerationStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'vouchersGenerationStatus', must be one of '%s'", + $vouchersGenerationStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['vouchersGenerationStatus'] = $vouchersGenerationStatus; + + return $this; + } + + /** + * Gets protected + * + * @return bool|null + */ + public function getProtected() + { + return $this->container['protected']; + } + + /** + * Sets protected + * + * @param bool|null $protected Indicates whether the resource can be deleted. + * + * @return self + */ + public function setProtected($protected) + { + if (is_null($protected)) { + array_push($this->openAPINullablesSetToNull, 'protected'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('protected', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['protected'] = $protected; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets loyaltyTiersExpiration + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null + */ + public function getLoyaltyTiersExpiration() + { + return $this->container['loyaltyTiersExpiration']; + } + + /** + * Sets loyaltyTiersExpiration + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAll|null $loyaltyTiersExpiration loyaltyTiersExpiration + * + * @return self + */ + public function setLoyaltyTiersExpiration($loyaltyTiersExpiration) + { + if (is_null($loyaltyTiersExpiration)) { + throw new \InvalidArgumentException('non-nullable loyaltyTiersExpiration cannot be null'); + } + $this->container['loyaltyTiersExpiration'] = $loyaltyTiersExpiration; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets accessSettingsAssignments + * + * @return \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null + */ + public function getAccessSettingsAssignments() + { + return $this->container['accessSettingsAssignments']; + } + + /** + * Sets accessSettingsAssignments + * + * @param \OpenAPI\Client\Model\AccessSettingsCampaignAssignmentsList|null $accessSettingsAssignments accessSettingsAssignments + * + * @return self + */ + public function setAccessSettingsAssignments($accessSettingsAssignments) + { + if (is_null($accessSettingsAssignments)) { + throw new \InvalidArgumentException('non-nullable accessSettingsAssignments cannot be null'); + } + $this->container['accessSettingsAssignments'] = $accessSettingsAssignments; + + 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/LoyaltyCampaignVoucher.php b/src/Model/LoyaltyCampaignVoucher.php new file mode 100644 index 0000000..a5325fd --- /dev/null +++ b/src/Model/LoyaltyCampaignVoucher.php @@ -0,0 +1,828 @@ + + */ +class LoyaltyCampaignVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCampaignVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'loyaltyCard' => '\OpenAPI\Client\Model\CampaignLoyaltyCard', + 'redemption' => '\OpenAPI\Client\Model\LoyaltyCampaignVoucherRedemption', + 'codeConfig' => '\OpenAPI\Client\Model\CodeConfig', + 'isReferralCode' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'loyaltyCard' => null, + 'redemption' => null, + 'codeConfig' => null, + 'isReferralCode' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'loyaltyCard' => false, + 'redemption' => true, + 'codeConfig' => false, + 'isReferralCode' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => 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 = [ + 'type' => 'type', + 'loyaltyCard' => 'loyalty_card', + 'redemption' => 'redemption', + 'codeConfig' => 'code_config', + 'isReferralCode' => 'is_referral_code', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'loyaltyCard' => 'setLoyaltyCard', + 'redemption' => 'setRedemption', + 'codeConfig' => 'setCodeConfig', + 'isReferralCode' => 'setIsReferralCode', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'loyaltyCard' => 'getLoyaltyCard', + 'redemption' => 'getRedemption', + 'codeConfig' => 'getCodeConfig', + 'isReferralCode' => 'getIsReferralCode', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('type', $data ?? [], 'LOYALTY_CARD'); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('codeConfig', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['codeConfig'] === null) { + $invalidProperties[] = "'codeConfig' can't be null"; + } + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\CampaignLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\CampaignLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\LoyaltyCampaignVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\LoyaltyCampaignVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets codeConfig + * + * @return \OpenAPI\Client\Model\CodeConfig + */ + public function getCodeConfig() + { + return $this->container['codeConfig']; + } + + /** + * Sets codeConfig + * + * @param \OpenAPI\Client\Model\CodeConfig $codeConfig codeConfig + * + * @return self + */ + public function setCodeConfig($codeConfig) + { + if (is_null($codeConfig)) { + throw new \InvalidArgumentException('non-nullable codeConfig cannot be null'); + } + $this->container['codeConfig'] = $codeConfig; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Always `false` for a loyalty card voucher + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + 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/LoyaltyCampaignVoucherRedemption.php b/src/Model/LoyaltyCampaignVoucherRedemption.php new file mode 100644 index 0000000..38d38a7 --- /dev/null +++ b/src/Model/LoyaltyCampaignVoucherRedemption.php @@ -0,0 +1,418 @@ + + */ +class LoyaltyCampaignVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCampaignVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/LoyaltyCardTransaction.php b/src/Model/LoyaltyCardTransaction.php new file mode 100644 index 0000000..bf1eeaf --- /dev/null +++ b/src/Model/LoyaltyCardTransaction.php @@ -0,0 +1,832 @@ + + */ +class LoyaltyCardTransaction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'voucherId' => 'string', + 'campaignId' => 'string', + 'source' => 'string', + 'reason' => 'string', + 'type' => 'string', + 'details' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetails', + 'relatedTransactionId' => 'string', + 'createdAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'voucherId' => null, + 'campaignId' => null, + 'source' => null, + 'reason' => null, + 'type' => null, + 'details' => null, + 'relatedTransactionId' => null, + 'createdAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'voucherId' => true, + 'campaignId' => true, + 'source' => true, + 'reason' => true, + 'type' => true, + 'details' => true, + 'relatedTransactionId' => true, + 'createdAt' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'voucherId' => 'voucher_id', + 'campaignId' => 'campaign_id', + 'source' => 'source', + 'reason' => 'reason', + 'type' => 'type', + 'details' => 'details', + 'relatedTransactionId' => 'related_transaction_id', + 'createdAt' => 'created_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'voucherId' => 'setVoucherId', + 'campaignId' => 'setCampaignId', + 'source' => 'setSource', + 'reason' => 'setReason', + 'type' => 'setType', + 'details' => 'setDetails', + 'relatedTransactionId' => 'setRelatedTransactionId', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'voucherId' => 'getVoucherId', + 'campaignId' => 'getCampaignId', + 'source' => 'getSource', + 'reason' => 'getReason', + 'type' => 'getType', + 'details' => 'getDetails', + 'relatedTransactionId' => 'getRelatedTransactionId', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * 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 TYPE_ACCRUAL = 'POINTS_ACCRUAL'; + public const TYPE_REDEMPTION = 'POINTS_REDEMPTION'; + public const TYPE_REFUND = 'POINTS_REFUND'; + public const TYPE_ADDITION = 'POINTS_ADDITION'; + public const TYPE_REMOVAL = 'POINTS_REMOVAL'; + public const TYPE_EXPIRATION = 'POINTS_EXPIRATION'; + public const TYPE_TRANSFER_IN = 'POINTS_TRANSFER_IN'; + public const TYPE_TRANSFER_OUT = 'POINTS_TRANSFER_OUT'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_ACCRUAL, + self::TYPE_REDEMPTION, + self::TYPE_REFUND, + self::TYPE_ADDITION, + self::TYPE_REMOVAL, + self::TYPE_EXPIRATION, + self::TYPE_TRANSFER_IN, + self::TYPE_TRANSFER_OUT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + $this->setIfExists('relatedTransactionId', $data ?? [], null); + $this->setIfExists('createdAt', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique transaction ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets voucherId + * + * @return string|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param string|null $voucherId Unique voucher ID. + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + array_push($this->openAPINullablesSetToNull, 'voucherId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets source + * + * @return string|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string|null $source The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason Reason why the transaction occurred. In case of a redemption, this value is null. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets details + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetails|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetails|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + array_push($this->openAPINullablesSetToNull, 'details'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('details', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['details'] = $details; + + return $this; + } + + /** + * Gets relatedTransactionId + * + * @return string|null + */ + public function getRelatedTransactionId() + { + return $this->container['relatedTransactionId']; + } + + /** + * Sets relatedTransactionId + * + * @param string|null $relatedTransactionId The related transaction ID on the receiving card. + * + * @return self + */ + public function setRelatedTransactionId($relatedTransactionId) + { + if (is_null($relatedTransactionId)) { + array_push($this->openAPINullablesSetToNull, 'relatedTransactionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedTransactionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedTransactionId'] = $relatedTransactionId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + 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/LoyaltyCardTransactionDetails.php b/src/Model/LoyaltyCardTransactionDetails.php new file mode 100644 index 0000000..5049522 --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetails.php @@ -0,0 +1,896 @@ + + */ +class LoyaltyCardTransactionDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'balance' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsBalance', + 'order' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsOrder', + 'event' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEvent', + 'earningRule' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEarningRule', + 'segment' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsSegment', + 'loyaltyTier' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsLoyaltyTier', + 'redemption' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsRedemption', + 'rollback' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsRollback', + 'customEvent' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsCustomEvent', + 'eventSchema' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEventSchema', + 'reward' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsReward', + 'sourceVoucher' => '\OpenAPI\Client\Model\SimpleVoucher', + 'destinationVoucher' => '\OpenAPI\Client\Model\SimpleVoucher' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'balance' => null, + 'order' => null, + 'event' => null, + 'earningRule' => null, + 'segment' => null, + 'loyaltyTier' => null, + 'redemption' => null, + 'rollback' => null, + 'customEvent' => null, + 'eventSchema' => null, + 'reward' => null, + 'sourceVoucher' => null, + 'destinationVoucher' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'balance' => true, + 'order' => true, + 'event' => true, + 'earningRule' => true, + 'segment' => true, + 'loyaltyTier' => true, + 'redemption' => true, + 'rollback' => true, + 'customEvent' => true, + 'eventSchema' => true, + 'reward' => true, + 'sourceVoucher' => false, + 'destinationVoucher' => 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 = [ + 'balance' => 'balance', + 'order' => 'order', + 'event' => 'event', + 'earningRule' => 'earning_rule', + 'segment' => 'segment', + 'loyaltyTier' => 'loyalty_tier', + 'redemption' => 'redemption', + 'rollback' => 'rollback', + 'customEvent' => 'custom_event', + 'eventSchema' => 'event_schema', + 'reward' => 'reward', + 'sourceVoucher' => 'source_voucher', + 'destinationVoucher' => 'destination_voucher' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'balance' => 'setBalance', + 'order' => 'setOrder', + 'event' => 'setEvent', + 'earningRule' => 'setEarningRule', + 'segment' => 'setSegment', + 'loyaltyTier' => 'setLoyaltyTier', + 'redemption' => 'setRedemption', + 'rollback' => 'setRollback', + 'customEvent' => 'setCustomEvent', + 'eventSchema' => 'setEventSchema', + 'reward' => 'setReward', + 'sourceVoucher' => 'setSourceVoucher', + 'destinationVoucher' => 'setDestinationVoucher' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'balance' => 'getBalance', + 'order' => 'getOrder', + 'event' => 'getEvent', + 'earningRule' => 'getEarningRule', + 'segment' => 'getSegment', + 'loyaltyTier' => 'getLoyaltyTier', + 'redemption' => 'getRedemption', + 'rollback' => 'getRollback', + 'customEvent' => 'getCustomEvent', + 'eventSchema' => 'getEventSchema', + 'reward' => 'getReward', + 'sourceVoucher' => 'getSourceVoucher', + 'destinationVoucher' => 'getDestinationVoucher' + ]; + + /** + * 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('balance', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('earningRule', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('rollback', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('eventSchema', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('sourceVoucher', $data ?? [], null); + $this->setIfExists('destinationVoucher', $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 balance + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsBalance|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsBalance|null $balance balance + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets event + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEvent|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEvent|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets earningRule + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEarningRule|null + */ + public function getEarningRule() + { + return $this->container['earningRule']; + } + + /** + * Sets earningRule + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEarningRule|null $earningRule earningRule + * + * @return self + */ + public function setEarningRule($earningRule) + { + if (is_null($earningRule)) { + array_push($this->openAPINullablesSetToNull, 'earningRule'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('earningRule', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['earningRule'] = $earningRule; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsSegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsSegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets rollback + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsRollback|null + */ + public function getRollback() + { + return $this->container['rollback']; + } + + /** + * Sets rollback + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsRollback|null $rollback rollback + * + * @return self + */ + public function setRollback($rollback) + { + if (is_null($rollback)) { + array_push($this->openAPINullablesSetToNull, 'rollback'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollback', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollback'] = $rollback; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets eventSchema + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEventSchema|null + */ + public function getEventSchema() + { + return $this->container['eventSchema']; + } + + /** + * Sets eventSchema + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEventSchema|null $eventSchema eventSchema + * + * @return self + */ + public function setEventSchema($eventSchema) + { + if (is_null($eventSchema)) { + array_push($this->openAPINullablesSetToNull, 'eventSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('eventSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['eventSchema'] = $eventSchema; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsReward|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsReward|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + array_push($this->openAPINullablesSetToNull, 'reward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets sourceVoucher + * + * @return \OpenAPI\Client\Model\SimpleVoucher|null + */ + public function getSourceVoucher() + { + return $this->container['sourceVoucher']; + } + + /** + * Sets sourceVoucher + * + * @param \OpenAPI\Client\Model\SimpleVoucher|null $sourceVoucher sourceVoucher + * + * @return self + */ + public function setSourceVoucher($sourceVoucher) + { + if (is_null($sourceVoucher)) { + throw new \InvalidArgumentException('non-nullable sourceVoucher cannot be null'); + } + $this->container['sourceVoucher'] = $sourceVoucher; + + return $this; + } + + /** + * Gets destinationVoucher + * + * @return \OpenAPI\Client\Model\SimpleVoucher|null + */ + public function getDestinationVoucher() + { + return $this->container['destinationVoucher']; + } + + /** + * Sets destinationVoucher + * + * @param \OpenAPI\Client\Model\SimpleVoucher|null $destinationVoucher destinationVoucher + * + * @return self + */ + public function setDestinationVoucher($destinationVoucher) + { + if (is_null($destinationVoucher)) { + throw new \InvalidArgumentException('non-nullable destinationVoucher cannot be null'); + } + $this->container['destinationVoucher'] = $destinationVoucher; + + 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/LoyaltyCardTransactionDetailsBalance.php b/src/Model/LoyaltyCardTransactionDetailsBalance.php new file mode 100644 index 0000000..6280737 --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsBalance.php @@ -0,0 +1,705 @@ + + */ +class LoyaltyCardTransactionDetailsBalance implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsBalance'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'total' => 'int', + 'object' => 'string', + 'points' => 'int', + 'balance' => 'int', + 'relatedObject' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsBalanceRelatedObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'total' => null, + 'object' => null, + 'points' => null, + 'balance' => null, + 'relatedObject' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'total' => true, + 'object' => true, + 'points' => true, + 'balance' => true, + 'relatedObject' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'total' => 'total', + 'object' => 'object', + 'points' => 'points', + 'balance' => 'balance', + 'relatedObject' => 'related_object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'total' => 'setTotal', + 'object' => 'setObject', + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'relatedObject' => 'setRelatedObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'total' => 'getTotal', + 'object' => 'getObject', + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'relatedObject' => 'getRelatedObject' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'loyalty_card'; + public const OBJECT_BALANCE = 'balance'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_BALANCE, + ]; + } + + /** + * 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('type', $data ?? [], 'loyalty_card'); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'balance'); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('relatedObject', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['type']) && !preg_match("/loyalty_card/", $this->container['type'])) { + $invalidProperties[] = "invalid value for 'type', must be conform to the pattern /loyalty_card/."; + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['object']) && !preg_match("/balance/", $this->container['object'])) { + $invalidProperties[] = "invalid value for 'object', must be conform to the pattern /balance/."; + } + + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of voucher whose balance is being adjusted due to the transaction. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($type) && (!preg_match("/loyalty_card/", $type))) { + throw new \InvalidArgumentException("invalid value for \$type when calling LoyaltyCardTransactionDetailsBalance., must conform to the pattern /loyalty_card/."); + } + + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total The number of all points accumulated on the card as affected by add or subtract operations. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($object) && (!preg_match("/balance/", $object))) { + throw new \InvalidArgumentException("invalid value for \$object when calling LoyaltyCardTransactionDetailsBalance., must conform to the pattern /balance/."); + } + + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Points added or subtracted in the transaction. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance The available points on the card after the transaction as affected by redemption or rollback. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets relatedObject + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsBalanceRelatedObject|null + */ + public function getRelatedObject() + { + return $this->container['relatedObject']; + } + + /** + * Sets relatedObject + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsBalanceRelatedObject|null $relatedObject relatedObject + * + * @return self + */ + public function setRelatedObject($relatedObject) + { + if (is_null($relatedObject)) { + array_push($this->openAPINullablesSetToNull, 'relatedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObject'] = $relatedObject; + + 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/LoyaltyCardTransactionDetailsBalanceRelatedObject.php b/src/Model/LoyaltyCardTransactionDetailsBalanceRelatedObject.php new file mode 100644 index 0000000..94e6aea --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsBalanceRelatedObject.php @@ -0,0 +1,500 @@ + + */ +class LoyaltyCardTransactionDetailsBalanceRelatedObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsBalanceRelatedObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType' + ]; + + /** + * 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 TYPE_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_VOUCHER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'voucher'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['type']) && !preg_match("/voucher/", $this->container['type'])) { + $invalidProperties[] = "invalid value for 'type', must be conform to the pattern /voucher/."; + } + + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The object being modified, i.e. voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($type) && (!preg_match("/voucher/", $type))) { + throw new \InvalidArgumentException("invalid value for \$type when calling LoyaltyCardTransactionDetailsBalanceRelatedObject., must conform to the pattern /voucher/."); + } + + $this->container['type'] = $type; + + 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/LoyaltyCardTransactionDetailsCustomEvent.php b/src/Model/LoyaltyCardTransactionDetailsCustomEvent.php new file mode 100644 index 0000000..27096b7 --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsCustomEvent.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyCardTransactionDetailsCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique event ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of custom event. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + 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/LoyaltyCardTransactionDetailsEarningRule.php b/src/Model/LoyaltyCardTransactionDetailsEarningRule.php new file mode 100644 index 0000000..cbcf201 --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsEarningRule.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyCardTransactionDetailsEarningRule implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsEarningRule'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'source' => '\OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEarningRuleSource' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'source' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'source' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'source' => 'source' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'source' => 'setSource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'source' => 'getSource' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('source', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique earning rule ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEarningRuleSource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\LoyaltyCardTransactionDetailsEarningRuleSource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + 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/LoyaltyCardTransactionDetailsEarningRuleSource.php b/src/Model/LoyaltyCardTransactionDetailsEarningRuleSource.php new file mode 100644 index 0000000..eac7e7e --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsEarningRuleSource.php @@ -0,0 +1,418 @@ + + */ +class LoyaltyCardTransactionDetailsEarningRuleSource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsEarningRuleSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner' + ]; + + /** + * 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('banner', $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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + 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/LoyaltyCardTransactionDetailsEvent.php b/src/Model/LoyaltyCardTransactionDetailsEvent.php new file mode 100644 index 0000000..4fd3607 --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsEvent.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyCardTransactionDetailsEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique event ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of event. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + 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/LoyaltyCardTransactionDetailsEventSchema.php b/src/Model/LoyaltyCardTransactionDetailsEventSchema.php new file mode 100644 index 0000000..dcdbb1e --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsEventSchema.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyCardTransactionDetailsEventSchema implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsEventSchema'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique metadata schema ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Type of custom event. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/LoyaltyCardTransactionDetailsLoyaltyTier.php b/src/Model/LoyaltyCardTransactionDetailsLoyaltyTier.php new file mode 100644 index 0000000..e1361db --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsLoyaltyTier.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyCardTransactionDetailsLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/LoyaltyCardTransactionDetailsOrder.php b/src/Model/LoyaltyCardTransactionDetailsOrder.php new file mode 100644 index 0000000..79f3cca --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsOrder.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyCardTransactionDetailsOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique order ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + 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/LoyaltyCardTransactionDetailsRedemption.php b/src/Model/LoyaltyCardTransactionDetailsRedemption.php new file mode 100644 index 0000000..56598f1 --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsRedemption.php @@ -0,0 +1,418 @@ + + */ +class LoyaltyCardTransactionDetailsRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltyCardTransactionDetailsReward.php b/src/Model/LoyaltyCardTransactionDetailsReward.php new file mode 100644 index 0000000..d816e3b --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsReward.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyCardTransactionDetailsReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Reward name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/LoyaltyCardTransactionDetailsRollback.php b/src/Model/LoyaltyCardTransactionDetailsRollback.php new file mode 100644 index 0000000..2c122ab --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsRollback.php @@ -0,0 +1,418 @@ + + */ +class LoyaltyCardTransactionDetailsRollback implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsRollback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption rollback ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/LoyaltyCardTransactionDetailsSegment.php b/src/Model/LoyaltyCardTransactionDetailsSegment.php new file mode 100644 index 0000000..10422d7 --- /dev/null +++ b/src/Model/LoyaltyCardTransactionDetailsSegment.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyCardTransactionDetailsSegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyCardTransactionDetailsSegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/LoyaltyMember.php b/src/Model/LoyaltyMember.php new file mode 100644 index 0000000..21cc808 --- /dev/null +++ b/src/Model/LoyaltyMember.php @@ -0,0 +1,1488 @@ + + */ +class LoyaltyMember implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyMember'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => 'object', + 'gift' => 'object', + 'loyaltyCard' => '\OpenAPI\Client\Model\LoyaltyMemberLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\LoyaltyMemberPublish', + 'redemption' => '\OpenAPI\Client\Model\LoyaltyMemberRedemption' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => true, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'LOYALTY_CARD'); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return object|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param object|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + array_push($this->openAPINullablesSetToNull, 'discount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return object|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param object|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\LoyaltyMemberLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\LoyaltyMemberLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode This is always false for loyalty members. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique identifier of the customer who owns the voucher. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\LoyaltyMemberPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\LoyaltyMemberPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\LoyaltyMemberRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\LoyaltyMemberRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + 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/LoyaltyMemberLoyaltyCard.php b/src/Model/LoyaltyMemberLoyaltyCard.php new file mode 100644 index 0000000..b9c4266 --- /dev/null +++ b/src/Model/LoyaltyMemberLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class LoyaltyMemberLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyMemberLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/LoyaltyMemberPublish.php b/src/Model/LoyaltyMemberPublish.php new file mode 100644 index 0000000..dd4a06a --- /dev/null +++ b/src/Model/LoyaltyMemberPublish.php @@ -0,0 +1,500 @@ + + */ +class LoyaltyMemberPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyMemberPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication event counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltyMemberRedemption.php b/src/Model/LoyaltyMemberRedemption.php new file mode 100644 index 0000000..389831f --- /dev/null +++ b/src/Model/LoyaltyMemberRedemption.php @@ -0,0 +1,582 @@ + + */ +class LoyaltyMemberRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyMemberRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/LoyaltyTier.php b/src/Model/LoyaltyTier.php new file mode 100644 index 0000000..e7cdc7c --- /dev/null +++ b/src/Model/LoyaltyTier.php @@ -0,0 +1,893 @@ + + */ +class LoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'earningRules' => 'array', + 'rewards' => 'array', + 'points' => '\OpenAPI\Client\Model\LoyaltyTierPoints', + 'id' => 'string', + 'campaignId' => 'string', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'config' => '\OpenAPI\Client\Model\LoyaltyTierConfig', + 'expiration' => '\OpenAPI\Client\Model\LoyaltyTierExpiration', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'earningRules' => null, + 'rewards' => null, + 'points' => null, + 'id' => null, + 'campaignId' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'config' => null, + 'expiration' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'earningRules' => true, + 'rewards' => true, + 'points' => true, + 'id' => true, + 'campaignId' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'config' => true, + 'expiration' => false, + 'object' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'earningRules' => 'earning_rules', + 'rewards' => 'rewards', + 'points' => 'points', + 'id' => 'id', + 'campaignId' => 'campaign_id', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'config' => 'config', + 'expiration' => 'expiration', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'earningRules' => 'setEarningRules', + 'rewards' => 'setRewards', + 'points' => 'setPoints', + 'id' => 'setId', + 'campaignId' => 'setCampaignId', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'config' => 'setConfig', + 'expiration' => 'setExpiration', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'earningRules' => 'getEarningRules', + 'rewards' => 'getRewards', + 'points' => 'getPoints', + 'id' => 'getId', + 'campaignId' => 'getCampaignId', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'config' => 'getConfig', + 'expiration' => 'getExpiration', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_LOYALTY_TIER = 'loyalty_tier'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_LOYALTY_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('name', $data ?? [], null); + $this->setIfExists('earningRules', $data ?? [], null); + $this->setIfExists('rewards', $data ?? [], null); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('config', $data ?? [], null); + $this->setIfExists('expiration', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'loyalty_tier'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Loyalty Tier name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets earningRules + * + * @return array|null + */ + public function getEarningRules() + { + return $this->container['earningRules']; + } + + /** + * Sets earningRules + * + * @param array|null $earningRules Contains a list of earning rule IDs and their points mapping for the given earning rule. + * + * @return self + */ + public function setEarningRules($earningRules) + { + if (is_null($earningRules)) { + array_push($this->openAPINullablesSetToNull, 'earningRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('earningRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['earningRules'] = $earningRules; + + return $this; + } + + /** + * Gets rewards + * + * @return array|null + */ + public function getRewards() + { + return $this->container['rewards']; + } + + /** + * Sets rewards + * + * @param array|null $rewards Contains a list of reward IDs and their points mapping for the given reward. + * + * @return self + */ + public function setRewards($rewards) + { + if (is_null($rewards)) { + array_push($this->openAPINullablesSetToNull, 'rewards'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewards', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewards'] = $rewards; + + return $this; + } + + /** + * Gets points + * + * @return \OpenAPI\Client\Model\LoyaltyTierPoints|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param \OpenAPI\Client\Model\LoyaltyTierPoints|null $points points + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique loyalty tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Unique parent campaign ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets config + * + * @return \OpenAPI\Client\Model\LoyaltyTierConfig|null + */ + public function getConfig() + { + return $this->container['config']; + } + + /** + * Sets config + * + * @param \OpenAPI\Client\Model\LoyaltyTierConfig|null $config config + * + * @return self + */ + public function setConfig($config) + { + if (is_null($config)) { + array_push($this->openAPINullablesSetToNull, 'config'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('config', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['config'] = $config; + + return $this; + } + + /** + * Gets expiration + * + * @return \OpenAPI\Client\Model\LoyaltyTierExpiration|null + */ + public function getExpiration() + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param \OpenAPI\Client\Model\LoyaltyTierExpiration|null $expiration expiration + * + * @return self + */ + public function setExpiration($expiration) + { + if (is_null($expiration)) { + throw new \InvalidArgumentException('non-nullable expiration cannot be null'); + } + $this->container['expiration'] = $expiration; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the loyalty. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/LoyaltyTierBase.php b/src/Model/LoyaltyTierBase.php new file mode 100644 index 0000000..e976602 --- /dev/null +++ b/src/Model/LoyaltyTierBase.php @@ -0,0 +1,540 @@ + + */ +class LoyaltyTierBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTierBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'earningRules' => 'array', + 'rewards' => 'array', + 'points' => '\OpenAPI\Client\Model\LoyaltyTierBasePoints' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'earningRules' => null, + 'rewards' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'earningRules' => true, + 'rewards' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'earningRules' => 'earning_rules', + 'rewards' => 'rewards', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'earningRules' => 'setEarningRules', + 'rewards' => 'setRewards', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'earningRules' => 'getEarningRules', + 'rewards' => 'getRewards', + 'points' => 'getPoints' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('earningRules', $data ?? [], null); + $this->setIfExists('rewards', $data ?? [], null); + $this->setIfExists('points', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Loyalty Tier name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets earningRules + * + * @return array|null + */ + public function getEarningRules() + { + return $this->container['earningRules']; + } + + /** + * Sets earningRules + * + * @param array|null $earningRules Contains a list of earning rule IDs and their points mapping for the given earning rule. + * + * @return self + */ + public function setEarningRules($earningRules) + { + if (is_null($earningRules)) { + array_push($this->openAPINullablesSetToNull, 'earningRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('earningRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['earningRules'] = $earningRules; + + return $this; + } + + /** + * Gets rewards + * + * @return array|null + */ + public function getRewards() + { + return $this->container['rewards']; + } + + /** + * Sets rewards + * + * @param array|null $rewards Contains a list of reward IDs and their points mapping for the given reward. + * + * @return self + */ + public function setRewards($rewards) + { + if (is_null($rewards)) { + array_push($this->openAPINullablesSetToNull, 'rewards'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewards', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewards'] = $rewards; + + return $this; + } + + /** + * Gets points + * + * @return \OpenAPI\Client\Model\LoyaltyTierBasePoints|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param \OpenAPI\Client\Model\LoyaltyTierBasePoints|null $points points + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltyTierBasePoints.php b/src/Model/LoyaltyTierBasePoints.php new file mode 100644 index 0000000..72e085f --- /dev/null +++ b/src/Model/LoyaltyTierBasePoints.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyTierBasePoints implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTierBasePoints'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => 'int', + 'to' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from' => true, + 'to' => true + ]; + + /** + * 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 = [ + 'from' => 'from', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'to' => 'getTo' + ]; + + /** + * 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('from', $data ?? [], null); + $this->setIfExists('to', $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 from + * + * @return int|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param int|null $from Bottom points threshold value. + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return int|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param int|null $to Top points threshold value. + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['to'] = $to; + + 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/LoyaltyTierConfig.php b/src/Model/LoyaltyTierConfig.php new file mode 100644 index 0000000..fefddb2 --- /dev/null +++ b/src/Model/LoyaltyTierConfig.php @@ -0,0 +1,418 @@ + + */ +class LoyaltyTierConfig implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTierConfig'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => '\OpenAPI\Client\Model\LoyaltyTierConfigPoints' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return \OpenAPI\Client\Model\LoyaltyTierConfigPoints|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param \OpenAPI\Client\Model\LoyaltyTierConfigPoints|null $points points + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/LoyaltyTierConfigPoints.php b/src/Model/LoyaltyTierConfigPoints.php new file mode 100644 index 0000000..97b00ab --- /dev/null +++ b/src/Model/LoyaltyTierConfigPoints.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyTierConfigPoints implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTierConfigPoints'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => 'int', + 'to' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from' => true, + 'to' => true + ]; + + /** + * 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 = [ + 'from' => 'from', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'to' => 'getTo' + ]; + + /** + * 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('from', $data ?? [], null); + $this->setIfExists('to', $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 from + * + * @return int|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param int|null $from Bottom points threshold value. + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return int|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param int|null $to Top points threshold value. + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['to'] = $to; + + 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/LoyaltyTierExpiration.php b/src/Model/LoyaltyTierExpiration.php new file mode 100644 index 0000000..172cd93 --- /dev/null +++ b/src/Model/LoyaltyTierExpiration.php @@ -0,0 +1,664 @@ + + */ +class LoyaltyTierExpiration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTierExpiration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customerId' => 'string', + 'campaignId' => 'string', + 'tierId' => 'string', + 'startDate' => 'string', + 'expirationDate' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customerId' => null, + 'campaignId' => null, + 'tierId' => null, + 'startDate' => null, + 'expirationDate' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customerId' => true, + 'campaignId' => true, + 'tierId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'createdAt' => true, + 'updatedAt' => true + ]; + + /** + * 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 = [ + 'customerId' => 'customer_id', + 'campaignId' => 'campaign_id', + 'tierId' => 'tier_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customerId' => 'setCustomerId', + 'campaignId' => 'setCampaignId', + 'tierId' => 'setTierId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customerId' => 'getCustomerId', + 'campaignId' => 'getCampaignId', + 'tierId' => 'getTierId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * 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('customerId', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('tierId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $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 customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer making the purchase. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets tierId + * + * @return string|null + */ + public function getTierId() + { + return $this->container['tierId']; + } + + /** + * Sets tierId + * + * @param string|null $tierId Unique tier ID, assigned by Voucherify. + * + * @return self + */ + public function setTierId($tierId) + { + if (is_null($tierId)) { + array_push($this->openAPINullablesSetToNull, 'tierId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tierId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tierId'] = $tierId; + + return $this; + } + + /** + * Gets startDate + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param string|null $startDate Activation timestamp defines when the loyalty tier starts to be active in ISO 8601 format. Loyalty tier is inactive before this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return string|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param string|null $expirationDate Expiration timestamp defines when the loyalty tier expires in ISO 8601 format. Loyalty tier is inactive after this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + 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/LoyaltyTierPoints.php b/src/Model/LoyaltyTierPoints.php new file mode 100644 index 0000000..a144a8f --- /dev/null +++ b/src/Model/LoyaltyTierPoints.php @@ -0,0 +1,459 @@ + + */ +class LoyaltyTierPoints implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTierPoints'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => 'int', + 'to' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from' => true, + 'to' => true + ]; + + /** + * 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 = [ + 'from' => 'from', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'to' => 'getTo' + ]; + + /** + * 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('from', $data ?? [], null); + $this->setIfExists('to', $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 from + * + * @return int|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param int|null $from Bottom points threshold value. + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return int|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param int|null $to Top points threshold value. + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['to'] = $to; + + 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/LoyaltyTiersExpirationAll.php b/src/Model/LoyaltyTiersExpirationAll.php new file mode 100644 index 0000000..84caeeb --- /dev/null +++ b/src/Model/LoyaltyTiersExpirationAll.php @@ -0,0 +1,613 @@ + + */ +class LoyaltyTiersExpirationAll implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTiersExpirationAll'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'qualificationType' => 'string', + 'qualificationPeriod' => 'string', + 'startDate' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAllStartDate', + 'expirationDate' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAllExpirationDate' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'qualificationType' => null, + 'qualificationPeriod' => null, + 'startDate' => null, + 'expirationDate' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'qualificationType' => true, + 'qualificationPeriod' => true, + 'startDate' => true, + 'expirationDate' => true + ]; + + /** + * 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 = [ + 'qualificationType' => 'qualification_type', + 'qualificationPeriod' => 'qualification_period', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'qualificationType' => 'setQualificationType', + 'qualificationPeriod' => 'setQualificationPeriod', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'qualificationType' => 'getQualificationType', + 'qualificationPeriod' => 'getQualificationPeriod', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate' + ]; + + /** + * 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 QUALIFICATION_TYPE_BALANCE = 'BALANCE'; + public const QUALIFICATION_TYPE_POINTS_IN_PERIOD = 'POINTS_IN_PERIOD'; + public const QUALIFICATION_PERIOD_MONTH = 'MONTH'; + public const QUALIFICATION_PERIOD_QUARTER = 'QUARTER'; + public const QUALIFICATION_PERIOD_HALF_YEAR = 'HALF_YEAR'; + public const QUALIFICATION_PERIOD_YEAR = 'YEAR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQualificationTypeAllowableValues() + { + return [ + self::QUALIFICATION_TYPE_BALANCE, + self::QUALIFICATION_TYPE_POINTS_IN_PERIOD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQualificationPeriodAllowableValues() + { + return [ + self::QUALIFICATION_PERIOD_MONTH, + self::QUALIFICATION_PERIOD_QUARTER, + self::QUALIFICATION_PERIOD_HALF_YEAR, + self::QUALIFICATION_PERIOD_YEAR, + ]; + } + + /** + * 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('qualificationType', $data ?? [], null); + $this->setIfExists('qualificationPeriod', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $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->getQualificationTypeAllowableValues(); + if (!is_null($this->container['qualificationType']) && !in_array($this->container['qualificationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'qualificationType', must be one of '%s'", + $this->container['qualificationType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getQualificationPeriodAllowableValues(); + if (!is_null($this->container['qualificationPeriod']) && !in_array($this->container['qualificationPeriod'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'qualificationPeriod', must be one of '%s'", + $this->container['qualificationPeriod'], + 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 qualificationType + * + * @return string|null + */ + public function getQualificationType() + { + return $this->container['qualificationType']; + } + + /** + * Sets qualificationType + * + * @param string|null $qualificationType Tier qualification. `BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier. `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold. + * + * @return self + */ + public function setQualificationType($qualificationType) + { + if (is_null($qualificationType)) { + array_push($this->openAPINullablesSetToNull, 'qualificationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qualificationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getQualificationTypeAllowableValues(); + if (!is_null($qualificationType) && !in_array($qualificationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'qualificationType', must be one of '%s'", + $qualificationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['qualificationType'] = $qualificationType; + + return $this; + } + + /** + * Gets qualificationPeriod + * + * @return string|null + */ + public function getQualificationPeriod() + { + return $this->container['qualificationPeriod']; + } + + /** + * Sets qualificationPeriod + * + * @param string|null $qualificationPeriod Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. | **Period** | **Definition** | |:---|:---| | **Calendar Month** | Points collected in one calendar month
January, February, March, etc. | | **Calendar Quarter** | Points collected in the quarter
- January - March
- April - June
- July - September
- October - December | | **Calendar Half-year** | Points collected in the half-year
- January - June
- July - December | | **Calendar Year** | Points collected in one calendar year
January - December | + * + * @return self + */ + public function setQualificationPeriod($qualificationPeriod) + { + if (is_null($qualificationPeriod)) { + array_push($this->openAPINullablesSetToNull, 'qualificationPeriod'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qualificationPeriod', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getQualificationPeriodAllowableValues(); + if (!is_null($qualificationPeriod) && !in_array($qualificationPeriod, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'qualificationPeriod', must be one of '%s'", + $qualificationPeriod, + implode("', '", $allowedValues) + ) + ); + } + $this->container['qualificationPeriod'] = $qualificationPeriod; + + return $this; + } + + /** + * Gets startDate + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAllStartDate|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAllStartDate|null $startDate startDate + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAllExpirationDate|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAllExpirationDate|null $expirationDate expirationDate + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + 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/LoyaltyTiersExpirationAllExpirationDate.php b/src/Model/LoyaltyTiersExpirationAllExpirationDate.php new file mode 100644 index 0000000..cc46940 --- /dev/null +++ b/src/Model/LoyaltyTiersExpirationAllExpirationDate.php @@ -0,0 +1,531 @@ + + */ +class LoyaltyTiersExpirationAllExpirationDate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTiersExpirationAllExpirationDate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'extend' => 'string', + 'rounding' => '\OpenAPI\Client\Model\LoyaltyTiersExpirationAllExpirationDateRounding' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'extend' => null, + 'rounding' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'extend' => true, + 'rounding' => 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 = [ + 'type' => 'type', + 'extend' => 'extend', + 'rounding' => 'rounding' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'extend' => 'setExtend', + 'rounding' => 'setRounding' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'extend' => 'getExtend', + 'rounding' => 'getRounding' + ]; + + /** + * 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 TYPE_END_OF_PERIOD = 'END_OF_PERIOD'; + public const TYPE_END_OF_NEXT_PERIOD = 'END_OF_NEXT_PERIOD'; + public const TYPE_BALANCE_DROP = 'BALANCE_DROP'; + public const TYPE_CUSTOM = 'CUSTOM'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_END_OF_PERIOD, + self::TYPE_END_OF_NEXT_PERIOD, + self::TYPE_BALANCE_DROP, + self::TYPE_CUSTOM, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('extend', $data ?? [], null); + $this->setIfExists('rounding', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type What triggers the tier to expire for a customer. `END_OF_PERIOD`: Expire tier at the end of the period. `END_OF_NEXT_PERIOD`: Expire tier at the end of the next period. `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets extend + * + * @return string|null + */ + public function getExtend() + { + return $this->container['extend']; + } + + /** + * Sets extend + * + * @param string|null $extend Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day. + * + * @return self + */ + public function setExtend($extend) + { + if (is_null($extend)) { + array_push($this->openAPINullablesSetToNull, 'extend'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('extend', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['extend'] = $extend; + + return $this; + } + + /** + * Gets rounding + * + * @return \OpenAPI\Client\Model\LoyaltyTiersExpirationAllExpirationDateRounding|null + */ + public function getRounding() + { + return $this->container['rounding']; + } + + /** + * Sets rounding + * + * @param \OpenAPI\Client\Model\LoyaltyTiersExpirationAllExpirationDateRounding|null $rounding rounding + * + * @return self + */ + public function setRounding($rounding) + { + if (is_null($rounding)) { + throw new \InvalidArgumentException('non-nullable rounding cannot be null'); + } + $this->container['rounding'] = $rounding; + + 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/LoyaltyTiersExpirationAllExpirationDateRounding.php b/src/Model/LoyaltyTiersExpirationAllExpirationDateRounding.php new file mode 100644 index 0000000..9ff5dd6 --- /dev/null +++ b/src/Model/LoyaltyTiersExpirationAllExpirationDateRounding.php @@ -0,0 +1,647 @@ + + */ +class LoyaltyTiersExpirationAllExpirationDateRounding implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTiersExpirationAllExpirationDate_rounding'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'strategy' => 'string', + 'unit' => 'string', + 'value' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'strategy' => null, + 'unit' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'strategy' => true, + 'unit' => true, + 'value' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'strategy' => 'strategy', + 'unit' => 'unit', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'strategy' => 'setStrategy', + 'unit' => 'setUnit', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'strategy' => 'getStrategy', + 'unit' => 'getUnit', + 'value' => 'getValue' + ]; + + /** + * 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 TYPE_MONTH = 'MONTH'; + public const TYPE_QUARTER = 'QUARTER'; + public const TYPE_HALF_YEAR = 'HALF_YEAR'; + public const TYPE_YEAR = 'YEAR'; + public const TYPE_CUSTOM = 'CUSTOM'; + public const STRATEGY_START = 'START'; + public const STRATEGY_END = 'END'; + public const UNIT_MONTH = 'MONTH'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_MONTH, + self::TYPE_QUARTER, + self::TYPE_HALF_YEAR, + self::TYPE_YEAR, + self::TYPE_CUSTOM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStrategyAllowableValues() + { + return [ + self::STRATEGY_START, + self::STRATEGY_END, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getUnitAllowableValues() + { + return [ + self::UNIT_MONTH, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('strategy', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], 'MONTH'); + $this->setIfExists('value', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStrategyAllowableValues(); + if (!is_null($this->container['strategy']) && !in_array($this->container['strategy'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'strategy', must be one of '%s'", + $this->container['strategy'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getUnitAllowableValues(); + if (!is_null($this->container['unit']) && !in_array($this->container['unit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'unit', must be one of '%s'", + $this->container['unit'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type This mechanism describes a custom rounding for the expiration date. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets strategy + * + * @return string|null + */ + public function getStrategy() + { + return $this->container['strategy']; + } + + /** + * Sets strategy + * + * @param string|null $strategy This mechanism describes a rounding strategy for the expiration date. + * + * @return self + */ + public function setStrategy($strategy) + { + if (is_null($strategy)) { + array_push($this->openAPINullablesSetToNull, 'strategy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('strategy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStrategyAllowableValues(); + if (!is_null($strategy) && !in_array($strategy, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'strategy', must be one of '%s'", + $strategy, + implode("', '", $allowedValues) + ) + ); + } + $this->container['strategy'] = $strategy; + + return $this; + } + + /** + * Gets unit + * + * @return string|null + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string|null $unit Defines the type of unit of time in which the rounding period is counted. + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + array_push($this->openAPINullablesSetToNull, 'unit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getUnitAllowableValues(); + if (!is_null($unit) && !in_array($unit, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'unit', must be one of '%s'", + $unit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets value + * + * @return int|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param int|null $value Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. - `0`: January - `1`: February - `2`: March - `3`: April - `4`: May - `5`: June - `6`: July - `7`: August - `8`: September - `9`: October - `10`: November - `11`: December + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + array_push($this->openAPINullablesSetToNull, 'value'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('value', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['value'] = $value; + + 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/LoyaltyTiersExpirationAllStartDate.php b/src/Model/LoyaltyTiersExpirationAllStartDate.php new file mode 100644 index 0000000..2ecde2f --- /dev/null +++ b/src/Model/LoyaltyTiersExpirationAllStartDate.php @@ -0,0 +1,452 @@ + + */ +class LoyaltyTiersExpirationAllStartDate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LoyaltyTiersExpirationAllStartDate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true + ]; + + /** + * 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 = [ + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType' + ]; + + /** + * 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 TYPE_IMMEDIATE = 'IMMEDIATE'; + public const TYPE_NEXT_PERIOD = 'NEXT_PERIOD'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_IMMEDIATE, + self::TYPE_NEXT_PERIOD, + ]; + } + + /** + * 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('type', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type What triggers the tier to be valid for a customer. `IMMEDIATE`: After reaching the minimum required points. `NEXT_PERIOD`: When the next qualification period starts. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + 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/LuckyDraw.php b/src/Model/LuckyDraw.php new file mode 100644 index 0000000..9d8aaf5 --- /dev/null +++ b/src/Model/LuckyDraw.php @@ -0,0 +1,502 @@ + + */ +class LuckyDraw implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LuckyDraw'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'winnersCount' => 'string', + 'uniqueWinnersPerDraw' => 'string', + 'uniqueWinners' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'winnersCount' => null, + 'uniqueWinnersPerDraw' => null, + 'uniqueWinners' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'winnersCount' => true, + 'uniqueWinnersPerDraw' => true, + 'uniqueWinners' => true + ]; + + /** + * 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 = [ + 'winnersCount' => 'winners_count', + 'uniqueWinnersPerDraw' => 'unique_winners_per_draw', + 'uniqueWinners' => 'unique_winners' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'winnersCount' => 'setWinnersCount', + 'uniqueWinnersPerDraw' => 'setUniqueWinnersPerDraw', + 'uniqueWinners' => 'setUniqueWinners' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'winnersCount' => 'getWinnersCount', + 'uniqueWinnersPerDraw' => 'getUniqueWinnersPerDraw', + 'uniqueWinners' => 'getUniqueWinners' + ]; + + /** + * 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('winnersCount', $data ?? [], null); + $this->setIfExists('uniqueWinnersPerDraw', $data ?? [], null); + $this->setIfExists('uniqueWinners', $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 winnersCount + * + * @return string|null + */ + public function getWinnersCount() + { + return $this->container['winnersCount']; + } + + /** + * Sets winnersCount + * + * @param string|null $winnersCount It represents the total number of winners in a lucky draw. + * + * @return self + */ + public function setWinnersCount($winnersCount) + { + if (is_null($winnersCount)) { + array_push($this->openAPINullablesSetToNull, 'winnersCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('winnersCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + + $this->container['winnersCount'] = $winnersCount; + + return $this; + } + + /** + * Gets uniqueWinnersPerDraw + * + * @return string|null + */ + public function getUniqueWinnersPerDraw() + { + return $this->container['uniqueWinnersPerDraw']; + } + + /** + * Sets uniqueWinnersPerDraw + * + * @param string|null $uniqueWinnersPerDraw It indicates whether each winner in a draw is unique or not. + * + * @return self + */ + public function setUniqueWinnersPerDraw($uniqueWinnersPerDraw) + { + if (is_null($uniqueWinnersPerDraw)) { + array_push($this->openAPINullablesSetToNull, 'uniqueWinnersPerDraw'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('uniqueWinnersPerDraw', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['uniqueWinnersPerDraw'] = $uniqueWinnersPerDraw; + + return $this; + } + + /** + * Gets uniqueWinners + * + * @return string|null + */ + public function getUniqueWinners() + { + return $this->container['uniqueWinners']; + } + + /** + * Sets uniqueWinners + * + * @param string|null $uniqueWinners Specifies whether each participant can win only once across multiple draws. + * + * @return self + */ + public function setUniqueWinners($uniqueWinners) + { + if (is_null($uniqueWinners)) { + array_push($this->openAPINullablesSetToNull, 'uniqueWinners'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('uniqueWinners', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['uniqueWinners'] = $uniqueWinners; + + 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/MappingPoints.php b/src/Model/MappingPoints.php new file mode 100644 index 0000000..688f4dd --- /dev/null +++ b/src/Model/MappingPoints.php @@ -0,0 +1,533 @@ + + */ +class MappingPoints implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MappingPoints'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'multiplier' => 'float', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'multiplier' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'multiplier' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'multiplier' => 'multiplier', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'multiplier' => 'setMultiplier', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'multiplier' => 'getMultiplier', + 'points' => 'getPoints' + ]; + + /** + * 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 TYPE_MULTIPLY = 'MULTIPLY'; + public const TYPE_CUSTOM = 'CUSTOM'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_MULTIPLY, + self::TYPE_CUSTOM, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('multiplier', $data ?? [], null); + $this->setIfExists('points', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets multiplier + * + * @return float|null + */ + public function getMultiplier() + { + return $this->container['multiplier']; + } + + /** + * Sets multiplier + * + * @param float|null $multiplier Multiplication factor used to multiply the points to obtain the mapped points. + * + * @return self + */ + public function setMultiplier($multiplier) + { + if (is_null($multiplier)) { + array_push($this->openAPINullablesSetToNull, 'multiplier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('multiplier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['multiplier'] = $multiplier; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Fixed number of points to be applied. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/MemberActivity.php b/src/Model/MemberActivity.php new file mode 100644 index 0000000..944cc73 --- /dev/null +++ b/src/Model/MemberActivity.php @@ -0,0 +1,582 @@ + + */ +class MemberActivity implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MemberActivity'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'data' => 'object', + 'createdAt' => '\DateTime', + 'groupId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'data' => null, + 'createdAt' => 'date-time', + 'groupId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true, + 'data' => true, + 'createdAt' => true, + 'groupId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type', + 'data' => 'data', + 'createdAt' => 'created_at', + 'groupId' => 'group_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'data' => 'setData', + 'createdAt' => 'setCreatedAt', + 'groupId' => 'setGroupId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'data' => 'getData', + 'createdAt' => 'getCreatedAt', + 'groupId' => 'getGroupId' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('groupId', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique event ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Event type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets data + * + * @return object|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object|null $data Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the member activity occurred in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets groupId + * + * @return string|null + */ + public function getGroupId() + { + return $this->container['groupId']; + } + + /** + * Sets groupId + * + * @param string|null $groupId Unique identifier of the request that caused the event. + * + * @return self + */ + public function setGroupId($groupId) + { + if (is_null($groupId)) { + array_push($this->openAPINullablesSetToNull, 'groupId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('groupId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['groupId'] = $groupId; + + 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/ModelInterface.php b/src/Model/ModelInterface.php new file mode 100644 index 0000000..de6726e --- /dev/null +++ b/src/Model/ModelInterface.php @@ -0,0 +1,112 @@ + + */ +class Order implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Order'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderItem[]', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'items' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'items' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'items' => 'items', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/OrderCalculated.php b/src/Model/OrderCalculated.php new file mode 100644 index 0000000..c335adc --- /dev/null +++ b/src/Model/OrderCalculated.php @@ -0,0 +1,1335 @@ + + */ +class OrderCalculated implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderCalculated'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'itemsDiscountAmount' => 'int', + 'totalDiscountAmount' => 'int', + 'totalAmount' => 'int', + 'appliedDiscountAmount' => 'int', + 'itemsAppliedDiscountAmount' => 'int', + 'totalAppliedDiscountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderCalculatedItem[]', + 'metadata' => 'object', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'customerId' => 'string', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\CustomerId', + 'referrer' => '\OpenAPI\Client\Model\ReferrerId', + 'redemptions' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'itemsDiscountAmount' => null, + 'totalDiscountAmount' => null, + 'totalAmount' => null, + 'appliedDiscountAmount' => null, + 'itemsAppliedDiscountAmount' => null, + 'totalAppliedDiscountAmount' => null, + 'items' => null, + 'metadata' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'customerId' => null, + 'referrerId' => null, + 'customer' => null, + 'referrer' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'itemsDiscountAmount' => true, + 'totalDiscountAmount' => true, + 'totalAmount' => true, + 'appliedDiscountAmount' => true, + 'itemsAppliedDiscountAmount' => true, + 'totalAppliedDiscountAmount' => true, + 'items' => true, + 'metadata' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'customerId' => true, + 'referrerId' => true, + 'customer' => false, + 'referrer' => false, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'itemsDiscountAmount' => 'items_discount_amount', + 'totalDiscountAmount' => 'total_discount_amount', + 'totalAmount' => 'total_amount', + 'appliedDiscountAmount' => 'applied_discount_amount', + 'itemsAppliedDiscountAmount' => 'items_applied_discount_amount', + 'totalAppliedDiscountAmount' => 'total_applied_discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'customerId' => 'customer_id', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'itemsDiscountAmount' => 'setItemsDiscountAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount', + 'totalAmount' => 'setTotalAmount', + 'appliedDiscountAmount' => 'setAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'setItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'setTotalAppliedDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'customerId' => 'setCustomerId', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'itemsDiscountAmount' => 'getItemsDiscountAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount', + 'totalAmount' => 'getTotalAmount', + 'appliedDiscountAmount' => 'getAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'getItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'getTotalAppliedDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'customerId' => 'getCustomerId', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + public const OBJECT_ORDER = 'order'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ORDER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('itemsDiscountAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountAmount', $data ?? [], null); + $this->setIfExists('itemsAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'order'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $data ?? [], null); + $this->setIfExists('redemptions', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets itemsDiscountAmount + * + * @return int|null + */ + public function getItemsDiscountAmount() + { + return $this->container['itemsDiscountAmount']; + } + + /** + * Sets itemsDiscountAmount + * + * @param int|null $itemsDiscountAmount Sum of all product-specific discounts applied to the order. + * + * @return self + */ + public function setItemsDiscountAmount($itemsDiscountAmount) + { + if (is_null($itemsDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsDiscountAmount'] = $itemsDiscountAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of all order-level AND all product-specific discounts applied to the order. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Order amount after undoing all the discounts through the rollback redemption. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets appliedDiscountAmount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['appliedDiscountAmount']; + } + + /** + * Sets appliedDiscountAmount + * + * @param int|null $appliedDiscountAmount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($appliedDiscountAmount) + { + if (is_null($appliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountAmount'] = $appliedDiscountAmount; + + return $this; + } + + /** + * Gets itemsAppliedDiscountAmount + * + * @return int|null + */ + public function getItemsAppliedDiscountAmount() + { + return $this->container['itemsAppliedDiscountAmount']; + } + + /** + * Sets itemsAppliedDiscountAmount + * + * @param int|null $itemsAppliedDiscountAmount Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + * + * @return self + */ + public function setItemsAppliedDiscountAmount($itemsAppliedDiscountAmount) + { + if (is_null($itemsAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsAppliedDiscountAmount'] = $itemsAppliedDiscountAmount; + + return $this; + } + + /** + * Gets totalAppliedDiscountAmount + * + * @return int|null + */ + public function getTotalAppliedDiscountAmount() + { + return $this->container['totalAppliedDiscountAmount']; + } + + /** + * Sets totalAppliedDiscountAmount + * + * @param int|null $totalAppliedDiscountAmount Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + * + * @return self + */ + public function setTotalAppliedDiscountAmount($totalAppliedDiscountAmount) + { + if (is_null($totalAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAppliedDiscountAmount'] = $totalAppliedDiscountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderCalculatedItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderCalculatedItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the order was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer making the purchase. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\CustomerId|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\CustomerId|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\ReferrerId|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\ReferrerId|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + throw new \InvalidArgumentException('non-nullable referrer cannot be null'); + } + $this->container['referrer'] = $referrer; + + return $this; + } + + /** + * Gets redemptions + * + * @return array|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param array|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/OrderCalculatedItem.php b/src/Model/OrderCalculatedItem.php new file mode 100644 index 0000000..524d38e --- /dev/null +++ b/src/Model/OrderCalculatedItem.php @@ -0,0 +1,1303 @@ + + */ +class OrderCalculatedItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderCalculatedItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'skuId' => 'string', + 'productId' => 'string', + 'relatedObject' => 'string', + 'sourceId' => 'string', + 'quantity' => 'int', + 'discountQuantity' => 'int', + 'initialQuantity' => 'int', + 'amount' => 'int', + 'discountAmount' => 'int', + 'appliedDiscountAmount' => 'int', + 'appliedDiscountQuantity' => 'int', + 'appliedQuantity' => 'int', + 'appliedQuantityAmount' => 'int', + 'initialAmount' => 'int', + 'price' => 'int', + 'subtotalAmount' => 'int', + 'product' => '\OpenAPI\Client\Model\OrderCalculatedItemProduct', + 'sku' => '\OpenAPI\Client\Model\OrderCalculatedItemSku', + 'object' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'skuId' => null, + 'productId' => null, + 'relatedObject' => null, + 'sourceId' => null, + 'quantity' => null, + 'discountQuantity' => null, + 'initialQuantity' => null, + 'amount' => null, + 'discountAmount' => null, + 'appliedDiscountAmount' => null, + 'appliedDiscountQuantity' => null, + 'appliedQuantity' => null, + 'appliedQuantityAmount' => null, + 'initialAmount' => null, + 'price' => null, + 'subtotalAmount' => null, + 'product' => null, + 'sku' => null, + 'object' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'skuId' => true, + 'productId' => true, + 'relatedObject' => true, + 'sourceId' => true, + 'quantity' => true, + 'discountQuantity' => true, + 'initialQuantity' => true, + 'amount' => true, + 'discountAmount' => true, + 'appliedDiscountAmount' => true, + 'appliedDiscountQuantity' => true, + 'appliedQuantity' => true, + 'appliedQuantityAmount' => true, + 'initialAmount' => true, + 'price' => true, + 'subtotalAmount' => true, + 'product' => true, + 'sku' => true, + 'object' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'skuId' => 'sku_id', + 'productId' => 'product_id', + 'relatedObject' => 'related_object', + 'sourceId' => 'source_id', + 'quantity' => 'quantity', + 'discountQuantity' => 'discount_quantity', + 'initialQuantity' => 'initial_quantity', + 'amount' => 'amount', + 'discountAmount' => 'discount_amount', + 'appliedDiscountAmount' => 'applied_discount_amount', + 'appliedDiscountQuantity' => 'applied_discount_quantity', + 'appliedQuantity' => 'applied_quantity', + 'appliedQuantityAmount' => 'applied_quantity_amount', + 'initialAmount' => 'initial_amount', + 'price' => 'price', + 'subtotalAmount' => 'subtotal_amount', + 'product' => 'product', + 'sku' => 'sku', + 'object' => 'object', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'skuId' => 'setSkuId', + 'productId' => 'setProductId', + 'relatedObject' => 'setRelatedObject', + 'sourceId' => 'setSourceId', + 'quantity' => 'setQuantity', + 'discountQuantity' => 'setDiscountQuantity', + 'initialQuantity' => 'setInitialQuantity', + 'amount' => 'setAmount', + 'discountAmount' => 'setDiscountAmount', + 'appliedDiscountAmount' => 'setAppliedDiscountAmount', + 'appliedDiscountQuantity' => 'setAppliedDiscountQuantity', + 'appliedQuantity' => 'setAppliedQuantity', + 'appliedQuantityAmount' => 'setAppliedQuantityAmount', + 'initialAmount' => 'setInitialAmount', + 'price' => 'setPrice', + 'subtotalAmount' => 'setSubtotalAmount', + 'product' => 'setProduct', + 'sku' => 'setSku', + 'object' => 'setObject', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'skuId' => 'getSkuId', + 'productId' => 'getProductId', + 'relatedObject' => 'getRelatedObject', + 'sourceId' => 'getSourceId', + 'quantity' => 'getQuantity', + 'discountQuantity' => 'getDiscountQuantity', + 'initialQuantity' => 'getInitialQuantity', + 'amount' => 'getAmount', + 'discountAmount' => 'getDiscountAmount', + 'appliedDiscountAmount' => 'getAppliedDiscountAmount', + 'appliedDiscountQuantity' => 'getAppliedDiscountQuantity', + 'appliedQuantity' => 'getAppliedQuantity', + 'appliedQuantityAmount' => 'getAppliedQuantityAmount', + 'initialAmount' => 'getInitialAmount', + 'price' => 'getPrice', + 'subtotalAmount' => 'getSubtotalAmount', + 'product' => 'getProduct', + 'sku' => 'getSku', + 'object' => 'getObject', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 RELATED_OBJECT_PRODUCT = 'product'; + public const RELATED_OBJECT_SKU = 'sku'; + public const OBJECT_ORDER_ITEM = 'order_item'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectAllowableValues() + { + return [ + self::RELATED_OBJECT_PRODUCT, + self::RELATED_OBJECT_SKU, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ORDER_ITEM, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('skuId', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('relatedObject', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('discountQuantity', $data ?? [], null); + $this->setIfExists('initialQuantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountQuantity', $data ?? [], null); + $this->setIfExists('appliedQuantity', $data ?? [], null); + $this->setIfExists('appliedQuantityAmount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('subtotalAmount', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'order_item'); + $this->setIfExists('metadata', $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->getRelatedObjectAllowableValues(); + if (!is_null($this->container['relatedObject']) && !in_array($this->container['relatedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObject', must be one of '%s'", + $this->container['relatedObject'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the order line item. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets skuId + * + * @return string|null + */ + public function getSkuId() + { + return $this->container['skuId']; + } + + /** + * Sets skuId + * + * @param string|null $skuId Unique identifier of the SKU. It is assigned by Voucherify. + * + * @return self + */ + public function setSkuId($skuId) + { + if (is_null($skuId)) { + array_push($this->openAPINullablesSetToNull, 'skuId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skuId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skuId'] = $skuId; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId Unique identifier of the product. It is assigned by Voucherify. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets relatedObject + * + * @return string|null + */ + public function getRelatedObject() + { + return $this->container['relatedObject']; + } + + /** + * Sets relatedObject + * + * @param string|null $relatedObject Used along with the source_id property, can be set to either sku or product. + * + * @return self + */ + public function setRelatedObject($relatedObject) + { + if (is_null($relatedObject)) { + array_push($this->openAPINullablesSetToNull, 'relatedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectAllowableValues(); + if (!is_null($relatedObject) && !in_array($relatedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObject', must be one of '%s'", + $relatedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObject'] = $relatedObject; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity The quantity of the particular item in the cart. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets discountQuantity + * + * @return int|null + */ + public function getDiscountQuantity() + { + return $this->container['discountQuantity']; + } + + /** + * Sets discountQuantity + * + * @param int|null $discountQuantity Number of dicounted items. + * + * @return self + */ + public function setDiscountQuantity($discountQuantity) + { + if (is_null($discountQuantity)) { + array_push($this->openAPINullablesSetToNull, 'discountQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountQuantity'] = $discountQuantity; + + return $this; + } + + /** + * Gets initialQuantity + * + * @return int|null + */ + public function getInitialQuantity() + { + return $this->container['initialQuantity']; + } + + /** + * Sets initialQuantity + * + * @param int|null $initialQuantity A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. + * + * @return self + */ + public function setInitialQuantity($initialQuantity) + { + if (is_null($initialQuantity)) { + array_push($this->openAPINullablesSetToNull, 'initialQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialQuantity'] = $initialQuantity; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount The total amount of the order item (price * quantity). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-item-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets appliedDiscountAmount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['appliedDiscountAmount']; + } + + /** + * Sets appliedDiscountAmount + * + * @param int|null $appliedDiscountAmount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($appliedDiscountAmount) + { + if (is_null($appliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountAmount'] = $appliedDiscountAmount; + + return $this; + } + + /** + * Gets appliedDiscountQuantity + * + * @return int|null + */ + public function getAppliedDiscountQuantity() + { + return $this->container['appliedDiscountQuantity']; + } + + /** + * Sets appliedDiscountQuantity + * + * @param int|null $appliedDiscountQuantity Number of the discounted items applied in the transaction. + * + * @return self + */ + public function setAppliedDiscountQuantity($appliedDiscountQuantity) + { + if (is_null($appliedDiscountQuantity)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountQuantity'] = $appliedDiscountQuantity; + + return $this; + } + + /** + * Gets appliedQuantity + * + * @return int|null + */ + public function getAppliedQuantity() + { + return $this->container['appliedQuantity']; + } + + /** + * Sets appliedQuantity + * + * @param int|null $appliedQuantity Quantity of items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. + * + * @return self + */ + public function setAppliedQuantity($appliedQuantity) + { + if (is_null($appliedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'appliedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedQuantity'] = $appliedQuantity; + + return $this; + } + + /** + * Gets appliedQuantityAmount + * + * @return int|null + */ + public function getAppliedQuantityAmount() + { + return $this->container['appliedQuantityAmount']; + } + + /** + * Sets appliedQuantityAmount + * + * @param int|null $appliedQuantityAmount Amount for the items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. + * + * @return self + */ + public function setAppliedQuantityAmount($appliedQuantityAmount) + { + if (is_null($appliedQuantityAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedQuantityAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedQuantityAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedQuantityAmount'] = $appliedQuantityAmount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets subtotalAmount + * + * @return int|null + */ + public function getSubtotalAmount() + { + return $this->container['subtotalAmount']; + } + + /** + * Sets subtotalAmount + * + * @param int|null $subtotalAmount Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount` + * + * @return self + */ + public function setSubtotalAmount($subtotalAmount) + { + if (is_null($subtotalAmount)) { + array_push($this->openAPINullablesSetToNull, 'subtotalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subtotalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['subtotalAmount'] = $subtotalAmount; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\OrderCalculatedItemProduct|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\OrderCalculatedItemProduct|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + array_push($this->openAPINullablesSetToNull, 'product'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets sku + * + * @return \OpenAPI\Client\Model\OrderCalculatedItemSku|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param \OpenAPI\Client\Model\OrderCalculatedItemSku|null $sku sku + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/OrderCalculatedItemProduct.php b/src/Model/OrderCalculatedItemProduct.php new file mode 100644 index 0000000..012a175 --- /dev/null +++ b/src/Model/OrderCalculatedItemProduct.php @@ -0,0 +1,623 @@ + + */ +class OrderCalculatedItemProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderCalculatedItemProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'override' => 'bool', + 'name' => 'string', + 'metadata' => 'object', + 'price' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'override' => null, + 'name' => null, + 'metadata' => null, + 'price' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'override' => true, + 'name' => true, + 'metadata' => true, + 'price' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'override' => 'override', + 'name' => 'name', + 'metadata' => 'metadata', + 'price' => 'price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'override' => 'setOverride', + 'name' => 'setName', + 'metadata' => 'setMetadata', + 'price' => 'setPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'override' => 'getOverride', + 'name' => 'getName', + 'metadata' => 'getMetadata', + 'price' => 'getPrice' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('override', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('price', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the product and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets override + * + * @return bool|null + */ + public function getOverride() + { + return $this->container['override']; + } + + /** + * Sets override + * + * @param bool|null $override The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. + * + * @return self + */ + public function setOverride($override) + { + if (is_null($override)) { + array_push($this->openAPINullablesSetToNull, 'override'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('override', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['override'] = $override; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets price + * + * @return float|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float|null $price Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + 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/OrderCalculatedItemSku.php b/src/Model/OrderCalculatedItemSku.php new file mode 100644 index 0000000..2e2ead7 --- /dev/null +++ b/src/Model/OrderCalculatedItemSku.php @@ -0,0 +1,582 @@ + + */ +class OrderCalculatedItemSku implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderCalculatedItemSku'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'override' => 'bool', + 'sku' => 'string', + 'price' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'override' => null, + 'sku' => null, + 'price' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'override' => true, + 'sku' => true, + 'price' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'override' => 'override', + 'sku' => 'sku', + 'price' => 'price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'override' => 'setOverride', + 'sku' => 'setSku', + 'price' => 'setPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'override' => 'getOverride', + 'sku' => 'getSku', + 'price' => 'getPrice' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('override', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the SKU and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets override + * + * @return bool|null + */ + public function getOverride() + { + return $this->container['override']; + } + + /** + * Sets override + * + * @param bool|null $override The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. + * + * @return self + */ + public function setOverride($override) + { + if (is_null($override)) { + array_push($this->openAPINullablesSetToNull, 'override'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('override', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['override'] = $override; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku The SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return float|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float|null $price SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + 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/OrderItem.php b/src/Model/OrderItem.php new file mode 100644 index 0000000..79145fd --- /dev/null +++ b/src/Model/OrderItem.php @@ -0,0 +1,984 @@ + + */ +class OrderItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'skuId' => 'string', + 'productId' => 'string', + 'relatedObject' => 'string', + 'sourceId' => 'string', + 'quantity' => 'int', + 'discountQuantity' => 'int', + 'initialQuantity' => 'int', + 'amount' => 'int', + 'discountAmount' => 'int', + 'initialAmount' => 'int', + 'price' => 'int', + 'product' => '\OpenAPI\Client\Model\OrderItemProduct', + 'sku' => '\OpenAPI\Client\Model\OrderItemSku', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'skuId' => null, + 'productId' => null, + 'relatedObject' => null, + 'sourceId' => null, + 'quantity' => null, + 'discountQuantity' => null, + 'initialQuantity' => null, + 'amount' => null, + 'discountAmount' => null, + 'initialAmount' => null, + 'price' => null, + 'product' => null, + 'sku' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'skuId' => true, + 'productId' => true, + 'relatedObject' => true, + 'sourceId' => true, + 'quantity' => true, + 'discountQuantity' => true, + 'initialQuantity' => true, + 'amount' => true, + 'discountAmount' => true, + 'initialAmount' => true, + 'price' => true, + 'product' => true, + 'sku' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'skuId' => 'sku_id', + 'productId' => 'product_id', + 'relatedObject' => 'related_object', + 'sourceId' => 'source_id', + 'quantity' => 'quantity', + 'discountQuantity' => 'discount_quantity', + 'initialQuantity' => 'initial_quantity', + 'amount' => 'amount', + 'discountAmount' => 'discount_amount', + 'initialAmount' => 'initial_amount', + 'price' => 'price', + 'product' => 'product', + 'sku' => 'sku', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'skuId' => 'setSkuId', + 'productId' => 'setProductId', + 'relatedObject' => 'setRelatedObject', + 'sourceId' => 'setSourceId', + 'quantity' => 'setQuantity', + 'discountQuantity' => 'setDiscountQuantity', + 'initialQuantity' => 'setInitialQuantity', + 'amount' => 'setAmount', + 'discountAmount' => 'setDiscountAmount', + 'initialAmount' => 'setInitialAmount', + 'price' => 'setPrice', + 'product' => 'setProduct', + 'sku' => 'setSku', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'skuId' => 'getSkuId', + 'productId' => 'getProductId', + 'relatedObject' => 'getRelatedObject', + 'sourceId' => 'getSourceId', + 'quantity' => 'getQuantity', + 'discountQuantity' => 'getDiscountQuantity', + 'initialQuantity' => 'getInitialQuantity', + 'amount' => 'getAmount', + 'discountAmount' => 'getDiscountAmount', + 'initialAmount' => 'getInitialAmount', + 'price' => 'getPrice', + 'product' => 'getProduct', + 'sku' => 'getSku', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 RELATED_OBJECT_PRODUCT = 'product'; + public const RELATED_OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectAllowableValues() + { + return [ + self::RELATED_OBJECT_PRODUCT, + self::RELATED_OBJECT_SKU, + ]; + } + + /** + * 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('skuId', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('relatedObject', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('discountQuantity', $data ?? [], null); + $this->setIfExists('initialQuantity', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('metadata', $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->getRelatedObjectAllowableValues(); + if (!is_null($this->container['relatedObject']) && !in_array($this->container['relatedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObject', must be one of '%s'", + $this->container['relatedObject'], + 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 skuId + * + * @return string|null + */ + public function getSkuId() + { + return $this->container['skuId']; + } + + /** + * Sets skuId + * + * @param string|null $skuId Unique identifier of the SKU. It is assigned by Voucherify. + * + * @return self + */ + public function setSkuId($skuId) + { + if (is_null($skuId)) { + array_push($this->openAPINullablesSetToNull, 'skuId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skuId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skuId'] = $skuId; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId Unique identifier of the product. It is assigned by Voucherify. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets relatedObject + * + * @return string|null + */ + public function getRelatedObject() + { + return $this->container['relatedObject']; + } + + /** + * Sets relatedObject + * + * @param string|null $relatedObject Used along with the source_id property, can be set to either sku or product. + * + * @return self + */ + public function setRelatedObject($relatedObject) + { + if (is_null($relatedObject)) { + array_push($this->openAPINullablesSetToNull, 'relatedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectAllowableValues(); + if (!is_null($relatedObject) && !in_array($relatedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObject', must be one of '%s'", + $relatedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObject'] = $relatedObject; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity The quantity of the particular item in the cart. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets discountQuantity + * + * @return int|null + */ + public function getDiscountQuantity() + { + return $this->container['discountQuantity']; + } + + /** + * Sets discountQuantity + * + * @param int|null $discountQuantity Number of dicounted items. + * + * @return self + */ + public function setDiscountQuantity($discountQuantity) + { + if (is_null($discountQuantity)) { + array_push($this->openAPINullablesSetToNull, 'discountQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountQuantity'] = $discountQuantity; + + return $this; + } + + /** + * Gets initialQuantity + * + * @return int|null + */ + public function getInitialQuantity() + { + return $this->container['initialQuantity']; + } + + /** + * Sets initialQuantity + * + * @param int|null $initialQuantity A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. + * + * @return self + */ + public function setInitialQuantity($initialQuantity) + { + if (is_null($initialQuantity)) { + array_push($this->openAPINullablesSetToNull, 'initialQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialQuantity'] = $initialQuantity; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount The total amount of the order item (price * quantity). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-item-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\OrderItemProduct|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\OrderItemProduct|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + array_push($this->openAPINullablesSetToNull, 'product'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets sku + * + * @return \OpenAPI\Client\Model\OrderItemSku|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param \OpenAPI\Client\Model\OrderItemSku|null $sku sku + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/OrderItemProduct.php b/src/Model/OrderItemProduct.php new file mode 100644 index 0000000..deb9062 --- /dev/null +++ b/src/Model/OrderItemProduct.php @@ -0,0 +1,623 @@ + + */ +class OrderItemProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderItemProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'override' => 'bool', + 'name' => 'string', + 'metadata' => 'object', + 'price' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'override' => null, + 'name' => null, + 'metadata' => null, + 'price' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'override' => true, + 'name' => true, + 'metadata' => true, + 'price' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'override' => 'override', + 'name' => 'name', + 'metadata' => 'metadata', + 'price' => 'price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'override' => 'setOverride', + 'name' => 'setName', + 'metadata' => 'setMetadata', + 'price' => 'setPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'override' => 'getOverride', + 'name' => 'getName', + 'metadata' => 'getMetadata', + 'price' => 'getPrice' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('override', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('price', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the product and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets override + * + * @return bool|null + */ + public function getOverride() + { + return $this->container['override']; + } + + /** + * Sets override + * + * @param bool|null $override The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. + * + * @return self + */ + public function setOverride($override) + { + if (is_null($override)) { + array_push($this->openAPINullablesSetToNull, 'override'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('override', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['override'] = $override; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets price + * + * @return float|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float|null $price Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + 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/OrderItemSku.php b/src/Model/OrderItemSku.php new file mode 100644 index 0000000..3ba9179 --- /dev/null +++ b/src/Model/OrderItemSku.php @@ -0,0 +1,582 @@ + + */ +class OrderItemSku implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderItemSku'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'override' => 'bool', + 'sku' => 'string', + 'price' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'override' => null, + 'sku' => null, + 'price' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'override' => true, + 'sku' => true, + 'price' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'override' => 'override', + 'sku' => 'sku', + 'price' => 'price' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'override' => 'setOverride', + 'sku' => 'setSku', + 'price' => 'setPrice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'override' => 'getOverride', + 'sku' => 'getSku', + 'price' => 'getPrice' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('override', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the SKU and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets override + * + * @return bool|null + */ + public function getOverride() + { + return $this->container['override']; + } + + /** + * Sets override + * + * @param bool|null $override The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. + * + * @return self + */ + public function setOverride($override) + { + if (is_null($override)) { + array_push($this->openAPINullablesSetToNull, 'override'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('override', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['override'] = $override; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku The SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return float|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float|null $price SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + 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/OrderRedemptionsEntry.php b/src/Model/OrderRedemptionsEntry.php new file mode 100644 index 0000000..8cea215 --- /dev/null +++ b/src/Model/OrderRedemptionsEntry.php @@ -0,0 +1,704 @@ + + */ +class OrderRedemptionsEntry implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrderRedemptionsEntry'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'date' => '\DateTime', + 'rollbackId' => 'string', + 'rollbackDate' => '\DateTime', + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectParentId' => 'string', + 'stacked' => 'string[]', + 'rollbackStacked' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'date' => 'date-time', + 'rollbackId' => null, + 'rollbackDate' => 'date-time', + 'relatedObjectType' => null, + 'relatedObjectId' => null, + 'relatedObjectParentId' => null, + 'stacked' => null, + 'rollbackStacked' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'date' => true, + 'rollbackId' => true, + 'rollbackDate' => true, + 'relatedObjectType' => true, + 'relatedObjectId' => true, + 'relatedObjectParentId' => true, + 'stacked' => true, + 'rollbackStacked' => true + ]; + + /** + * 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 = [ + 'date' => 'date', + 'rollbackId' => 'rollback_id', + 'rollbackDate' => 'rollback_date', + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectParentId' => 'related_object_parent_id', + 'stacked' => 'stacked', + 'rollbackStacked' => 'rollback_stacked' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'date' => 'setDate', + 'rollbackId' => 'setRollbackId', + 'rollbackDate' => 'setRollbackDate', + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectParentId' => 'setRelatedObjectParentId', + 'stacked' => 'setStacked', + 'rollbackStacked' => 'setRollbackStacked' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'date' => 'getDate', + 'rollbackId' => 'getRollbackId', + 'rollbackDate' => 'getRollbackDate', + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectParentId' => 'getRelatedObjectParentId', + 'stacked' => 'getStacked', + 'rollbackStacked' => 'getRollbackStacked' + ]; + + /** + * 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('date', $data ?? [], null); + $this->setIfExists('rollbackId', $data ?? [], null); + $this->setIfExists('rollbackDate', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'redemption'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectParentId', $data ?? [], null); + $this->setIfExists('stacked', $data ?? [], null); + $this->setIfExists('rollbackStacked', $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 date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + array_push($this->openAPINullablesSetToNull, 'date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets rollbackId + * + * @return string|null + */ + public function getRollbackId() + { + return $this->container['rollbackId']; + } + + /** + * Sets rollbackId + * + * @param string|null $rollbackId Unique ID of the redemption rollback. + * + * @return self + */ + public function setRollbackId($rollbackId) + { + if (is_null($rollbackId)) { + array_push($this->openAPINullablesSetToNull, 'rollbackId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbackId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbackId'] = $rollbackId; + + return $this; + } + + /** + * Gets rollbackDate + * + * @return \DateTime|null + */ + public function getRollbackDate() + { + return $this->container['rollbackDate']; + } + + /** + * Sets rollbackDate + * + * @param \DateTime|null $rollbackDate Timestamp representing the date and tiem when the redemption rollback was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setRollbackDate($rollbackDate) + { + if (is_null($rollbackDate)) { + array_push($this->openAPINullablesSetToNull, 'rollbackDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbackDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbackDate'] = $rollbackDate; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType The source of the incentive. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Unique ID of the parent redemption. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectParentId + * + * @return string|null + */ + public function getRelatedObjectParentId() + { + return $this->container['relatedObjectParentId']; + } + + /** + * Sets relatedObjectParentId + * + * @param string|null $relatedObjectParentId Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign. + * + * @return self + */ + public function setRelatedObjectParentId($relatedObjectParentId) + { + if (is_null($relatedObjectParentId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectParentId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectParentId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectParentId'] = $relatedObjectParentId; + + return $this; + } + + /** + * Gets stacked + * + * @return string[]|null + */ + public function getStacked() + { + return $this->container['stacked']; + } + + /** + * Sets stacked + * + * @param string[]|null $stacked Contains a list of unique IDs of child redemptions, which belong to the stacked incentives. + * + * @return self + */ + public function setStacked($stacked) + { + if (is_null($stacked)) { + array_push($this->openAPINullablesSetToNull, 'stacked'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stacked', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['stacked'] = $stacked; + + return $this; + } + + /** + * Gets rollbackStacked + * + * @return string[]|null + */ + public function getRollbackStacked() + { + return $this->container['rollbackStacked']; + } + + /** + * Sets rollbackStacked + * + * @param string[]|null $rollbackStacked Lists the rollback redemption IDs of the particular child redemptions. + * + * @return self + */ + public function setRollbackStacked($rollbackStacked) + { + if (is_null($rollbackStacked)) { + array_push($this->openAPINullablesSetToNull, 'rollbackStacked'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbackStacked', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbackStacked'] = $rollbackStacked; + + 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/OrdersCreateRequestBody.php b/src/Model/OrdersCreateRequestBody.php new file mode 100644 index 0000000..800798f --- /dev/null +++ b/src/Model/OrdersCreateRequestBody.php @@ -0,0 +1,893 @@ + + */ +class OrdersCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderItem[]', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'referrer' => '\OpenAPI\Client\Model\Referrer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'items' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'referrerId' => null, + 'customer' => null, + 'referrer' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'items' => true, + 'metadata' => true, + 'createdAt' => true, + 'referrerId' => true, + 'customer' => false, + 'referrer' => 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\Referrer|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\Referrer|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + throw new \InvalidArgumentException('non-nullable referrer cannot be null'); + } + $this->container['referrer'] = $referrer; + + 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/OrdersCreateResponseBody.php b/src/Model/OrdersCreateResponseBody.php new file mode 100644 index 0000000..3897762 --- /dev/null +++ b/src/Model/OrdersCreateResponseBody.php @@ -0,0 +1,1335 @@ + + */ +class OrdersCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'itemsDiscountAmount' => 'int', + 'totalDiscountAmount' => 'int', + 'totalAmount' => 'int', + 'appliedDiscountAmount' => 'int', + 'itemsAppliedDiscountAmount' => 'int', + 'totalAppliedDiscountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderCalculatedItem[]', + 'metadata' => 'object', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'customerId' => 'string', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\CustomerId', + 'referrer' => '\OpenAPI\Client\Model\ReferrerId', + 'redemptions' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'itemsDiscountAmount' => null, + 'totalDiscountAmount' => null, + 'totalAmount' => null, + 'appliedDiscountAmount' => null, + 'itemsAppliedDiscountAmount' => null, + 'totalAppliedDiscountAmount' => null, + 'items' => null, + 'metadata' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'customerId' => null, + 'referrerId' => null, + 'customer' => null, + 'referrer' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'itemsDiscountAmount' => true, + 'totalDiscountAmount' => true, + 'totalAmount' => true, + 'appliedDiscountAmount' => true, + 'itemsAppliedDiscountAmount' => true, + 'totalAppliedDiscountAmount' => true, + 'items' => true, + 'metadata' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'customerId' => true, + 'referrerId' => true, + 'customer' => false, + 'referrer' => false, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'itemsDiscountAmount' => 'items_discount_amount', + 'totalDiscountAmount' => 'total_discount_amount', + 'totalAmount' => 'total_amount', + 'appliedDiscountAmount' => 'applied_discount_amount', + 'itemsAppliedDiscountAmount' => 'items_applied_discount_amount', + 'totalAppliedDiscountAmount' => 'total_applied_discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'customerId' => 'customer_id', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'itemsDiscountAmount' => 'setItemsDiscountAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount', + 'totalAmount' => 'setTotalAmount', + 'appliedDiscountAmount' => 'setAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'setItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'setTotalAppliedDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'customerId' => 'setCustomerId', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'itemsDiscountAmount' => 'getItemsDiscountAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount', + 'totalAmount' => 'getTotalAmount', + 'appliedDiscountAmount' => 'getAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'getItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'getTotalAppliedDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'customerId' => 'getCustomerId', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + public const OBJECT_ORDER = 'order'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ORDER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('itemsDiscountAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountAmount', $data ?? [], null); + $this->setIfExists('itemsAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'order'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $data ?? [], null); + $this->setIfExists('redemptions', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets itemsDiscountAmount + * + * @return int|null + */ + public function getItemsDiscountAmount() + { + return $this->container['itemsDiscountAmount']; + } + + /** + * Sets itemsDiscountAmount + * + * @param int|null $itemsDiscountAmount Sum of all product-specific discounts applied to the order. + * + * @return self + */ + public function setItemsDiscountAmount($itemsDiscountAmount) + { + if (is_null($itemsDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsDiscountAmount'] = $itemsDiscountAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of all order-level AND all product-specific discounts applied to the order. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Order amount after undoing all the discounts through the rollback redemption. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets appliedDiscountAmount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['appliedDiscountAmount']; + } + + /** + * Sets appliedDiscountAmount + * + * @param int|null $appliedDiscountAmount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($appliedDiscountAmount) + { + if (is_null($appliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountAmount'] = $appliedDiscountAmount; + + return $this; + } + + /** + * Gets itemsAppliedDiscountAmount + * + * @return int|null + */ + public function getItemsAppliedDiscountAmount() + { + return $this->container['itemsAppliedDiscountAmount']; + } + + /** + * Sets itemsAppliedDiscountAmount + * + * @param int|null $itemsAppliedDiscountAmount Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + * + * @return self + */ + public function setItemsAppliedDiscountAmount($itemsAppliedDiscountAmount) + { + if (is_null($itemsAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsAppliedDiscountAmount'] = $itemsAppliedDiscountAmount; + + return $this; + } + + /** + * Gets totalAppliedDiscountAmount + * + * @return int|null + */ + public function getTotalAppliedDiscountAmount() + { + return $this->container['totalAppliedDiscountAmount']; + } + + /** + * Sets totalAppliedDiscountAmount + * + * @param int|null $totalAppliedDiscountAmount Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + * + * @return self + */ + public function setTotalAppliedDiscountAmount($totalAppliedDiscountAmount) + { + if (is_null($totalAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAppliedDiscountAmount'] = $totalAppliedDiscountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderCalculatedItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderCalculatedItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the order was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer making the purchase. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\CustomerId|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\CustomerId|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\ReferrerId|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\ReferrerId|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + throw new \InvalidArgumentException('non-nullable referrer cannot be null'); + } + $this->container['referrer'] = $referrer; + + return $this; + } + + /** + * Gets redemptions + * + * @return array|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param array|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/OrdersExportCreateRequestBody.php b/src/Model/OrdersExportCreateRequestBody.php new file mode 100644 index 0000000..68b7ec6 --- /dev/null +++ b/src/Model/OrdersExportCreateRequestBody.php @@ -0,0 +1,418 @@ + + */ +class OrdersExportCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersExportCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'parameters' => '\OpenAPI\Client\Model\OrdersExportCreateRequestBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'parameters' => true + ]; + + /** + * 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 = [ + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'parameters' => 'getParameters' + ]; + + /** + * 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('parameters', $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 parameters + * + * @return \OpenAPI\Client\Model\OrdersExportCreateRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\OrdersExportCreateRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/OrdersExportCreateRequestBodyParameters.php b/src/Model/OrdersExportCreateRequestBodyParameters.php new file mode 100644 index 0000000..96702f5 --- /dev/null +++ b/src/Model/OrdersExportCreateRequestBodyParameters.php @@ -0,0 +1,581 @@ + + */ +class OrdersExportCreateRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersExportCreateRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const ORDER_UPDATED_AT = '-updated_at'; + public const ORDER_UPDATED_AT2 = 'updated_at'; + public const ORDER_STATUS = '-status'; + public const ORDER_STATUS2 = 'status'; + public const FIELDS_ID = 'id'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_UPDATED_AT = 'updated_at'; + public const FIELDS_STATUS = 'status'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_DISCOUNT_AMOUNT = 'discount_amount'; + public const FIELDS_ITEMS_DISCOUNT_AMOUNT = 'items_discount_amount'; + public const FIELDS_TOTAL_DISCOUNT_AMOUNT = 'total_discount_amount'; + public const FIELDS_TOTAL_AMOUNT = 'total_amount'; + public const FIELDS_CUSTOMER_ID = 'customer_id'; + public const FIELDS_REFERRER_ID = 'referrer_id'; + public const FIELDS_METADATA = 'metadata'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + self::ORDER_UPDATED_AT, + self::ORDER_UPDATED_AT2, + self::ORDER_STATUS, + self::ORDER_STATUS2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_ID, + self::FIELDS_SOURCE_ID, + self::FIELDS_CREATED_AT, + self::FIELDS_UPDATED_AT, + self::FIELDS_STATUS, + self::FIELDS_AMOUNT, + self::FIELDS_DISCOUNT_AMOUNT, + self::FIELDS_ITEMS_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_AMOUNT, + self::FIELDS_CUSTOMER_ID, + self::FIELDS_REFERRER_ID, + self::FIELDS_METADATA, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return object|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param object|null $filters Allowed additional properties must start with \"metadata.\" + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + 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/OrdersExportCreateResponseBody.php b/src/Model/OrdersExportCreateResponseBody.php new file mode 100644 index 0000000..3f21e40 --- /dev/null +++ b/src/Model/OrdersExportCreateResponseBody.php @@ -0,0 +1,842 @@ + + */ +class OrdersExportCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersExportCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'channel' => 'string', + 'result' => 'object', + 'userId' => 'string', + 'exportedObject' => 'string', + 'parameters' => '\OpenAPI\Client\Model\OrdersExportCreateResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'status' => null, + 'channel' => null, + 'result' => null, + 'userId' => null, + 'exportedObject' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'status' => true, + 'channel' => true, + 'result' => true, + 'userId' => true, + 'exportedObject' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'status' => 'status', + 'channel' => 'channel', + 'result' => 'result', + 'userId' => 'user_id', + 'exportedObject' => 'exported_object', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'channel' => 'setChannel', + 'result' => 'setResult', + 'userId' => 'setUserId', + 'exportedObject' => 'setExportedObject', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'channel' => 'getChannel', + 'result' => 'getResult', + 'userId' => 'getUserId', + 'exportedObject' => 'getExportedObject', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_EXPORT = 'export'; + public const STATUS_SCHEDULED = 'SCHEDULED'; + public const EXPORTED_OBJECT_ORDER = 'order'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EXPORT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SCHEDULED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportedObjectAllowableValues() + { + return [ + self::EXPORTED_OBJECT_ORDER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'export'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], 'SCHEDULED'); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('userId', $data ?? [], null); + $this->setIfExists('exportedObject', $data ?? [], 'order'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($this->container['exportedObject']) && !in_array($this->container['exportedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exportedObject', must be one of '%s'", + $this->container['exportedObject'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique export ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of object being represented. This object stores information about the export. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel through which the export was triggered. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets result + * + * @return object|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param object|null $result Contains the URL of the CSV file. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets userId + * + * @return string|null + */ + public function getUserId() + { + return $this->container['userId']; + } + + /** + * Sets userId + * + * @param string|null $userId Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. + * + * @return self + */ + public function setUserId($userId) + { + if (is_null($userId)) { + array_push($this->openAPINullablesSetToNull, 'userId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('userId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['userId'] = $userId; + + return $this; + } + + /** + * Gets exportedObject + * + * @return string|null + */ + public function getExportedObject() + { + return $this->container['exportedObject']; + } + + /** + * Sets exportedObject + * + * @param string|null $exportedObject The type of object to be exported. + * + * @return self + */ + public function setExportedObject($exportedObject) + { + if (is_null($exportedObject)) { + array_push($this->openAPINullablesSetToNull, 'exportedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exportedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($exportedObject) && !in_array($exportedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exportedObject', must be one of '%s'", + $exportedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exportedObject'] = $exportedObject; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\OrdersExportCreateResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\OrdersExportCreateResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/OrdersExportCreateResponseBodyParameters.php b/src/Model/OrdersExportCreateResponseBodyParameters.php new file mode 100644 index 0000000..4e8ede6 --- /dev/null +++ b/src/Model/OrdersExportCreateResponseBodyParameters.php @@ -0,0 +1,581 @@ + + */ +class OrdersExportCreateResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersExportCreateResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const ORDER_UPDATED_AT = '-updated_at'; + public const ORDER_UPDATED_AT2 = 'updated_at'; + public const ORDER_STATUS = '-status'; + public const ORDER_STATUS2 = 'status'; + public const FIELDS_ID = 'id'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_UPDATED_AT = 'updated_at'; + public const FIELDS_STATUS = 'status'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_DISCOUNT_AMOUNT = 'discount_amount'; + public const FIELDS_ITEMS_DISCOUNT_AMOUNT = 'items_discount_amount'; + public const FIELDS_TOTAL_DISCOUNT_AMOUNT = 'total_discount_amount'; + public const FIELDS_TOTAL_AMOUNT = 'total_amount'; + public const FIELDS_CUSTOMER_ID = 'customer_id'; + public const FIELDS_REFERRER_ID = 'referrer_id'; + public const FIELDS_METADATA = 'metadata'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + self::ORDER_UPDATED_AT, + self::ORDER_UPDATED_AT2, + self::ORDER_STATUS, + self::ORDER_STATUS2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_ID, + self::FIELDS_SOURCE_ID, + self::FIELDS_CREATED_AT, + self::FIELDS_UPDATED_AT, + self::FIELDS_STATUS, + self::FIELDS_AMOUNT, + self::FIELDS_DISCOUNT_AMOUNT, + self::FIELDS_ITEMS_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_DISCOUNT_AMOUNT, + self::FIELDS_TOTAL_AMOUNT, + self::FIELDS_CUSTOMER_ID, + self::FIELDS_REFERRER_ID, + self::FIELDS_METADATA, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return object|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param object|null $filters Allowed additional properties must start with \"metadata.\" + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + 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/OrdersGetResponseBody.php b/src/Model/OrdersGetResponseBody.php new file mode 100644 index 0000000..5cf8b79 --- /dev/null +++ b/src/Model/OrdersGetResponseBody.php @@ -0,0 +1,1335 @@ + + */ +class OrdersGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'itemsDiscountAmount' => 'int', + 'totalDiscountAmount' => 'int', + 'totalAmount' => 'int', + 'appliedDiscountAmount' => 'int', + 'itemsAppliedDiscountAmount' => 'int', + 'totalAppliedDiscountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderCalculatedItem[]', + 'metadata' => 'object', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'customerId' => 'string', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\CustomerId', + 'referrer' => '\OpenAPI\Client\Model\ReferrerId', + 'redemptions' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'itemsDiscountAmount' => null, + 'totalDiscountAmount' => null, + 'totalAmount' => null, + 'appliedDiscountAmount' => null, + 'itemsAppliedDiscountAmount' => null, + 'totalAppliedDiscountAmount' => null, + 'items' => null, + 'metadata' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'customerId' => null, + 'referrerId' => null, + 'customer' => null, + 'referrer' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'itemsDiscountAmount' => true, + 'totalDiscountAmount' => true, + 'totalAmount' => true, + 'appliedDiscountAmount' => true, + 'itemsAppliedDiscountAmount' => true, + 'totalAppliedDiscountAmount' => true, + 'items' => true, + 'metadata' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'customerId' => true, + 'referrerId' => true, + 'customer' => false, + 'referrer' => false, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'itemsDiscountAmount' => 'items_discount_amount', + 'totalDiscountAmount' => 'total_discount_amount', + 'totalAmount' => 'total_amount', + 'appliedDiscountAmount' => 'applied_discount_amount', + 'itemsAppliedDiscountAmount' => 'items_applied_discount_amount', + 'totalAppliedDiscountAmount' => 'total_applied_discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'customerId' => 'customer_id', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'itemsDiscountAmount' => 'setItemsDiscountAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount', + 'totalAmount' => 'setTotalAmount', + 'appliedDiscountAmount' => 'setAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'setItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'setTotalAppliedDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'customerId' => 'setCustomerId', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'itemsDiscountAmount' => 'getItemsDiscountAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount', + 'totalAmount' => 'getTotalAmount', + 'appliedDiscountAmount' => 'getAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'getItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'getTotalAppliedDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'customerId' => 'getCustomerId', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + public const OBJECT_ORDER = 'order'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ORDER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('itemsDiscountAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountAmount', $data ?? [], null); + $this->setIfExists('itemsAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'order'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $data ?? [], null); + $this->setIfExists('redemptions', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets itemsDiscountAmount + * + * @return int|null + */ + public function getItemsDiscountAmount() + { + return $this->container['itemsDiscountAmount']; + } + + /** + * Sets itemsDiscountAmount + * + * @param int|null $itemsDiscountAmount Sum of all product-specific discounts applied to the order. + * + * @return self + */ + public function setItemsDiscountAmount($itemsDiscountAmount) + { + if (is_null($itemsDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsDiscountAmount'] = $itemsDiscountAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of all order-level AND all product-specific discounts applied to the order. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Order amount after undoing all the discounts through the rollback redemption. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets appliedDiscountAmount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['appliedDiscountAmount']; + } + + /** + * Sets appliedDiscountAmount + * + * @param int|null $appliedDiscountAmount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($appliedDiscountAmount) + { + if (is_null($appliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountAmount'] = $appliedDiscountAmount; + + return $this; + } + + /** + * Gets itemsAppliedDiscountAmount + * + * @return int|null + */ + public function getItemsAppliedDiscountAmount() + { + return $this->container['itemsAppliedDiscountAmount']; + } + + /** + * Sets itemsAppliedDiscountAmount + * + * @param int|null $itemsAppliedDiscountAmount Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + * + * @return self + */ + public function setItemsAppliedDiscountAmount($itemsAppliedDiscountAmount) + { + if (is_null($itemsAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsAppliedDiscountAmount'] = $itemsAppliedDiscountAmount; + + return $this; + } + + /** + * Gets totalAppliedDiscountAmount + * + * @return int|null + */ + public function getTotalAppliedDiscountAmount() + { + return $this->container['totalAppliedDiscountAmount']; + } + + /** + * Sets totalAppliedDiscountAmount + * + * @param int|null $totalAppliedDiscountAmount Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + * + * @return self + */ + public function setTotalAppliedDiscountAmount($totalAppliedDiscountAmount) + { + if (is_null($totalAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAppliedDiscountAmount'] = $totalAppliedDiscountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderCalculatedItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderCalculatedItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the order was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer making the purchase. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\CustomerId|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\CustomerId|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\ReferrerId|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\ReferrerId|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + throw new \InvalidArgumentException('non-nullable referrer cannot be null'); + } + $this->container['referrer'] = $referrer; + + return $this; + } + + /** + * Gets redemptions + * + * @return array|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param array|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/OrdersImportCreateRequestBodyItem.php b/src/Model/OrdersImportCreateRequestBodyItem.php new file mode 100644 index 0000000..eecdabc --- /dev/null +++ b/src/Model/OrdersImportCreateRequestBodyItem.php @@ -0,0 +1,885 @@ + + */ +class OrdersImportCreateRequestBodyItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersImportCreateRequestBodyItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderItem[]', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'referrer' => '\OpenAPI\Client\Model\Referrer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'items' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'referrerId' => null, + 'customer' => null, + 'referrer' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'items' => true, + 'metadata' => true, + 'createdAt' => false, + 'referrerId' => true, + 'customer' => false, + 'referrer' => 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\Referrer|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\Referrer|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + throw new \InvalidArgumentException('non-nullable referrer cannot be null'); + } + $this->container['referrer'] = $referrer; + + 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/OrdersImportCreateResponseBody.php b/src/Model/OrdersImportCreateResponseBody.php new file mode 100644 index 0000000..fb5c63a --- /dev/null +++ b/src/Model/OrdersImportCreateResponseBody.php @@ -0,0 +1,418 @@ + + */ +class OrdersImportCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersImportCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/OrdersListResponseBody.php b/src/Model/OrdersListResponseBody.php new file mode 100644 index 0000000..b95e24c --- /dev/null +++ b/src/Model/OrdersListResponseBody.php @@ -0,0 +1,605 @@ + + */ +class OrdersListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'orders' => '\OpenAPI\Client\Model\OrderCalculated[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'orders' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'orders' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'orders' => 'orders', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'orders' => 'setOrders', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'orders' => 'getOrders', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_ORDERS = 'orders'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_ORDERS, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'orders'); + $this->setIfExists('orders', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about orders in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of order objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\OrderCalculated[]|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\OrderCalculated[]|null $orders Contains array of order objects. + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of orders. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/OrdersUpdateRequestBody.php b/src/Model/OrdersUpdateRequestBody.php new file mode 100644 index 0000000..489c316 --- /dev/null +++ b/src/Model/OrdersUpdateRequestBody.php @@ -0,0 +1,852 @@ + + */ +class OrdersUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderItem[]', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'referrer' => '\OpenAPI\Client\Model\Referrer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'items' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'referrerId' => null, + 'customer' => null, + 'referrer' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'items' => true, + 'metadata' => true, + 'createdAt' => true, + 'referrerId' => true, + 'customer' => false, + 'referrer' => 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 = [ + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * 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('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + 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 sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\Referrer|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\Referrer|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + throw new \InvalidArgumentException('non-nullable referrer cannot be null'); + } + $this->container['referrer'] = $referrer; + + 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/OrdersUpdateResponseBody.php b/src/Model/OrdersUpdateResponseBody.php new file mode 100644 index 0000000..351afbe --- /dev/null +++ b/src/Model/OrdersUpdateResponseBody.php @@ -0,0 +1,1335 @@ + + */ +class OrdersUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrdersUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'itemsDiscountAmount' => 'int', + 'totalDiscountAmount' => 'int', + 'totalAmount' => 'int', + 'appliedDiscountAmount' => 'int', + 'itemsAppliedDiscountAmount' => 'int', + 'totalAppliedDiscountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderCalculatedItem[]', + 'metadata' => 'object', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'customerId' => 'string', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\CustomerId', + 'referrer' => '\OpenAPI\Client\Model\ReferrerId', + 'redemptions' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'itemsDiscountAmount' => null, + 'totalDiscountAmount' => null, + 'totalAmount' => null, + 'appliedDiscountAmount' => null, + 'itemsAppliedDiscountAmount' => null, + 'totalAppliedDiscountAmount' => null, + 'items' => null, + 'metadata' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'customerId' => null, + 'referrerId' => null, + 'customer' => null, + 'referrer' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'itemsDiscountAmount' => true, + 'totalDiscountAmount' => true, + 'totalAmount' => true, + 'appliedDiscountAmount' => true, + 'itemsAppliedDiscountAmount' => true, + 'totalAppliedDiscountAmount' => true, + 'items' => true, + 'metadata' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'customerId' => true, + 'referrerId' => true, + 'customer' => false, + 'referrer' => false, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'itemsDiscountAmount' => 'items_discount_amount', + 'totalDiscountAmount' => 'total_discount_amount', + 'totalAmount' => 'total_amount', + 'appliedDiscountAmount' => 'applied_discount_amount', + 'itemsAppliedDiscountAmount' => 'items_applied_discount_amount', + 'totalAppliedDiscountAmount' => 'total_applied_discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'customerId' => 'customer_id', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'itemsDiscountAmount' => 'setItemsDiscountAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount', + 'totalAmount' => 'setTotalAmount', + 'appliedDiscountAmount' => 'setAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'setItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'setTotalAppliedDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'customerId' => 'setCustomerId', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'itemsDiscountAmount' => 'getItemsDiscountAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount', + 'totalAmount' => 'getTotalAmount', + 'appliedDiscountAmount' => 'getAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'getItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'getTotalAppliedDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'customerId' => 'getCustomerId', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + public const OBJECT_ORDER = 'order'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ORDER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('itemsDiscountAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountAmount', $data ?? [], null); + $this->setIfExists('itemsAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'order'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $data ?? [], null); + $this->setIfExists('redemptions', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets itemsDiscountAmount + * + * @return int|null + */ + public function getItemsDiscountAmount() + { + return $this->container['itemsDiscountAmount']; + } + + /** + * Sets itemsDiscountAmount + * + * @param int|null $itemsDiscountAmount Sum of all product-specific discounts applied to the order. + * + * @return self + */ + public function setItemsDiscountAmount($itemsDiscountAmount) + { + if (is_null($itemsDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsDiscountAmount'] = $itemsDiscountAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of all order-level AND all product-specific discounts applied to the order. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Order amount after undoing all the discounts through the rollback redemption. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets appliedDiscountAmount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['appliedDiscountAmount']; + } + + /** + * Sets appliedDiscountAmount + * + * @param int|null $appliedDiscountAmount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($appliedDiscountAmount) + { + if (is_null($appliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountAmount'] = $appliedDiscountAmount; + + return $this; + } + + /** + * Gets itemsAppliedDiscountAmount + * + * @return int|null + */ + public function getItemsAppliedDiscountAmount() + { + return $this->container['itemsAppliedDiscountAmount']; + } + + /** + * Sets itemsAppliedDiscountAmount + * + * @param int|null $itemsAppliedDiscountAmount Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + * + * @return self + */ + public function setItemsAppliedDiscountAmount($itemsAppliedDiscountAmount) + { + if (is_null($itemsAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsAppliedDiscountAmount'] = $itemsAppliedDiscountAmount; + + return $this; + } + + /** + * Gets totalAppliedDiscountAmount + * + * @return int|null + */ + public function getTotalAppliedDiscountAmount() + { + return $this->container['totalAppliedDiscountAmount']; + } + + /** + * Sets totalAppliedDiscountAmount + * + * @param int|null $totalAppliedDiscountAmount Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + * + * @return self + */ + public function setTotalAppliedDiscountAmount($totalAppliedDiscountAmount) + { + if (is_null($totalAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAppliedDiscountAmount'] = $totalAppliedDiscountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderCalculatedItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderCalculatedItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the order was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer making the purchase. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\CustomerId|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\CustomerId|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\ReferrerId|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\ReferrerId|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + throw new \InvalidArgumentException('non-nullable referrer cannot be null'); + } + $this->container['referrer'] = $referrer; + + return $this; + } + + /** + * Gets redemptions + * + * @return array|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param array|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/ParameterActivityCategory.php b/src/Model/ParameterActivityCategory.php new file mode 100644 index 0000000..48d6d49 --- /dev/null +++ b/src/Model/ParameterActivityCategory.php @@ -0,0 +1,49 @@ + + */ +class ParameterCreatedBeforeAfter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterCreatedBeforeAfter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'before' => '\DateTime', + 'after' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'before' => 'date-time', + 'after' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => true, + 'after' => true + ]; + + /** + * 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 = [ + 'before' => 'before', + 'after' => 'after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'before' => 'setBefore', + 'after' => 'setAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'before' => 'getBefore', + 'after' => 'getAfter' + ]; + + /** + * 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('before', $data ?? [], null); + $this->setIfExists('after', $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 before + * + * @return \DateTime|null + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param \DateTime|null $before Timestamp representing the date and time before the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setBefore($before) + { + if (is_null($before)) { + array_push($this->openAPINullablesSetToNull, 'before'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('before', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['before'] = $before; + + return $this; + } + + /** + * Gets after + * + * @return \DateTime|null + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param \DateTime|null $after Timestamp representing the date and time after the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setAfter($after) + { + if (is_null($after)) { + array_push($this->openAPINullablesSetToNull, 'after'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('after', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['after'] = $after; + + 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/ParameterExpandListCampaigns.php b/src/Model/ParameterExpandListCampaigns.php new file mode 100644 index 0000000..bba8a81 --- /dev/null +++ b/src/Model/ParameterExpandListCampaigns.php @@ -0,0 +1,47 @@ + + */ +class ParameterFiltersListCustomerRedeemables implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemables'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesId', + 'createdAt' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCreatedAt', + 'redeemableId' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableId', + 'redeemableObject' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableObject', + 'holderRole' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesHolderRole', + 'campaignId' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignId', + 'campaignType' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignType', + 'voucherType' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesVoucherType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => null, + 'redeemableId' => null, + 'redeemableObject' => null, + 'holderRole' => null, + 'campaignId' => null, + 'campaignType' => null, + 'voucherType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'redeemableId' => true, + 'redeemableObject' => true, + 'holderRole' => true, + 'campaignId' => true, + 'campaignType' => true, + 'voucherType' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'redeemableId' => 'redeemable_id', + 'redeemableObject' => 'redeemable_object', + 'holderRole' => 'holder_role', + 'campaignId' => 'campaign_id', + 'campaignType' => 'campaign_type', + 'voucherType' => 'voucher_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'redeemableId' => 'setRedeemableId', + 'redeemableObject' => 'setRedeemableObject', + 'holderRole' => 'setHolderRole', + 'campaignId' => 'setCampaignId', + 'campaignType' => 'setCampaignType', + 'voucherType' => 'setVoucherType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'redeemableId' => 'getRedeemableId', + 'redeemableObject' => 'getRedeemableObject', + 'holderRole' => 'getHolderRole', + 'campaignId' => 'getCampaignId', + 'campaignType' => 'getCampaignType', + 'voucherType' => 'getVoucherType' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('redeemableId', $data ?? [], null); + $this->setIfExists('redeemableObject', $data ?? [], null); + $this->setIfExists('holderRole', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], null); + $this->setIfExists('voucherType', $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 id + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesId|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesId|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCreatedAt|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCreatedAt|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets redeemableId + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableId|null + */ + public function getRedeemableId() + { + return $this->container['redeemableId']; + } + + /** + * Sets redeemableId + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableId|null $redeemableId redeemableId + * + * @return self + */ + public function setRedeemableId($redeemableId) + { + if (is_null($redeemableId)) { + array_push($this->openAPINullablesSetToNull, 'redeemableId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemableId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemableId'] = $redeemableId; + + return $this; + } + + /** + * Gets redeemableObject + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableObject|null + */ + public function getRedeemableObject() + { + return $this->container['redeemableObject']; + } + + /** + * Sets redeemableObject + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableObject|null $redeemableObject redeemableObject + * + * @return self + */ + public function setRedeemableObject($redeemableObject) + { + if (is_null($redeemableObject)) { + array_push($this->openAPINullablesSetToNull, 'redeemableObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemableObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemableObject'] = $redeemableObject; + + return $this; + } + + /** + * Gets holderRole + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesHolderRole|null + */ + public function getHolderRole() + { + return $this->container['holderRole']; + } + + /** + * Sets holderRole + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesHolderRole|null $holderRole holderRole + * + * @return self + */ + public function setHolderRole($holderRole) + { + if (is_null($holderRole)) { + array_push($this->openAPINullablesSetToNull, 'holderRole'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderRole', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderRole'] = $holderRole; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignId|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignId|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets campaignType + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignType|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignType|null $campaignType campaignType + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets voucherType + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesVoucherType|null + */ + public function getVoucherType() + { + return $this->container['voucherType']; + } + + /** + * Sets voucherType + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesVoucherType|null $voucherType voucherType + * + * @return self + */ + public function setVoucherType($voucherType) + { + if (is_null($voucherType)) { + array_push($this->openAPINullablesSetToNull, 'voucherType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucherType'] = $voucherType; + + 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/ParameterFiltersListCustomerRedeemablesCampaignId.php b/src/Model/ParameterFiltersListCustomerRedeemablesCampaignId.php new file mode 100644 index 0000000..490e71e --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesCampaignId.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListCustomerRedeemablesCampaignId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesCampaignId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListCustomerRedeemablesCampaignType.php b/src/Model/ParameterFiltersListCustomerRedeemablesCampaignType.php new file mode 100644 index 0000000..d0c7fc0 --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesCampaignType.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListCustomerRedeemablesCampaignType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesCampaignType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignTypeConditions', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignTypeConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCampaignTypeConditions|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.php b/src/Model/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.php new file mode 100644 index 0000000..3fb2ed4 --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.php @@ -0,0 +1,836 @@ + + */ +class ParameterFiltersListCustomerRedeemablesCampaignTypeConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesCampaignType_conditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string', + 'hasValue' => 'string', + 'isUnknown' => 'string', + 'startsWith' => 'string', + 'endsWith' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null, + 'hasValue' => null, + 'isUnknown' => null, + 'startsWith' => null, + 'endsWith' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true, + 'hasValue' => true, + 'isUnknown' => true, + 'startsWith' => true, + 'endsWith' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not', + 'hasValue' => '$has_value', + 'isUnknown' => '$is_unknown', + 'startsWith' => '$starts_with', + 'endsWith' => '$ends_with' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'hasValue' => 'setHasValue', + 'isUnknown' => 'setIsUnknown', + 'startsWith' => 'setStartsWith', + 'endsWith' => 'setEndsWith' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'hasValue' => 'getHasValue', + 'isUnknown' => 'getIsUnknown', + 'startsWith' => 'getStartsWith', + 'endsWith' => 'getEndsWith' + ]; + + /** + * 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 IN_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const IN_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const IN_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const IN_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const NOT_IN_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const NOT_IN_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const NOT_IN_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const NOT_IN_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const IS_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const IS_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const IS_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const IS_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const IS_NOT_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const IS_NOT_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const IS_NOT_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const IS_NOT_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInAllowableValues() + { + return [ + self::IN_LOYALTY_PROGRAM, + self::IN_GIFT_VOUCHERS, + self::IN_DISCOUNT_COUPONS, + self::IN_REFERRAL_PROGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNotInAllowableValues() + { + return [ + self::NOT_IN_LOYALTY_PROGRAM, + self::NOT_IN_GIFT_VOUCHERS, + self::NOT_IN_DISCOUNT_COUPONS, + self::NOT_IN_REFERRAL_PROGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsAllowableValues() + { + return [ + self::IS_LOYALTY_PROGRAM, + self::IS_GIFT_VOUCHERS, + self::IS_DISCOUNT_COUPONS, + self::IS_REFERRAL_PROGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsNotAllowableValues() + { + return [ + self::IS_NOT_LOYALTY_PROGRAM, + self::IS_NOT_GIFT_VOUCHERS, + self::IS_NOT_DISCOUNT_COUPONS, + self::IS_NOT_REFERRAL_PROGRAM, + ]; + } + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isNot', $data ?? [], null); + $this->setIfExists('hasValue', $data ?? [], null); + $this->setIfExists('isUnknown', $data ?? [], null); + $this->setIfExists('startsWith', $data ?? [], null); + $this->setIfExists('endsWith', $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['isNot']) && !in_array($this->container['isNot'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'isNot', must be one of '%s'", + $this->container['isNot'], + 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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInAllowableValues(); + if (!is_null($in) && 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 notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getNotInAllowableValues(); + if (!is_null($notIn) && array_diff($notIn, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'notIn', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Value is exactly this value (single value). + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsAllowableValues(); + if (!is_null($is) && !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 isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results omit this value (single value). + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsNotAllowableValues(); + if (!is_null($isNot) && !in_array($isNot, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'isNot', must be one of '%s'", + $isNot, + implode("', '", $allowedValues) + ) + ); + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets hasValue + * + * @return string|null + */ + public function getHasValue() + { + return $this->container['hasValue']; + } + + /** + * Sets hasValue + * + * @param string|null $hasValue Value is NOT null. The value for this parameter is an empty string. + * + * @return self + */ + public function setHasValue($hasValue) + { + if (is_null($hasValue)) { + array_push($this->openAPINullablesSetToNull, 'hasValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasValue'] = $hasValue; + + return $this; + } + + /** + * Gets isUnknown + * + * @return string|null + */ + public function getIsUnknown() + { + return $this->container['isUnknown']; + } + + /** + * Sets isUnknown + * + * @param string|null $isUnknown Value is null. The value for this parameter is an empty string. + * + * @return self + */ + public function setIsUnknown($isUnknown) + { + if (is_null($isUnknown)) { + array_push($this->openAPINullablesSetToNull, 'isUnknown'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isUnknown', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isUnknown'] = $isUnknown; + + return $this; + } + + /** + * Gets startsWith + * + * @return string|null + */ + public function getStartsWith() + { + return $this->container['startsWith']; + } + + /** + * Sets startsWith + * + * @param string|null $startsWith Value starts with the specified string. + * + * @return self + */ + public function setStartsWith($startsWith) + { + if (is_null($startsWith)) { + array_push($this->openAPINullablesSetToNull, 'startsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startsWith'] = $startsWith; + + return $this; + } + + /** + * Gets endsWith + * + * @return string|null + */ + public function getEndsWith() + { + return $this->container['endsWith']; + } + + /** + * Sets endsWith + * + * @param string|null $endsWith Value ends with the specified string. + * + * @return self + */ + public function setEndsWith($endsWith) + { + if (is_null($endsWith)) { + array_push($this->openAPINullablesSetToNull, 'endsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('endsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['endsWith'] = $endsWith; + + 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/ParameterFiltersListCustomerRedeemablesCreatedAt.php b/src/Model/ParameterFiltersListCustomerRedeemablesCreatedAt.php new file mode 100644 index 0000000..1da346e --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesCreatedAt.php @@ -0,0 +1,493 @@ + + */ +class ParameterFiltersListCustomerRedeemablesCreatedAt implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesCreatedAt'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCreatedAtConditions', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => true, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCreatedAtConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesCreatedAtConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['conditions'] = $conditions; + + return $this; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.php b/src/Model/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.php new file mode 100644 index 0000000..e27ce73 --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.php @@ -0,0 +1,623 @@ + + */ +class ParameterFiltersListCustomerRedeemablesCreatedAtConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesCreatedAtConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'after' => '\DateTime', + 'before' => '\DateTime', + 'hasValue' => 'string', + 'isUnknown' => 'string', + 'moreThan' => 'int', + 'lessThan' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'after' => 'date-time', + 'before' => 'date-time', + 'hasValue' => null, + 'isUnknown' => null, + 'moreThan' => null, + 'lessThan' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'after' => true, + 'before' => true, + 'hasValue' => true, + 'isUnknown' => true, + 'moreThan' => true, + 'lessThan' => true + ]; + + /** + * 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 = [ + 'after' => '$after', + 'before' => '$before', + 'hasValue' => '$has_value', + 'isUnknown' => '$is_unknown', + 'moreThan' => 'more_than', + 'lessThan' => 'less_than' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'after' => 'setAfter', + 'before' => 'setBefore', + 'hasValue' => 'setHasValue', + 'isUnknown' => 'setIsUnknown', + 'moreThan' => 'setMoreThan', + 'lessThan' => 'setLessThan' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'after' => 'getAfter', + 'before' => 'getBefore', + 'hasValue' => 'getHasValue', + 'isUnknown' => 'getIsUnknown', + 'moreThan' => 'getMoreThan', + 'lessThan' => 'getLessThan' + ]; + + /** + * 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('after', $data ?? [], null); + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('hasValue', $data ?? [], null); + $this->setIfExists('isUnknown', $data ?? [], null); + $this->setIfExists('moreThan', $data ?? [], null); + $this->setIfExists('lessThan', $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 after + * + * @return \DateTime|null + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param \DateTime|null $after Value is after this date. The value for this parameter is shown in the ISO 8601 format. + * + * @return self + */ + public function setAfter($after) + { + if (is_null($after)) { + array_push($this->openAPINullablesSetToNull, 'after'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('after', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['after'] = $after; + + return $this; + } + + /** + * Gets before + * + * @return \DateTime|null + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param \DateTime|null $before Value is before this date. The value for this parameter is shown in the ISO 8601 format. + * + * @return self + */ + public function setBefore($before) + { + if (is_null($before)) { + array_push($this->openAPINullablesSetToNull, 'before'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('before', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['before'] = $before; + + return $this; + } + + /** + * Gets hasValue + * + * @return string|null + */ + public function getHasValue() + { + return $this->container['hasValue']; + } + + /** + * Sets hasValue + * + * @param string|null $hasValue Value is NOT null. The value for this parameter is an empty string. + * + * @return self + */ + public function setHasValue($hasValue) + { + if (is_null($hasValue)) { + array_push($this->openAPINullablesSetToNull, 'hasValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasValue'] = $hasValue; + + return $this; + } + + /** + * Gets isUnknown + * + * @return string|null + */ + public function getIsUnknown() + { + return $this->container['isUnknown']; + } + + /** + * Sets isUnknown + * + * @param string|null $isUnknown Value is null. The value for this parameter is an empty string. + * + * @return self + */ + public function setIsUnknown($isUnknown) + { + if (is_null($isUnknown)) { + array_push($this->openAPINullablesSetToNull, 'isUnknown'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isUnknown', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isUnknown'] = $isUnknown; + + return $this; + } + + /** + * Gets moreThan + * + * @return int|null + */ + public function getMoreThan() + { + return $this->container['moreThan']; + } + + /** + * Sets moreThan + * + * @param int|null $moreThan Value is more days ago before the current date and time, e.g. more than `10` days ago. + * + * @return self + */ + public function setMoreThan($moreThan) + { + if (is_null($moreThan)) { + array_push($this->openAPINullablesSetToNull, 'moreThan'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreThan', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreThan'] = $moreThan; + + return $this; + } + + /** + * Gets lessThan + * + * @return int|null + */ + public function getLessThan() + { + return $this->container['lessThan']; + } + + /** + * Sets lessThan + * + * @param int|null $lessThan Value is less days before the current date and time, e.g. less than `10` days ago. + * + * @return self + */ + public function setLessThan($lessThan) + { + if (is_null($lessThan)) { + array_push($this->openAPINullablesSetToNull, 'lessThan'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lessThan', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lessThan'] = $lessThan; + + 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/ParameterFiltersListCustomerRedeemablesHolderRole.php b/src/Model/ParameterFiltersListCustomerRedeemablesHolderRole.php new file mode 100644 index 0000000..25c9b07 --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesHolderRole.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListCustomerRedeemablesHolderRole implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesHolderRole'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesHolderRoleConditions', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesHolderRoleConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesHolderRoleConditions|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.php b/src/Model/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.php new file mode 100644 index 0000000..ec664f9 --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.php @@ -0,0 +1,828 @@ + + */ +class ParameterFiltersListCustomerRedeemablesHolderRoleConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesHolderRole_conditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string', + 'hasValue' => 'string', + 'isUnknown' => 'string', + 'startsWith' => 'string', + 'endsWith' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null, + 'hasValue' => null, + 'isUnknown' => null, + 'startsWith' => null, + 'endsWith' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true, + 'hasValue' => true, + 'isUnknown' => true, + 'startsWith' => true, + 'endsWith' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not', + 'hasValue' => '$has_value', + 'isUnknown' => '$is_unknown', + 'startsWith' => '$starts_with', + 'endsWith' => '$ends_with' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'hasValue' => 'setHasValue', + 'isUnknown' => 'setIsUnknown', + 'startsWith' => 'setStartsWith', + 'endsWith' => 'setEndsWith' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'hasValue' => 'getHasValue', + 'isUnknown' => 'getIsUnknown', + 'startsWith' => 'getStartsWith', + 'endsWith' => 'getEndsWith' + ]; + + /** + * 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 IN_OWNER = 'OWNER'; + public const IN_REFEREE = 'REFEREE'; + public const IN_REFERRER = 'REFERRER'; + public const NOT_IN_OWNER = 'OWNER'; + public const NOT_IN_REFEREE = 'REFEREE'; + public const NOT_IN_REFERRER = 'REFERRER'; + public const IS_OWNER = 'OWNER'; + public const IS_REFEREE = 'REFEREE'; + public const IS_REFERRER = 'REFERRER'; + public const IS_NOT_OWNER = 'OWNER'; + public const IS_NOT_REFEREE = 'REFEREE'; + public const IS_NOT_REFERRER = 'REFERRER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInAllowableValues() + { + return [ + self::IN_OWNER, + self::IN_REFEREE, + self::IN_REFERRER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNotInAllowableValues() + { + return [ + self::NOT_IN_OWNER, + self::NOT_IN_REFEREE, + self::NOT_IN_REFERRER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsAllowableValues() + { + return [ + self::IS_OWNER, + self::IS_REFEREE, + self::IS_REFERRER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsNotAllowableValues() + { + return [ + self::IS_NOT_OWNER, + self::IS_NOT_REFEREE, + self::IS_NOT_REFERRER, + ]; + } + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isNot', $data ?? [], null); + $this->setIfExists('hasValue', $data ?? [], null); + $this->setIfExists('isUnknown', $data ?? [], null); + $this->setIfExists('startsWith', $data ?? [], null); + $this->setIfExists('endsWith', $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['isNot']) && !in_array($this->container['isNot'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'isNot', must be one of '%s'", + $this->container['isNot'], + 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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInAllowableValues(); + if (!is_null($in) && 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 notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getNotInAllowableValues(); + if (!is_null($notIn) && array_diff($notIn, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'notIn', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Value is exactly this value (single value). + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsAllowableValues(); + if (!is_null($is) && !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 isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results omit this value (single value). + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsNotAllowableValues(); + if (!is_null($isNot) && !in_array($isNot, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'isNot', must be one of '%s'", + $isNot, + implode("', '", $allowedValues) + ) + ); + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets hasValue + * + * @return string|null + */ + public function getHasValue() + { + return $this->container['hasValue']; + } + + /** + * Sets hasValue + * + * @param string|null $hasValue Value is NOT null. The value for this parameter is an empty string. + * + * @return self + */ + public function setHasValue($hasValue) + { + if (is_null($hasValue)) { + array_push($this->openAPINullablesSetToNull, 'hasValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasValue'] = $hasValue; + + return $this; + } + + /** + * Gets isUnknown + * + * @return string|null + */ + public function getIsUnknown() + { + return $this->container['isUnknown']; + } + + /** + * Sets isUnknown + * + * @param string|null $isUnknown Value is null. The value for this parameter is an empty string. + * + * @return self + */ + public function setIsUnknown($isUnknown) + { + if (is_null($isUnknown)) { + array_push($this->openAPINullablesSetToNull, 'isUnknown'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isUnknown', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isUnknown'] = $isUnknown; + + return $this; + } + + /** + * Gets startsWith + * + * @return string|null + */ + public function getStartsWith() + { + return $this->container['startsWith']; + } + + /** + * Sets startsWith + * + * @param string|null $startsWith Value starts with the specified string. + * + * @return self + */ + public function setStartsWith($startsWith) + { + if (is_null($startsWith)) { + array_push($this->openAPINullablesSetToNull, 'startsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startsWith'] = $startsWith; + + return $this; + } + + /** + * Gets endsWith + * + * @return string|null + */ + public function getEndsWith() + { + return $this->container['endsWith']; + } + + /** + * Sets endsWith + * + * @param string|null $endsWith Value ends with the specified string. + * + * @return self + */ + public function setEndsWith($endsWith) + { + if (is_null($endsWith)) { + array_push($this->openAPINullablesSetToNull, 'endsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('endsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['endsWith'] = $endsWith; + + 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/ParameterFiltersListCustomerRedeemablesId.php b/src/Model/ParameterFiltersListCustomerRedeemablesId.php new file mode 100644 index 0000000..cc35ceb --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesId.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListCustomerRedeemablesId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListCustomerRedeemablesRedeemableId.php b/src/Model/ParameterFiltersListCustomerRedeemablesRedeemableId.php new file mode 100644 index 0000000..b25d9d5 --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesRedeemableId.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListCustomerRedeemablesRedeemableId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesRedeemableId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListCustomerRedeemablesRedeemableObject.php b/src/Model/ParameterFiltersListCustomerRedeemablesRedeemableObject.php new file mode 100644 index 0000000..24f576a --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesRedeemableObject.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListCustomerRedeemablesRedeemableObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesRedeemableObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.php b/src/Model/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.php new file mode 100644 index 0000000..60d444b --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.php @@ -0,0 +1,812 @@ + + */ +class ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesRedeemableObject_conditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string', + 'hasValue' => 'string', + 'isUnknown' => 'string', + 'startsWith' => 'string', + 'endsWith' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null, + 'hasValue' => null, + 'isUnknown' => null, + 'startsWith' => null, + 'endsWith' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true, + 'hasValue' => true, + 'isUnknown' => true, + 'startsWith' => true, + 'endsWith' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not', + 'hasValue' => '$has_value', + 'isUnknown' => '$is_unknown', + 'startsWith' => '$starts_with', + 'endsWith' => '$ends_with' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'hasValue' => 'setHasValue', + 'isUnknown' => 'setIsUnknown', + 'startsWith' => 'setStartsWith', + 'endsWith' => 'setEndsWith' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'hasValue' => 'getHasValue', + 'isUnknown' => 'getIsUnknown', + 'startsWith' => 'getStartsWith', + 'endsWith' => 'getEndsWith' + ]; + + /** + * 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 IN_VOUCHER = 'voucher'; + public const NOT_IN_VOUCHER = 'voucher'; + public const IS_VOUCHER = 'voucher'; + public const IS_NOT_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInAllowableValues() + { + return [ + self::IN_VOUCHER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNotInAllowableValues() + { + return [ + self::NOT_IN_VOUCHER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsAllowableValues() + { + return [ + self::IS_VOUCHER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsNotAllowableValues() + { + return [ + self::IS_NOT_VOUCHER, + ]; + } + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], 'voucher'); + $this->setIfExists('isNot', $data ?? [], 'voucher'); + $this->setIfExists('hasValue', $data ?? [], null); + $this->setIfExists('isUnknown', $data ?? [], null); + $this->setIfExists('startsWith', $data ?? [], null); + $this->setIfExists('endsWith', $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['isNot']) && !in_array($this->container['isNot'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'isNot', must be one of '%s'", + $this->container['isNot'], + 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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInAllowableValues(); + if (!is_null($in) && 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 notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getNotInAllowableValues(); + if (!is_null($notIn) && array_diff($notIn, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'notIn', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Value is exactly this value (single value). + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsAllowableValues(); + if (!is_null($is) && !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 isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results omit this value (single value). + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsNotAllowableValues(); + if (!is_null($isNot) && !in_array($isNot, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'isNot', must be one of '%s'", + $isNot, + implode("', '", $allowedValues) + ) + ); + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets hasValue + * + * @return string|null + */ + public function getHasValue() + { + return $this->container['hasValue']; + } + + /** + * Sets hasValue + * + * @param string|null $hasValue Value is NOT null. The value for this parameter is an empty string. + * + * @return self + */ + public function setHasValue($hasValue) + { + if (is_null($hasValue)) { + array_push($this->openAPINullablesSetToNull, 'hasValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasValue'] = $hasValue; + + return $this; + } + + /** + * Gets isUnknown + * + * @return string|null + */ + public function getIsUnknown() + { + return $this->container['isUnknown']; + } + + /** + * Sets isUnknown + * + * @param string|null $isUnknown Value is null. The value for this parameter is an empty string. + * + * @return self + */ + public function setIsUnknown($isUnknown) + { + if (is_null($isUnknown)) { + array_push($this->openAPINullablesSetToNull, 'isUnknown'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isUnknown', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isUnknown'] = $isUnknown; + + return $this; + } + + /** + * Gets startsWith + * + * @return string|null + */ + public function getStartsWith() + { + return $this->container['startsWith']; + } + + /** + * Sets startsWith + * + * @param string|null $startsWith Value starts with the specified string. + * + * @return self + */ + public function setStartsWith($startsWith) + { + if (is_null($startsWith)) { + array_push($this->openAPINullablesSetToNull, 'startsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startsWith'] = $startsWith; + + return $this; + } + + /** + * Gets endsWith + * + * @return string|null + */ + public function getEndsWith() + { + return $this->container['endsWith']; + } + + /** + * Sets endsWith + * + * @param string|null $endsWith Value ends with the specified string. + * + * @return self + */ + public function setEndsWith($endsWith) + { + if (is_null($endsWith)) { + array_push($this->openAPINullablesSetToNull, 'endsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('endsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['endsWith'] = $endsWith; + + 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/ParameterFiltersListCustomerRedeemablesVoucherType.php b/src/Model/ParameterFiltersListCustomerRedeemablesVoucherType.php new file mode 100644 index 0000000..4631612 --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesVoucherType.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListCustomerRedeemablesVoucherType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesVoucherType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesVoucherTypeConditions', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesVoucherTypeConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemablesVoucherTypeConditions|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.php b/src/Model/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.php new file mode 100644 index 0000000..044dd5f --- /dev/null +++ b/src/Model/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.php @@ -0,0 +1,828 @@ + + */ +class ParameterFiltersListCustomerRedeemablesVoucherTypeConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListCustomerRedeemablesVoucherType_conditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]', + 'notIn' => 'string[]', + 'is' => 'string', + 'isNot' => 'string', + 'hasValue' => 'string', + 'isUnknown' => 'string', + 'startsWith' => 'string', + 'endsWith' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null, + 'notIn' => null, + 'is' => null, + 'isNot' => null, + 'hasValue' => null, + 'isUnknown' => null, + 'startsWith' => null, + 'endsWith' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true, + 'notIn' => true, + 'is' => true, + 'isNot' => true, + 'hasValue' => true, + 'isUnknown' => true, + 'startsWith' => true, + 'endsWith' => true + ]; + + /** + * 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 = [ + 'in' => '$in', + 'notIn' => '$not_in', + 'is' => '$is', + 'isNot' => '$is_not', + 'hasValue' => '$has_value', + 'isUnknown' => '$is_unknown', + 'startsWith' => '$starts_with', + 'endsWith' => '$ends_with' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn', + 'notIn' => 'setNotIn', + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'hasValue' => 'setHasValue', + 'isUnknown' => 'setIsUnknown', + 'startsWith' => 'setStartsWith', + 'endsWith' => 'setEndsWith' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn', + 'notIn' => 'getNotIn', + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'hasValue' => 'getHasValue', + 'isUnknown' => 'getIsUnknown', + 'startsWith' => 'getStartsWith', + 'endsWith' => 'getEndsWith' + ]; + + /** + * 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 IN_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const IN_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const IN_LOYALTY_CARD = 'LOYALTY_CARD'; + public const NOT_IN_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const NOT_IN_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const NOT_IN_LOYALTY_CARD = 'LOYALTY_CARD'; + public const IS_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const IS_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const IS_LOYALTY_CARD = 'LOYALTY_CARD'; + public const IS_NOT_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const IS_NOT_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const IS_NOT_LOYALTY_CARD = 'LOYALTY_CARD'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInAllowableValues() + { + return [ + self::IN_GIFT_VOUCHER, + self::IN_DISCOUNT_VOUCHER, + self::IN_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNotInAllowableValues() + { + return [ + self::NOT_IN_GIFT_VOUCHER, + self::NOT_IN_DISCOUNT_VOUCHER, + self::NOT_IN_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsAllowableValues() + { + return [ + self::IS_GIFT_VOUCHER, + self::IS_DISCOUNT_VOUCHER, + self::IS_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsNotAllowableValues() + { + return [ + self::IS_NOT_GIFT_VOUCHER, + self::IS_NOT_DISCOUNT_VOUCHER, + self::IS_NOT_LOYALTY_CARD, + ]; + } + + /** + * 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('in', $data ?? [], null); + $this->setIfExists('notIn', $data ?? [], null); + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('isNot', $data ?? [], null); + $this->setIfExists('hasValue', $data ?? [], null); + $this->setIfExists('isUnknown', $data ?? [], null); + $this->setIfExists('startsWith', $data ?? [], null); + $this->setIfExists('endsWith', $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['isNot']) && !in_array($this->container['isNot'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'isNot', must be one of '%s'", + $this->container['isNot'], + 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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInAllowableValues(); + if (!is_null($in) && 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 notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Array of resource values that should be included in the results (multiple values). + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getNotInAllowableValues(); + if (!is_null($notIn) && array_diff($notIn, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'notIn', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['notIn'] = $notIn; + + return $this; + } + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Value is exactly this value (single value). + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsAllowableValues(); + if (!is_null($is) && !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 isNot + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string|null $isNot Results omit this value (single value). + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsNotAllowableValues(); + if (!is_null($isNot) && !in_array($isNot, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'isNot', must be one of '%s'", + $isNot, + implode("', '", $allowedValues) + ) + ); + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets hasValue + * + * @return string|null + */ + public function getHasValue() + { + return $this->container['hasValue']; + } + + /** + * Sets hasValue + * + * @param string|null $hasValue Value is NOT null. The value for this parameter is an empty string. + * + * @return self + */ + public function setHasValue($hasValue) + { + if (is_null($hasValue)) { + array_push($this->openAPINullablesSetToNull, 'hasValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasValue'] = $hasValue; + + return $this; + } + + /** + * Gets isUnknown + * + * @return string|null + */ + public function getIsUnknown() + { + return $this->container['isUnknown']; + } + + /** + * Sets isUnknown + * + * @param string|null $isUnknown Value is null. The value for this parameter is an empty string. + * + * @return self + */ + public function setIsUnknown($isUnknown) + { + if (is_null($isUnknown)) { + array_push($this->openAPINullablesSetToNull, 'isUnknown'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isUnknown', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isUnknown'] = $isUnknown; + + return $this; + } + + /** + * Gets startsWith + * + * @return string|null + */ + public function getStartsWith() + { + return $this->container['startsWith']; + } + + /** + * Sets startsWith + * + * @param string|null $startsWith Value starts with the specified string. + * + * @return self + */ + public function setStartsWith($startsWith) + { + if (is_null($startsWith)) { + array_push($this->openAPINullablesSetToNull, 'startsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startsWith'] = $startsWith; + + return $this; + } + + /** + * Gets endsWith + * + * @return string|null + */ + public function getEndsWith() + { + return $this->container['endsWith']; + } + + /** + * Sets endsWith + * + * @param string|null $endsWith Value ends with the specified string. + * + * @return self + */ + public function setEndsWith($endsWith) + { + if (is_null($endsWith)) { + array_push($this->openAPINullablesSetToNull, 'endsWith'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('endsWith', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['endsWith'] = $endsWith; + + 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/ParameterFiltersListRedemptions.php b/src/Model/ParameterFiltersListRedemptions.php new file mode 100644 index 0000000..0ccf76c --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptions.php @@ -0,0 +1,786 @@ + + */ +class ParameterFiltersListRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'voucherCode' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsVoucherCode', + 'relatedObjectId' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsRelatedObjectId', + 'relatedObjectParentId' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsRelatedObjectParentId', + 'parentRedemptionId' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsParentRedemptionId', + 'failureCode' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsFailureCode', + 'result' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsResult', + 'object' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsObject', + 'customerId' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsCustomerId', + 'campaignName' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsCampaignName', + 'userLogin' => '\OpenAPI\Client\Model\ParameterFiltersListRedemptionsUserLogin' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'voucherCode' => null, + 'relatedObjectId' => null, + 'relatedObjectParentId' => null, + 'parentRedemptionId' => null, + 'failureCode' => null, + 'result' => null, + 'object' => null, + 'customerId' => null, + 'campaignName' => null, + 'userLogin' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'voucherCode' => true, + 'relatedObjectId' => true, + 'relatedObjectParentId' => true, + 'parentRedemptionId' => true, + 'failureCode' => true, + 'result' => true, + 'object' => true, + 'customerId' => true, + 'campaignName' => true, + 'userLogin' => true + ]; + + /** + * 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 = [ + 'voucherCode' => 'voucher_code', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectParentId' => 'related_object_parent_id', + 'parentRedemptionId' => 'parent_redemption_id', + 'failureCode' => 'failure_code', + 'result' => 'result', + 'object' => 'object', + 'customerId' => 'customer_id', + 'campaignName' => 'campaign_name', + 'userLogin' => 'user_login' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'voucherCode' => 'setVoucherCode', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectParentId' => 'setRelatedObjectParentId', + 'parentRedemptionId' => 'setParentRedemptionId', + 'failureCode' => 'setFailureCode', + 'result' => 'setResult', + 'object' => 'setObject', + 'customerId' => 'setCustomerId', + 'campaignName' => 'setCampaignName', + 'userLogin' => 'setUserLogin' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'voucherCode' => 'getVoucherCode', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectParentId' => 'getRelatedObjectParentId', + 'parentRedemptionId' => 'getParentRedemptionId', + 'failureCode' => 'getFailureCode', + 'result' => 'getResult', + 'object' => 'getObject', + 'customerId' => 'getCustomerId', + 'campaignName' => 'getCampaignName', + 'userLogin' => 'getUserLogin' + ]; + + /** + * 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('voucherCode', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectParentId', $data ?? [], null); + $this->setIfExists('parentRedemptionId', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('campaignName', $data ?? [], null); + $this->setIfExists('userLogin', $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 voucherCode + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsVoucherCode|null + */ + public function getVoucherCode() + { + return $this->container['voucherCode']; + } + + /** + * Sets voucherCode + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsVoucherCode|null $voucherCode voucherCode + * + * @return self + */ + public function setVoucherCode($voucherCode) + { + if (is_null($voucherCode)) { + array_push($this->openAPINullablesSetToNull, 'voucherCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucherCode'] = $voucherCode; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsRelatedObjectId|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsRelatedObjectId|null $relatedObjectId relatedObjectId + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectParentId + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsRelatedObjectParentId|null + */ + public function getRelatedObjectParentId() + { + return $this->container['relatedObjectParentId']; + } + + /** + * Sets relatedObjectParentId + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsRelatedObjectParentId|null $relatedObjectParentId relatedObjectParentId + * + * @return self + */ + public function setRelatedObjectParentId($relatedObjectParentId) + { + if (is_null($relatedObjectParentId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectParentId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectParentId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectParentId'] = $relatedObjectParentId; + + return $this; + } + + /** + * Gets parentRedemptionId + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsParentRedemptionId|null + */ + public function getParentRedemptionId() + { + return $this->container['parentRedemptionId']; + } + + /** + * Sets parentRedemptionId + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsParentRedemptionId|null $parentRedemptionId parentRedemptionId + * + * @return self + */ + public function setParentRedemptionId($parentRedemptionId) + { + if (is_null($parentRedemptionId)) { + array_push($this->openAPINullablesSetToNull, 'parentRedemptionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parentRedemptionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parentRedemptionId'] = $parentRedemptionId; + + return $this; + } + + /** + * Gets failureCode + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsFailureCode|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsFailureCode|null $failureCode failureCode + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets object + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsObject|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsObject|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets customerId + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsCustomerId|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsCustomerId|null $customerId customerId + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets campaignName + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsCampaignName|null + */ + public function getCampaignName() + { + return $this->container['campaignName']; + } + + /** + * Sets campaignName + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsCampaignName|null $campaignName campaignName + * + * @return self + */ + public function setCampaignName($campaignName) + { + if (is_null($campaignName)) { + array_push($this->openAPINullablesSetToNull, 'campaignName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignName'] = $campaignName; + + return $this; + } + + /** + * Gets userLogin + * + * @return \OpenAPI\Client\Model\ParameterFiltersListRedemptionsUserLogin|null + */ + public function getUserLogin() + { + return $this->container['userLogin']; + } + + /** + * Sets userLogin + * + * @param \OpenAPI\Client\Model\ParameterFiltersListRedemptionsUserLogin|null $userLogin userLogin + * + * @return self + */ + public function setUserLogin($userLogin) + { + if (is_null($userLogin)) { + array_push($this->openAPINullablesSetToNull, 'userLogin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('userLogin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['userLogin'] = $userLogin; + + 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/ParameterFiltersListRedemptionsCampaignName.php b/src/Model/ParameterFiltersListRedemptionsCampaignName.php new file mode 100644 index 0000000..b619cbb --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsCampaignName.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsCampaignName implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsCampaignName'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsCustomerId.php b/src/Model/ParameterFiltersListRedemptionsCustomerId.php new file mode 100644 index 0000000..e9c73a1 --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsCustomerId.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsCustomerId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsCustomerId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsFailureCode.php b/src/Model/ParameterFiltersListRedemptionsFailureCode.php new file mode 100644 index 0000000..268002c --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsFailureCode.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsFailureCode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsFailureCode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsObject.php b/src/Model/ParameterFiltersListRedemptionsObject.php new file mode 100644 index 0000000..fba1e4f --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsObject.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsParentRedemptionId.php b/src/Model/ParameterFiltersListRedemptionsParentRedemptionId.php new file mode 100644 index 0000000..1437694 --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsParentRedemptionId.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsParentRedemptionId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsParentRedemptionId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsRelatedObjectId.php b/src/Model/ParameterFiltersListRedemptionsRelatedObjectId.php new file mode 100644 index 0000000..55ecb63 --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsRelatedObjectId.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsRelatedObjectId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsRelatedObjectId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsRelatedObjectParentId.php b/src/Model/ParameterFiltersListRedemptionsRelatedObjectParentId.php new file mode 100644 index 0000000..3d23f5a --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsRelatedObjectParentId.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsRelatedObjectParentId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsRelatedObjectParentId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsResult.php b/src/Model/ParameterFiltersListRedemptionsResult.php new file mode 100644 index 0000000..2821df6 --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsResult.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsUserLogin.php b/src/Model/ParameterFiltersListRedemptionsUserLogin.php new file mode 100644 index 0000000..588b79e --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsUserLogin.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsUserLogin implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsUserLogin'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterFiltersListRedemptionsVoucherCode.php b/src/Model/ParameterFiltersListRedemptionsVoucherCode.php new file mode 100644 index 0000000..d0d8866 --- /dev/null +++ b/src/Model/ParameterFiltersListRedemptionsVoucherCode.php @@ -0,0 +1,486 @@ + + */ +class ParameterFiltersListRedemptionsVoucherCode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterFiltersListRedemptionsVoucherCode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\FilterConditionsString', + 'junction' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null, + 'junction' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false, + 'junction' => true + ]; + + /** + * 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', + 'junction' => 'junction' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions', + 'junction' => 'setJunction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions', + 'junction' => 'getJunction' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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); + $this->setIfExists('junction', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 conditions + * + * @return \OpenAPI\Client\Model\FilterConditionsString|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\FilterConditionsString|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; + } + + /** + * Gets junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + 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/ParameterOrder.php b/src/Model/ParameterOrder.php new file mode 100644 index 0000000..7259ebc --- /dev/null +++ b/src/Model/ParameterOrder.php @@ -0,0 +1,69 @@ + + */ +class ParameterUpdatedBeforeAfter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ParameterUpdatedBeforeAfter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'before' => '\DateTime', + 'after' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'before' => 'date-time', + 'after' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => true, + 'after' => true + ]; + + /** + * 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 = [ + 'before' => 'before', + 'after' => 'after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'before' => 'setBefore', + 'after' => 'setAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'before' => 'getBefore', + 'after' => 'getAfter' + ]; + + /** + * 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('before', $data ?? [], null); + $this->setIfExists('after', $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 before + * + * @return \DateTime|null + */ + public function getBefore() + { + return $this->container['before']; + } + + /** + * Sets before + * + * @param \DateTime|null $before Timestamp representing the date and time before the voucher was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setBefore($before) + { + if (is_null($before)) { + array_push($this->openAPINullablesSetToNull, 'before'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('before', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['before'] = $before; + + return $this; + } + + /** + * Gets after + * + * @return \DateTime|null + */ + public function getAfter() + { + return $this->container['after']; + } + + /** + * Sets after + * + * @param \DateTime|null $after Timestamp representing the date and time after the voucher was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setAfter($after) + { + if (is_null($after)) { + array_push($this->openAPINullablesSetToNull, 'after'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('after', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['after'] = $after; + + 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/ParameterVoucherTypeListPublications.php b/src/Model/ParameterVoucherTypeListPublications.php new file mode 100644 index 0000000..e13e6e8 --- /dev/null +++ b/src/Model/ParameterVoucherTypeListPublications.php @@ -0,0 +1,51 @@ + + */ +class Product implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Product'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'metadata' => 'object', + 'imageUrl' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'skus' => '\OpenAPI\Client\Model\SkusListForProduct' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'skus' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'price' => true, + 'attributes' => true, + 'metadata' => true, + 'imageUrl' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'skus' => 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'skus' => 'skus' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'skus' => 'setSkus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'skus' => 'getSkus' + ]; + + /** + * 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 OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'product'); + $this->setIfExists('skus', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique product source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the product. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\SkusListForProduct|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\SkusListForProduct|null $skus skus + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + throw new \InvalidArgumentException('non-nullable skus cannot be null'); + } + $this->container['skus'] = $skus; + + 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/ProductCollectionsCreateRequestBody.php b/src/Model/ProductCollectionsCreateRequestBody.php new file mode 100644 index 0000000..46cb1db --- /dev/null +++ b/src/Model/ProductCollectionsCreateRequestBody.php @@ -0,0 +1,565 @@ + + */ +class ProductCollectionsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'name' => 'string', + 'products' => '\OpenAPI\Client\Model\ProductCollectionsCreateRequestBodyProductsItem[]', + 'filter' => '\OpenAPI\Client\Model\ProductCollectionsCreateRequestBodyFilter' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'name' => null, + 'products' => null, + 'filter' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'name' => true, + 'products' => true, + 'filter' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'name' => 'name', + 'products' => 'products', + 'filter' => 'filter' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'name' => 'setName', + 'products' => 'setProducts', + 'filter' => 'setFilter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'name' => 'getName', + 'products' => 'getProducts', + 'filter' => 'getFilter' + ]; + + /** + * 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 TYPE__STATIC = 'STATIC'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE__STATIC, + ]; + } + + /** + * 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('type', $data ?? [], 'STATIC'); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('products', $data ?? [], null); + $this->setIfExists('filter', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Show that the product collection is static (manually selected products). + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product collection name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets products + * + * @return \OpenAPI\Client\Model\ProductCollectionsCreateRequestBodyProductsItem[]|null + */ + public function getProducts() + { + return $this->container['products']; + } + + /** + * Sets products + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateRequestBodyProductsItem[]|null $products Defines a set of products for a `STATIC` product collection type. + * + * @return self + */ + public function setProducts($products) + { + if (is_null($products)) { + array_push($this->openAPINullablesSetToNull, 'products'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('products', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['products'] = $products; + + return $this; + } + + /** + * Gets filter + * + * @return \OpenAPI\Client\Model\ProductCollectionsCreateRequestBodyFilter|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateRequestBodyFilter|null $filter filter + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + array_push($this->openAPINullablesSetToNull, 'filter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filter'] = $filter; + + 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/ProductCollectionsCreateRequestBodyFilter.php b/src/Model/ProductCollectionsCreateRequestBodyFilter.php new file mode 100644 index 0000000..b5f308a --- /dev/null +++ b/src/Model/ProductCollectionsCreateRequestBodyFilter.php @@ -0,0 +1,860 @@ + + */ +class ProductCollectionsCreateRequestBodyFilter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsCreateRequestBodyFilter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'id' => '\OpenAPI\Client\Model\FieldConditions', + 'productId' => '\OpenAPI\Client\Model\FieldConditions', + 'sourceId' => '\OpenAPI\Client\Model\FieldConditions', + 'name' => '\OpenAPI\Client\Model\FieldConditions', + 'price' => '\OpenAPI\Client\Model\FieldConditions', + 'object' => '\OpenAPI\Client\Model\FieldConditions', + 'attributes' => '\OpenAPI\Client\Model\FieldConditions', + 'metadata' => '\OpenAPI\Client\Model\FieldConditions', + 'imageUrl' => '\OpenAPI\Client\Model\FieldConditions', + 'skus' => '\OpenAPI\Client\Model\FieldConditions', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions', + 'updatedAt' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'id' => null, + 'productId' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'object' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'skus' => null, + 'createdAt' => null, + 'updatedAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'id' => false, + 'productId' => false, + 'sourceId' => false, + 'name' => false, + 'price' => false, + 'object' => false, + 'attributes' => false, + 'metadata' => false, + 'imageUrl' => false, + 'skus' => false, + 'createdAt' => false, + 'updatedAt' => 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 = [ + 'junction' => 'junction', + 'id' => 'id', + 'productId' => 'product_id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'object' => 'object', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'skus' => 'skus', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'id' => 'setId', + 'productId' => 'setProductId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'object' => 'setObject', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'skus' => 'setSkus', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'id' => 'getId', + 'productId' => 'getProductId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'object' => 'getObject', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'skus' => 'getSkus', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('skus', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets id + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param \OpenAPI\Client\Model\FieldConditions|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets productId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sourceId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $sourceId sourceId + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + throw new \InvalidArgumentException('non-nullable sourceId cannot be null'); + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param \OpenAPI\Client\Model\FieldConditions|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param \OpenAPI\Client\Model\FieldConditions|null $price price + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + throw new \InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets object + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param \OpenAPI\Client\Model\FieldConditions|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\FieldConditions|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + throw new \InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\FieldConditions|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param \OpenAPI\Client\Model\FieldConditions|null $imageUrl imageUrl + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\FieldConditions|null $skus skus + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + throw new \InvalidArgumentException('non-nullable skus cannot be null'); + } + $this->container['skus'] = $skus; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + 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/ProductCollectionsCreateRequestBodyProductsItem.php b/src/Model/ProductCollectionsCreateRequestBodyProductsItem.php new file mode 100644 index 0000000..dcb2136 --- /dev/null +++ b/src/Model/ProductCollectionsCreateRequestBodyProductsItem.php @@ -0,0 +1,518 @@ + + */ +class ProductCollectionsCreateRequestBodyProductsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsCreateRequestBodyProductsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'productId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'productId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'productId' => false, + 'object' => 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 = [ + 'id' => 'id', + 'productId' => 'product_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'productId' => 'setProductId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'productId' => 'getProductId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SKU = 'sku'; + public const OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SKU, + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('object', $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 = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The product ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId Product ID for SKUs. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object Denotes the type of the object represented by the ID. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductCollectionsCreateResponseBody.php b/src/Model/ProductCollectionsCreateResponseBody.php new file mode 100644 index 0000000..3ab1bb3 --- /dev/null +++ b/src/Model/ProductCollectionsCreateResponseBody.php @@ -0,0 +1,730 @@ + + */ +class ProductCollectionsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'type' => 'string', + 'filter' => '\OpenAPI\Client\Model\ProductCollectionsCreateResponseBodyFilter', + 'products' => '\OpenAPI\Client\Model\ProductCollectionsCreateResponseBodyProductsItem[]', + 'createdAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'type' => null, + 'filter' => null, + 'products' => null, + 'createdAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'type' => true, + 'filter' => true, + 'products' => true, + 'createdAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'type' => 'type', + 'filter' => 'filter', + 'products' => 'products', + 'createdAt' => 'created_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'type' => 'setType', + 'filter' => 'setFilter', + 'products' => 'setProducts', + 'createdAt' => 'setCreatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'type' => 'getType', + 'filter' => 'getFilter', + 'products' => 'getProducts', + 'createdAt' => 'getCreatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE__STATIC = 'STATIC'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE__STATIC, + self::TYPE_AUTO_UPDATE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('products', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'products_collection'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Product collection ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product collection name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets filter + * + * @return \OpenAPI\Client\Model\ProductCollectionsCreateResponseBodyFilter|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateResponseBodyFilter|null $filter filter + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + array_push($this->openAPINullablesSetToNull, 'filter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filter'] = $filter; + + return $this; + } + + /** + * Gets products + * + * @return \OpenAPI\Client\Model\ProductCollectionsCreateResponseBodyProductsItem[]|null + */ + public function getProducts() + { + return $this->container['products']; + } + + /** + * Sets products + * + * @param \OpenAPI\Client\Model\ProductCollectionsCreateResponseBodyProductsItem[]|null $products Defines a set of products for a `STATIC` product collection type. + * + * @return self + */ + public function setProducts($products) + { + if (is_null($products)) { + array_push($this->openAPINullablesSetToNull, 'products'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('products', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['products'] = $products; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the static product collection. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductCollectionsCreateResponseBodyFilter.php b/src/Model/ProductCollectionsCreateResponseBodyFilter.php new file mode 100644 index 0000000..f249a09 --- /dev/null +++ b/src/Model/ProductCollectionsCreateResponseBodyFilter.php @@ -0,0 +1,860 @@ + + */ +class ProductCollectionsCreateResponseBodyFilter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsCreateResponseBodyFilter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'id' => '\OpenAPI\Client\Model\FieldConditions', + 'productId' => '\OpenAPI\Client\Model\FieldConditions', + 'sourceId' => '\OpenAPI\Client\Model\FieldConditions', + 'name' => '\OpenAPI\Client\Model\FieldConditions', + 'price' => '\OpenAPI\Client\Model\FieldConditions', + 'object' => '\OpenAPI\Client\Model\FieldConditions', + 'attributes' => '\OpenAPI\Client\Model\FieldConditions', + 'metadata' => '\OpenAPI\Client\Model\FieldConditions', + 'imageUrl' => '\OpenAPI\Client\Model\FieldConditions', + 'skus' => '\OpenAPI\Client\Model\FieldConditions', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions', + 'updatedAt' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'id' => null, + 'productId' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'object' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'skus' => null, + 'createdAt' => null, + 'updatedAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'id' => false, + 'productId' => false, + 'sourceId' => false, + 'name' => false, + 'price' => false, + 'object' => false, + 'attributes' => false, + 'metadata' => false, + 'imageUrl' => false, + 'skus' => false, + 'createdAt' => false, + 'updatedAt' => 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 = [ + 'junction' => 'junction', + 'id' => 'id', + 'productId' => 'product_id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'object' => 'object', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'skus' => 'skus', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'id' => 'setId', + 'productId' => 'setProductId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'object' => 'setObject', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'skus' => 'setSkus', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'id' => 'getId', + 'productId' => 'getProductId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'object' => 'getObject', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'skus' => 'getSkus', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('skus', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets id + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param \OpenAPI\Client\Model\FieldConditions|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets productId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sourceId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $sourceId sourceId + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + throw new \InvalidArgumentException('non-nullable sourceId cannot be null'); + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param \OpenAPI\Client\Model\FieldConditions|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param \OpenAPI\Client\Model\FieldConditions|null $price price + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + throw new \InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets object + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param \OpenAPI\Client\Model\FieldConditions|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\FieldConditions|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + throw new \InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\FieldConditions|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param \OpenAPI\Client\Model\FieldConditions|null $imageUrl imageUrl + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\FieldConditions|null $skus skus + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + throw new \InvalidArgumentException('non-nullable skus cannot be null'); + } + $this->container['skus'] = $skus; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + 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/ProductCollectionsCreateResponseBodyProductsItem.php b/src/Model/ProductCollectionsCreateResponseBodyProductsItem.php new file mode 100644 index 0000000..bf221c0 --- /dev/null +++ b/src/Model/ProductCollectionsCreateResponseBodyProductsItem.php @@ -0,0 +1,518 @@ + + */ +class ProductCollectionsCreateResponseBodyProductsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsCreateResponseBodyProductsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'productId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'productId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'productId' => false, + 'object' => 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 = [ + 'id' => 'id', + 'productId' => 'product_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'productId' => 'setProductId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'productId' => 'getProductId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SKU = 'sku'; + public const OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SKU, + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('object', $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 = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The product ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId Product ID for SKUs. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object Denotes the type of the object represented by the ID. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductCollectionsGetResponseBody.php b/src/Model/ProductCollectionsGetResponseBody.php new file mode 100644 index 0000000..5efa64a --- /dev/null +++ b/src/Model/ProductCollectionsGetResponseBody.php @@ -0,0 +1,730 @@ + + */ +class ProductCollectionsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'type' => 'string', + 'filter' => '\OpenAPI\Client\Model\ProductCollectionsGetResponseBodyFilter', + 'products' => '\OpenAPI\Client\Model\ProductCollectionsGetResponseBodyProductsItem[]', + 'createdAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'type' => null, + 'filter' => null, + 'products' => null, + 'createdAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'type' => true, + 'filter' => true, + 'products' => true, + 'createdAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'type' => 'type', + 'filter' => 'filter', + 'products' => 'products', + 'createdAt' => 'created_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'type' => 'setType', + 'filter' => 'setFilter', + 'products' => 'setProducts', + 'createdAt' => 'setCreatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'type' => 'getType', + 'filter' => 'getFilter', + 'products' => 'getProducts', + 'createdAt' => 'getCreatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE__STATIC = 'STATIC'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE__STATIC, + self::TYPE_AUTO_UPDATE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('products', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'products_collection'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Product collection ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product collection name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets filter + * + * @return \OpenAPI\Client\Model\ProductCollectionsGetResponseBodyFilter|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param \OpenAPI\Client\Model\ProductCollectionsGetResponseBodyFilter|null $filter filter + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + array_push($this->openAPINullablesSetToNull, 'filter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filter'] = $filter; + + return $this; + } + + /** + * Gets products + * + * @return \OpenAPI\Client\Model\ProductCollectionsGetResponseBodyProductsItem[]|null + */ + public function getProducts() + { + return $this->container['products']; + } + + /** + * Sets products + * + * @param \OpenAPI\Client\Model\ProductCollectionsGetResponseBodyProductsItem[]|null $products Defines a set of products for a `STATIC` product collection type. + * + * @return self + */ + public function setProducts($products) + { + if (is_null($products)) { + array_push($this->openAPINullablesSetToNull, 'products'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('products', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['products'] = $products; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the static product collection. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductCollectionsGetResponseBodyFilter.php b/src/Model/ProductCollectionsGetResponseBodyFilter.php new file mode 100644 index 0000000..81c1f43 --- /dev/null +++ b/src/Model/ProductCollectionsGetResponseBodyFilter.php @@ -0,0 +1,860 @@ + + */ +class ProductCollectionsGetResponseBodyFilter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsGetResponseBodyFilter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'id' => '\OpenAPI\Client\Model\FieldConditions', + 'productId' => '\OpenAPI\Client\Model\FieldConditions', + 'sourceId' => '\OpenAPI\Client\Model\FieldConditions', + 'name' => '\OpenAPI\Client\Model\FieldConditions', + 'price' => '\OpenAPI\Client\Model\FieldConditions', + 'object' => '\OpenAPI\Client\Model\FieldConditions', + 'attributes' => '\OpenAPI\Client\Model\FieldConditions', + 'metadata' => '\OpenAPI\Client\Model\FieldConditions', + 'imageUrl' => '\OpenAPI\Client\Model\FieldConditions', + 'skus' => '\OpenAPI\Client\Model\FieldConditions', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions', + 'updatedAt' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'id' => null, + 'productId' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'object' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'skus' => null, + 'createdAt' => null, + 'updatedAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'id' => false, + 'productId' => false, + 'sourceId' => false, + 'name' => false, + 'price' => false, + 'object' => false, + 'attributes' => false, + 'metadata' => false, + 'imageUrl' => false, + 'skus' => false, + 'createdAt' => false, + 'updatedAt' => 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 = [ + 'junction' => 'junction', + 'id' => 'id', + 'productId' => 'product_id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'object' => 'object', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'skus' => 'skus', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'id' => 'setId', + 'productId' => 'setProductId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'object' => 'setObject', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'skus' => 'setSkus', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'id' => 'getId', + 'productId' => 'getProductId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'object' => 'getObject', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'skus' => 'getSkus', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('skus', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets id + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param \OpenAPI\Client\Model\FieldConditions|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets productId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sourceId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $sourceId sourceId + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + throw new \InvalidArgumentException('non-nullable sourceId cannot be null'); + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param \OpenAPI\Client\Model\FieldConditions|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param \OpenAPI\Client\Model\FieldConditions|null $price price + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + throw new \InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets object + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param \OpenAPI\Client\Model\FieldConditions|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\FieldConditions|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + throw new \InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\FieldConditions|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param \OpenAPI\Client\Model\FieldConditions|null $imageUrl imageUrl + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\FieldConditions|null $skus skus + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + throw new \InvalidArgumentException('non-nullable skus cannot be null'); + } + $this->container['skus'] = $skus; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + 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/ProductCollectionsGetResponseBodyProductsItem.php b/src/Model/ProductCollectionsGetResponseBodyProductsItem.php new file mode 100644 index 0000000..5a0baec --- /dev/null +++ b/src/Model/ProductCollectionsGetResponseBodyProductsItem.php @@ -0,0 +1,518 @@ + + */ +class ProductCollectionsGetResponseBodyProductsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsGetResponseBodyProductsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'productId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'productId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'productId' => false, + 'object' => 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 = [ + 'id' => 'id', + 'productId' => 'product_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'productId' => 'setProductId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'productId' => 'getProductId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SKU = 'sku'; + public const OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SKU, + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('object', $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 = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The product ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId Product ID for SKUs. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object Denotes the type of the object represented by the ID. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductCollectionsItem.php b/src/Model/ProductCollectionsItem.php new file mode 100644 index 0000000..6e84829 --- /dev/null +++ b/src/Model/ProductCollectionsItem.php @@ -0,0 +1,730 @@ + + */ +class ProductCollectionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'type' => 'string', + 'filter' => '\OpenAPI\Client\Model\ProductCollectionsItemFilter', + 'products' => '\OpenAPI\Client\Model\ProductCollectionsItemProductsItem[]', + 'createdAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'type' => null, + 'filter' => null, + 'products' => null, + 'createdAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'type' => true, + 'filter' => true, + 'products' => true, + 'createdAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'type' => 'type', + 'filter' => 'filter', + 'products' => 'products', + 'createdAt' => 'created_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'type' => 'setType', + 'filter' => 'setFilter', + 'products' => 'setProducts', + 'createdAt' => 'setCreatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'type' => 'getType', + 'filter' => 'getFilter', + 'products' => 'getProducts', + 'createdAt' => 'getCreatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE__STATIC = 'STATIC'; + public const TYPE_AUTO_UPDATE = 'AUTO_UPDATE'; + public const OBJECT_PRODUCTS_COLLECTION = 'products_collection'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE__STATIC, + self::TYPE_AUTO_UPDATE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCTS_COLLECTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('products', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'products_collection'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Product collection ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product collection name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets filter + * + * @return \OpenAPI\Client\Model\ProductCollectionsItemFilter|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param \OpenAPI\Client\Model\ProductCollectionsItemFilter|null $filter filter + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + array_push($this->openAPINullablesSetToNull, 'filter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filter'] = $filter; + + return $this; + } + + /** + * Gets products + * + * @return \OpenAPI\Client\Model\ProductCollectionsItemProductsItem[]|null + */ + public function getProducts() + { + return $this->container['products']; + } + + /** + * Sets products + * + * @param \OpenAPI\Client\Model\ProductCollectionsItemProductsItem[]|null $products Defines a set of products for a `STATIC` product collection type. + * + * @return self + */ + public function setProducts($products) + { + if (is_null($products)) { + array_push($this->openAPINullablesSetToNull, 'products'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('products', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['products'] = $products; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the static product collection. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductCollectionsItemFilter.php b/src/Model/ProductCollectionsItemFilter.php new file mode 100644 index 0000000..b90efa3 --- /dev/null +++ b/src/Model/ProductCollectionsItemFilter.php @@ -0,0 +1,860 @@ + + */ +class ProductCollectionsItemFilter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsItemFilter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'id' => '\OpenAPI\Client\Model\FieldConditions', + 'productId' => '\OpenAPI\Client\Model\FieldConditions', + 'sourceId' => '\OpenAPI\Client\Model\FieldConditions', + 'name' => '\OpenAPI\Client\Model\FieldConditions', + 'price' => '\OpenAPI\Client\Model\FieldConditions', + 'object' => '\OpenAPI\Client\Model\FieldConditions', + 'attributes' => '\OpenAPI\Client\Model\FieldConditions', + 'metadata' => '\OpenAPI\Client\Model\FieldConditions', + 'imageUrl' => '\OpenAPI\Client\Model\FieldConditions', + 'skus' => '\OpenAPI\Client\Model\FieldConditions', + 'createdAt' => '\OpenAPI\Client\Model\FieldConditions', + 'updatedAt' => '\OpenAPI\Client\Model\FieldConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'id' => null, + 'productId' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'object' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'skus' => null, + 'createdAt' => null, + 'updatedAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'id' => false, + 'productId' => false, + 'sourceId' => false, + 'name' => false, + 'price' => false, + 'object' => false, + 'attributes' => false, + 'metadata' => false, + 'imageUrl' => false, + 'skus' => false, + 'createdAt' => false, + 'updatedAt' => 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 = [ + 'junction' => 'junction', + 'id' => 'id', + 'productId' => 'product_id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'object' => 'object', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'skus' => 'skus', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'id' => 'setId', + 'productId' => 'setProductId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'object' => 'setObject', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'skus' => 'setSkus', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'id' => 'getId', + 'productId' => 'getProductId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'object' => 'getObject', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'skus' => 'getSkus', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('skus', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets id + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param \OpenAPI\Client\Model\FieldConditions|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets productId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sourceId + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param \OpenAPI\Client\Model\FieldConditions|null $sourceId sourceId + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + throw new \InvalidArgumentException('non-nullable sourceId cannot be null'); + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param \OpenAPI\Client\Model\FieldConditions|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param \OpenAPI\Client\Model\FieldConditions|null $price price + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + throw new \InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets object + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param \OpenAPI\Client\Model\FieldConditions|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\FieldConditions|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + throw new \InvalidArgumentException('non-nullable attributes cannot be null'); + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\FieldConditions|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param \OpenAPI\Client\Model\FieldConditions|null $imageUrl imageUrl + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\FieldConditions|null $skus skus + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + throw new \InvalidArgumentException('non-nullable skus cannot be null'); + } + $this->container['skus'] = $skus; + + return $this; + } + + /** + * Gets createdAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \OpenAPI\Client\Model\FieldConditions|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \OpenAPI\Client\Model\FieldConditions|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + 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/ProductCollectionsItemProductsItem.php b/src/Model/ProductCollectionsItemProductsItem.php new file mode 100644 index 0000000..d612e23 --- /dev/null +++ b/src/Model/ProductCollectionsItemProductsItem.php @@ -0,0 +1,518 @@ + + */ +class ProductCollectionsItemProductsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsItemProductsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'productId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'productId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'productId' => false, + 'object' => 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 = [ + 'id' => 'id', + 'productId' => 'product_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'productId' => 'setProductId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'productId' => 'getProductId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SKU = 'sku'; + public const OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SKU, + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('object', $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 = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The product ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId Product ID for SKUs. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object Denotes the type of the object represented by the ID. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductCollectionsListResponseBody.php b/src/Model/ProductCollectionsListResponseBody.php new file mode 100644 index 0000000..7367ea1 --- /dev/null +++ b/src/Model/ProductCollectionsListResponseBody.php @@ -0,0 +1,605 @@ + + */ +class ProductCollectionsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\ProductCollectionsItem[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about product collections. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of product collections. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\ProductCollectionsItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\ProductCollectionsItem[]|null $data A dictionary that contains an array of product collections and their details. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of product collections. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/ProductCollectionsProductsListResponseBody.php b/src/Model/ProductCollectionsProductsListResponseBody.php new file mode 100644 index 0000000..f43ba51 --- /dev/null +++ b/src/Model/ProductCollectionsProductsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class ProductCollectionsProductsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsProductsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\ProductCollectionsProductsListResponseBodyDataItem[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about products and SKUs. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of products and SKUs. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\ProductCollectionsProductsListResponseBodyDataItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\ProductCollectionsProductsListResponseBodyDataItem[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of products & SKUs in the product collection. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/ProductCollectionsProductsListResponseBodyDataItem.php b/src/Model/ProductCollectionsProductsListResponseBodyDataItem.php new file mode 100644 index 0000000..2690824 --- /dev/null +++ b/src/Model/ProductCollectionsProductsListResponseBodyDataItem.php @@ -0,0 +1,928 @@ + + */ +class ProductCollectionsProductsListResponseBodyDataItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductCollectionsProductsListResponseBodyDataItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'metadata' => 'object', + 'imageUrl' => 'string', + 'createdAt' => 'string', + 'updatedAt' => 'string', + 'object' => 'string', + 'productId' => 'string', + 'sku' => 'string', + 'currency' => 'string', + 'product' => '\OpenAPI\Client\Model\ProductWithoutSkus' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'createdAt' => null, + 'updatedAt' => null, + 'object' => null, + 'productId' => null, + 'sku' => null, + 'currency' => null, + 'product' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'sourceId' => false, + 'name' => true, + 'price' => true, + 'attributes' => true, + 'metadata' => false, + 'imageUrl' => false, + 'createdAt' => false, + 'updatedAt' => false, + 'object' => false, + 'productId' => true, + 'sku' => true, + 'currency' => true, + 'product' => 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'productId' => 'product_id', + 'sku' => 'sku', + 'currency' => 'currency', + 'product' => 'product' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'productId' => 'setProductId', + 'sku' => 'setSku', + 'currency' => 'setCurrency', + 'product' => 'setProduct' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'productId' => 'getProductId', + 'sku' => 'getSku', + 'currency' => 'getCurrency', + 'product' => 'getProduct' + ]; + + /** + * 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 OBJECT_PRODUCT = 'product'; + public const OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCT, + self::OBJECT_SKU, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('product', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId sourceId + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + throw new \InvalidArgumentException('non-nullable sourceId cannot be null'); + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl imageUrl + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets createdAt + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param string|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId The parent product's unique ID. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku Unique user-defined SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency SKU price currency. + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + array_push($this->openAPINullablesSetToNull, 'currency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\ProductWithoutSkus|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\ProductWithoutSkus|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + throw new \InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + 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/ProductWithoutSkus.php b/src/Model/ProductWithoutSkus.php new file mode 100644 index 0000000..7425969 --- /dev/null +++ b/src/Model/ProductWithoutSkus.php @@ -0,0 +1,818 @@ + + */ +class ProductWithoutSkus implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductWithoutSkus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'metadata' => 'object', + 'imageUrl' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'price' => true, + 'attributes' => true, + 'metadata' => true, + 'imageUrl' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'product'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique product source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the product. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductsCreateRequestBody.php b/src/Model/ProductsCreateRequestBody.php new file mode 100644 index 0000000..264e42e --- /dev/null +++ b/src/Model/ProductsCreateRequestBody.php @@ -0,0 +1,664 @@ + + */ +class ProductsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'metadata' => 'object', + 'imageUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'price' => true, + 'attributes' => true, + 'metadata' => true, + 'imageUrl' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the product and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique product source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + 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/ProductsCreateResponseBody.php b/src/Model/ProductsCreateResponseBody.php new file mode 100644 index 0000000..db909c6 --- /dev/null +++ b/src/Model/ProductsCreateResponseBody.php @@ -0,0 +1,853 @@ + + */ +class ProductsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'metadata' => 'object', + 'imageUrl' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'skus' => '\OpenAPI\Client\Model\SkusListForProduct' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'skus' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'price' => true, + 'attributes' => true, + 'metadata' => true, + 'imageUrl' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'skus' => 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'skus' => 'skus' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'skus' => 'setSkus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'skus' => 'getSkus' + ]; + + /** + * 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 OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'product'); + $this->setIfExists('skus', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique product source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the product. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\SkusListForProduct|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\SkusListForProduct|null $skus skus + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + throw new \InvalidArgumentException('non-nullable skus cannot be null'); + } + $this->container['skus'] = $skus; + + 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/ProductsGetResponseBody.php b/src/Model/ProductsGetResponseBody.php new file mode 100644 index 0000000..dbd1bc0 --- /dev/null +++ b/src/Model/ProductsGetResponseBody.php @@ -0,0 +1,853 @@ + + */ +class ProductsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'metadata' => 'object', + 'imageUrl' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'skus' => '\OpenAPI\Client\Model\SkusListForProduct' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'skus' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'price' => true, + 'attributes' => true, + 'metadata' => true, + 'imageUrl' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'skus' => 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'skus' => 'skus' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'skus' => 'setSkus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'skus' => 'getSkus' + ]; + + /** + * 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 OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'product'); + $this->setIfExists('skus', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique product source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the product. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\SkusListForProduct|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\SkusListForProduct|null $skus skus + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + throw new \InvalidArgumentException('non-nullable skus cannot be null'); + } + $this->container['skus'] = $skus; + + 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/ProductsImportCsvCreateResponseBody.php b/src/Model/ProductsImportCsvCreateResponseBody.php new file mode 100644 index 0000000..6686206 --- /dev/null +++ b/src/Model/ProductsImportCsvCreateResponseBody.php @@ -0,0 +1,418 @@ + + */ +class ProductsImportCsvCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsImportCsvCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/ProductsListResponseBody.php b/src/Model/ProductsListResponseBody.php new file mode 100644 index 0000000..00e9733 --- /dev/null +++ b/src/Model/ProductsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class ProductsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'products' => '\OpenAPI\Client\Model\Product[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'products' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'products' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'products' => 'products', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'products' => 'setProducts', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'products' => 'getProducts', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'products'); + $this->setIfExists('products', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about products in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of product objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets products + * + * @return \OpenAPI\Client\Model\Product[]|null + */ + public function getProducts() + { + return $this->container['products']; + } + + /** + * Sets products + * + * @param \OpenAPI\Client\Model\Product[]|null $products Contains array of product objects. + * + * @return self + */ + public function setProducts($products) + { + if (is_null($products)) { + array_push($this->openAPINullablesSetToNull, 'products'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('products', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['products'] = $products; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of product objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/ProductsMetadataUpdateInBulkRequestBody.php b/src/Model/ProductsMetadataUpdateInBulkRequestBody.php new file mode 100644 index 0000000..3fe3189 --- /dev/null +++ b/src/Model/ProductsMetadataUpdateInBulkRequestBody.php @@ -0,0 +1,459 @@ + + */ +class ProductsMetadataUpdateInBulkRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsMetadataUpdateInBulkRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sourceIds' => 'string[]', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sourceIds' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sourceIds' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'sourceIds' => 'source_ids', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sourceIds' => 'setSourceIds', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sourceIds' => 'getSourceIds', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('sourceIds', $data ?? [], null); + $this->setIfExists('metadata', $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 sourceIds + * + * @return string[]|null + */ + public function getSourceIds() + { + return $this->container['sourceIds']; + } + + /** + * Sets sourceIds + * + * @param string[]|null $sourceIds Array of unique product source IDs. + * + * @return self + */ + public function setSourceIds($sourceIds) + { + if (is_null($sourceIds)) { + array_push($this->openAPINullablesSetToNull, 'sourceIds'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceIds', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceIds'] = $sourceIds; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ProductsMetadataUpdateInBulkResponseBody.php b/src/Model/ProductsMetadataUpdateInBulkResponseBody.php new file mode 100644 index 0000000..647360b --- /dev/null +++ b/src/Model/ProductsMetadataUpdateInBulkResponseBody.php @@ -0,0 +1,418 @@ + + */ +class ProductsMetadataUpdateInBulkResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsMetadataUpdateInBulkResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/ProductsSkusCreateRequestBody.php b/src/Model/ProductsSkusCreateRequestBody.php new file mode 100644 index 0000000..0acc25b --- /dev/null +++ b/src/Model/ProductsSkusCreateRequestBody.php @@ -0,0 +1,705 @@ + + */ +class ProductsSkusCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsSkusCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'sku' => 'string', + 'price' => 'int', + 'currency' => 'string', + 'attributes' => 'object', + 'imageUrl' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'sku' => null, + 'price' => null, + 'currency' => null, + 'attributes' => null, + 'imageUrl' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'sku' => true, + 'price' => true, + 'currency' => true, + 'attributes' => true, + 'imageUrl' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'sku' => 'sku', + 'price' => 'price', + 'currency' => 'currency', + 'attributes' => 'attributes', + 'imageUrl' => 'image_url', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'sku' => 'setSku', + 'price' => 'setPrice', + 'currency' => 'setCurrency', + 'attributes' => 'setAttributes', + 'imageUrl' => 'setImageUrl', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'sku' => 'getSku', + 'price' => 'getPrice', + 'currency' => 'getCurrency', + 'attributes' => 'getAttributes', + 'imageUrl' => 'getImageUrl', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('metadata', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique SKU ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique SKU identifier from your inventory system. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku Unique user-defined SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency SKU price currency. + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + array_push($this->openAPINullablesSetToNull, 'currency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ProductsSkusCreateResponseBody.php b/src/Model/ProductsSkusCreateResponseBody.php new file mode 100644 index 0000000..3b01b87 --- /dev/null +++ b/src/Model/ProductsSkusCreateResponseBody.php @@ -0,0 +1,901 @@ + + */ +class ProductsSkusCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsSkusCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'productId' => 'string', + 'sku' => 'string', + 'price' => 'int', + 'currency' => 'string', + 'attributes' => 'object', + 'imageUrl' => 'string', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'productId' => null, + 'sku' => null, + 'price' => null, + 'currency' => null, + 'attributes' => null, + 'imageUrl' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'productId' => true, + 'sku' => true, + 'price' => true, + 'currency' => true, + 'attributes' => true, + 'imageUrl' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'productId' => 'product_id', + 'sku' => 'sku', + 'price' => 'price', + 'currency' => 'currency', + 'attributes' => 'attributes', + 'imageUrl' => 'image_url', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'productId' => 'setProductId', + 'sku' => 'setSku', + 'price' => 'setPrice', + 'currency' => 'setCurrency', + 'attributes' => 'setAttributes', + 'imageUrl' => 'setImageUrl', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'productId' => 'getProductId', + 'sku' => 'getSku', + 'price' => 'getPrice', + 'currency' => 'getCurrency', + 'attributes' => 'getAttributes', + 'imageUrl' => 'getImageUrl', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SKU, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'sku'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the SKU and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique SKU identifier from your inventory system. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId The parent product's unique ID. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku Unique user-defined SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency SKU price currency. + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + array_push($this->openAPINullablesSetToNull, 'currency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the `SKU`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductsSkusListResponseBody.php b/src/Model/ProductsSkusListResponseBody.php new file mode 100644 index 0000000..9d9bc4c --- /dev/null +++ b/src/Model/ProductsSkusListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class ProductsSkusListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsSkusListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'skus' => '\OpenAPI\Client\Model\Sku[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'skus' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'skus' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'skus' => 'skus', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'skus' => 'setSkus', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'skus' => 'getSkus', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('skus', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about SKUs. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of SKUs. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\Sku[]|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\Sku[]|null $skus A dictionary that contains an array of SKUs. + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + array_push($this->openAPINullablesSetToNull, 'skus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skus'] = $skus; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of SKUs in the product. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/ProductsSkusUpdateRequestBody.php b/src/Model/ProductsSkusUpdateRequestBody.php new file mode 100644 index 0000000..db7d6bb --- /dev/null +++ b/src/Model/ProductsSkusUpdateRequestBody.php @@ -0,0 +1,623 @@ + + */ +class ProductsSkusUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsSkusUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sku' => 'string', + 'price' => 'int', + 'currency' => 'string', + 'attributes' => 'object', + 'imageUrl' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sku' => null, + 'price' => null, + 'currency' => null, + 'attributes' => null, + 'imageUrl' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sku' => true, + 'price' => true, + 'currency' => true, + 'attributes' => true, + 'imageUrl' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'sku' => 'sku', + 'price' => 'price', + 'currency' => 'currency', + 'attributes' => 'attributes', + 'imageUrl' => 'image_url', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sku' => 'setSku', + 'price' => 'setPrice', + 'currency' => 'setCurrency', + 'attributes' => 'setAttributes', + 'imageUrl' => 'setImageUrl', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sku' => 'getSku', + 'price' => 'getPrice', + 'currency' => 'getCurrency', + 'attributes' => 'getAttributes', + 'imageUrl' => 'getImageUrl', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('metadata', $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 sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku Unique user-defined SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency SKU price currency. + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + array_push($this->openAPINullablesSetToNull, 'currency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ProductsSkusUpdateResponseBody.php b/src/Model/ProductsSkusUpdateResponseBody.php new file mode 100644 index 0000000..bcdd6e6 --- /dev/null +++ b/src/Model/ProductsSkusUpdateResponseBody.php @@ -0,0 +1,901 @@ + + */ +class ProductsSkusUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsSkusUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'productId' => 'string', + 'sku' => 'string', + 'price' => 'int', + 'currency' => 'string', + 'attributes' => 'object', + 'imageUrl' => 'string', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'productId' => null, + 'sku' => null, + 'price' => null, + 'currency' => null, + 'attributes' => null, + 'imageUrl' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'productId' => true, + 'sku' => true, + 'price' => true, + 'currency' => true, + 'attributes' => true, + 'imageUrl' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'productId' => 'product_id', + 'sku' => 'sku', + 'price' => 'price', + 'currency' => 'currency', + 'attributes' => 'attributes', + 'imageUrl' => 'image_url', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'productId' => 'setProductId', + 'sku' => 'setSku', + 'price' => 'setPrice', + 'currency' => 'setCurrency', + 'attributes' => 'setAttributes', + 'imageUrl' => 'setImageUrl', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'productId' => 'getProductId', + 'sku' => 'getSku', + 'price' => 'getPrice', + 'currency' => 'getCurrency', + 'attributes' => 'getAttributes', + 'imageUrl' => 'getImageUrl', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SKU, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'sku'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the SKU and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique SKU identifier from your inventory system. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId The parent product's unique ID. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku Unique user-defined SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency SKU price currency. + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + array_push($this->openAPINullablesSetToNull, 'currency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the `SKU`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ProductsUpdateInBulkRequestBody.php b/src/Model/ProductsUpdateInBulkRequestBody.php new file mode 100644 index 0000000..3923e81 --- /dev/null +++ b/src/Model/ProductsUpdateInBulkRequestBody.php @@ -0,0 +1,623 @@ + + */ +class ProductsUpdateInBulkRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsUpdateInBulkRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sourceId' => 'string', + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'imageUrl' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'attributes' => null, + 'imageUrl' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sourceId' => true, + 'name' => true, + 'price' => true, + 'attributes' => true, + 'imageUrl' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'imageUrl' => 'image_url', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'imageUrl' => 'setImageUrl', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'imageUrl' => 'getImageUrl', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('metadata', $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 sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique product source ID from your inventory system. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ProductsUpdateInBulkResponseBody.php b/src/Model/ProductsUpdateInBulkResponseBody.php new file mode 100644 index 0000000..36b7ba4 --- /dev/null +++ b/src/Model/ProductsUpdateInBulkResponseBody.php @@ -0,0 +1,418 @@ + + */ +class ProductsUpdateInBulkResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsUpdateInBulkResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/ProductsUpdateRequestBody.php b/src/Model/ProductsUpdateRequestBody.php new file mode 100644 index 0000000..80215f4 --- /dev/null +++ b/src/Model/ProductsUpdateRequestBody.php @@ -0,0 +1,582 @@ + + */ +class ProductsUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'metadata' => 'object', + 'imageUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'price' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'price' => true, + 'attributes' => true, + 'metadata' => true, + 'imageUrl' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + 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/ProductsUpdateResponseBody.php b/src/Model/ProductsUpdateResponseBody.php new file mode 100644 index 0000000..e62c9e9 --- /dev/null +++ b/src/Model/ProductsUpdateResponseBody.php @@ -0,0 +1,853 @@ + + */ +class ProductsUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductsUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'price' => 'int', + 'attributes' => 'string[]', + 'metadata' => 'object', + 'imageUrl' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'skus' => '\OpenAPI\Client\Model\SkusListForProduct' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'price' => null, + 'attributes' => null, + 'metadata' => null, + 'imageUrl' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'skus' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'price' => true, + 'attributes' => true, + 'metadata' => true, + 'imageUrl' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'skus' => 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'price' => 'price', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'imageUrl' => 'image_url', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'skus' => 'skus' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'price' => 'setPrice', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'imageUrl' => 'setImageUrl', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'skus' => 'setSkus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'price' => 'getPrice', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'imageUrl' => 'getImageUrl', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'skus' => 'getSkus' + ]; + + /** + * 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 OBJECT_PRODUCT = 'product'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PRODUCT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'product'); + $this->setIfExists('skus', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique product source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Unique user-defined product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets attributes + * + * @return string[]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param string[]|null $attributes A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the product. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets skus + * + * @return \OpenAPI\Client\Model\SkusListForProduct|null + */ + public function getSkus() + { + return $this->container['skus']; + } + + /** + * Sets skus + * + * @param \OpenAPI\Client\Model\SkusListForProduct|null $skus skus + * + * @return self + */ + public function setSkus($skus) + { + if (is_null($skus)) { + throw new \InvalidArgumentException('non-nullable skus cannot be null'); + } + $this->container['skus'] = $skus; + + 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/PromotionStack.php b/src/Model/PromotionStack.php new file mode 100644 index 0000000..92111cb --- /dev/null +++ b/src/Model/PromotionStack.php @@ -0,0 +1,777 @@ + + */ +class PromotionStack implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionStack'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionStackTiers', + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'campaignId' => 'string', + 'object' => 'string', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'tiers' => null, + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'campaignId' => null, + 'object' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'tiers' => true, + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'campaignId' => true, + 'object' => true, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'tiers' => 'tiers', + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'campaignId' => 'campaign_id', + 'object' => 'object', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'tiers' => 'setTiers', + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'campaignId' => 'setCampaignId', + 'object' => 'setObject', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'tiers' => 'getTiers', + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'campaignId' => 'getCampaignId', + 'object' => 'getObject', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 OBJECT_PROMOTION_STACK = 'promotion_stack'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PROMOTION_STACK, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_stack'); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Promotion stack name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionStackTiers|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionStackTiers|null $tiers tiers + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion stack ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion stack's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion stack category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Details about the category assigned to the promotion stack. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionStackBase.php b/src/Model/PromotionStackBase.php new file mode 100644 index 0000000..9bc3680 --- /dev/null +++ b/src/Model/PromotionStackBase.php @@ -0,0 +1,458 @@ + + */ +class PromotionStackBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionStackBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionStackBaseTiers' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'tiers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'tiers' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'tiers' => 'tiers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'tiers' => 'setTiers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'tiers' => 'getTiers' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('tiers', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Promotion stack name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionStackBaseTiers|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionStackBaseTiers|null $tiers tiers + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + 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/PromotionStackBaseTiers.php b/src/Model/PromotionStackBaseTiers.php new file mode 100644 index 0000000..205af0b --- /dev/null +++ b/src/Model/PromotionStackBaseTiers.php @@ -0,0 +1,500 @@ + + */ +class PromotionStackBaseTiers implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionStackBaseTiers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => 'string[]', + 'hierarchyMode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'hierarchyMode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => true, + 'hierarchyMode' => true + ]; + + /** + * 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 = [ + 'ids' => 'ids', + 'hierarchyMode' => 'hierarchy_mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'hierarchyMode' => 'setHierarchyMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'hierarchyMode' => 'getHierarchyMode' + ]; + + /** + * 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 HIERARCHY_MODE_MANUAL = 'MANUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHierarchyModeAllowableValues() + { + return [ + self::HIERARCHY_MODE_MANUAL, + ]; + } + + /** + * 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('ids', $data ?? [], null); + $this->setIfExists('hierarchyMode', $data ?? [], 'MANUAL'); + } + + /** + * 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 = []; + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($this->container['hierarchyMode']) && !in_array($this->container['hierarchyMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $this->container['hierarchyMode'], + 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 ids + * + * @return string[]|null + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param string[]|null $ids Contains the list of tiers in a pre-defined sequence. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + array_push($this->openAPINullablesSetToNull, 'ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + + if (!is_null($ids) && (count($ids) < 1)) { + throw new \InvalidArgumentException('invalid length for $ids when calling PromotionStackBaseTiers., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets hierarchyMode + * + * @return string|null + */ + public function getHierarchyMode() + { + return $this->container['hierarchyMode']; + } + + /** + * Sets hierarchyMode + * + * @param string|null $hierarchyMode hierarchyMode + * + * @return self + */ + public function setHierarchyMode($hierarchyMode) + { + if (is_null($hierarchyMode)) { + array_push($this->openAPINullablesSetToNull, 'hierarchyMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchyMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($hierarchyMode) && !in_array($hierarchyMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $hierarchyMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['hierarchyMode'] = $hierarchyMode; + + 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/PromotionStackTiers.php b/src/Model/PromotionStackTiers.php new file mode 100644 index 0000000..4bf54a9 --- /dev/null +++ b/src/Model/PromotionStackTiers.php @@ -0,0 +1,500 @@ + + */ +class PromotionStackTiers implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionStackTiers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => 'string[]', + 'hierarchyMode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'hierarchyMode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => true, + 'hierarchyMode' => true + ]; + + /** + * 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 = [ + 'ids' => 'ids', + 'hierarchyMode' => 'hierarchy_mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'hierarchyMode' => 'setHierarchyMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'hierarchyMode' => 'getHierarchyMode' + ]; + + /** + * 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 HIERARCHY_MODE_MANUAL = 'MANUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHierarchyModeAllowableValues() + { + return [ + self::HIERARCHY_MODE_MANUAL, + ]; + } + + /** + * 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('ids', $data ?? [], null); + $this->setIfExists('hierarchyMode', $data ?? [], 'MANUAL'); + } + + /** + * 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 = []; + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($this->container['hierarchyMode']) && !in_array($this->container['hierarchyMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $this->container['hierarchyMode'], + 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 ids + * + * @return string[]|null + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param string[]|null $ids Contains the list of tiers in a pre-defined sequence. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + array_push($this->openAPINullablesSetToNull, 'ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + + if (!is_null($ids) && (count($ids) < 1)) { + throw new \InvalidArgumentException('invalid length for $ids when calling PromotionStackTiers., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets hierarchyMode + * + * @return string|null + */ + public function getHierarchyMode() + { + return $this->container['hierarchyMode']; + } + + /** + * Sets hierarchyMode + * + * @param string|null $hierarchyMode hierarchyMode + * + * @return self + */ + public function setHierarchyMode($hierarchyMode) + { + if (is_null($hierarchyMode)) { + array_push($this->openAPINullablesSetToNull, 'hierarchyMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchyMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($hierarchyMode) && !in_array($hierarchyMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $hierarchyMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['hierarchyMode'] = $hierarchyMode; + + 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/PromotionTier.php b/src/Model/PromotionTier.php new file mode 100644 index 0000000..a28fb3e --- /dev/null +++ b/src/Model/PromotionTier.php @@ -0,0 +1,1292 @@ + + */ +class PromotionTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionTierAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\PromotionTierCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\PromotionTierSummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => true, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => true, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionTierAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionTierAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\PromotionTierCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\PromotionTierCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\PromotionTierSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\PromotionTierSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + array_push($this->openAPINullablesSetToNull, 'summary'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('summary', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionTierAction.php b/src/Model/PromotionTierAction.php new file mode 100644 index 0000000..4b8a302 --- /dev/null +++ b/src/Model/PromotionTierAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionTierAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTierAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionTierCampaign.php b/src/Model/PromotionTierCampaign.php new file mode 100644 index 0000000..c2c3725 --- /dev/null +++ b/src/Model/PromotionTierCampaign.php @@ -0,0 +1,766 @@ + + */ +class PromotionTierCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTierCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/PromotionTierCreateParams.php b/src/Model/PromotionTierCreateParams.php new file mode 100644 index 0000000..8627608 --- /dev/null +++ b/src/Model/PromotionTierCreateParams.php @@ -0,0 +1,971 @@ + + */ +class PromotionTierCreateParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTierCreateParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionTierCreateParamsAction', + 'metadata' => 'object', + 'validationRules' => 'string[]', + 'active' => 'bool', + 'hierarchy' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'category' => 'string', + 'categoryId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'validationRules' => null, + 'active' => null, + 'hierarchy' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'category' => null, + 'categoryId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'validationRules' => true, + 'active' => true, + 'hierarchy' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'category' => true, + 'categoryId' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'validationRules' => 'validation_rules', + 'active' => 'active', + 'hierarchy' => 'hierarchy', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'category' => 'category', + 'categoryId' => 'category_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'validationRules' => 'setValidationRules', + 'active' => 'setActive', + 'hierarchy' => 'setHierarchy', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'validationRules' => 'getValidationRules', + 'active' => 'getActive', + 'hierarchy' => 'getHierarchy', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('validationRules', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionTierCreateParamsAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionTierCreateParamsAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets validationRules + * + * @return string[]|null + */ + public function getValidationRules() + { + return $this->container['validationRules']; + } + + /** + * Sets validationRules + * + * @param string[]|null $validationRules Array containing the ID of the validation rule associated with the promotion tier. + * + * @return self + */ + public function setValidationRules($validationRules) + { + if (is_null($validationRules)) { + array_push($this->openAPINullablesSetToNull, 'validationRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRules'] = $validationRules; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Assign category to the promotion tier. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + 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/PromotionTierCreateParamsAction.php b/src/Model/PromotionTierCreateParamsAction.php new file mode 100644 index 0000000..dbd3bbb --- /dev/null +++ b/src/Model/PromotionTierCreateParamsAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionTierCreateParamsAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTierCreateParamsAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionTierSummary.php b/src/Model/PromotionTierSummary.php new file mode 100644 index 0000000..97971e5 --- /dev/null +++ b/src/Model/PromotionTierSummary.php @@ -0,0 +1,459 @@ + + */ +class PromotionTierSummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTierSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\PromotionTierSummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\PromotionTierSummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'orders' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\PromotionTierSummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\PromotionTierSummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\PromotionTierSummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\PromotionTierSummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + 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/PromotionTierSummaryOrders.php b/src/Model/PromotionTierSummaryOrders.php new file mode 100644 index 0000000..4b21c5f --- /dev/null +++ b/src/Model/PromotionTierSummaryOrders.php @@ -0,0 +1,459 @@ + + */ +class PromotionTierSummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTierSummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/PromotionTierSummaryRedemptions.php b/src/Model/PromotionTierSummaryRedemptions.php new file mode 100644 index 0000000..8d791e3 --- /dev/null +++ b/src/Model/PromotionTierSummaryRedemptions.php @@ -0,0 +1,418 @@ + + */ +class PromotionTierSummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTierSummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/PromotionTiersList.php b/src/Model/PromotionTiersList.php new file mode 100644 index 0000000..d77968b --- /dev/null +++ b/src/Model/PromotionTiersList.php @@ -0,0 +1,582 @@ + + */ +class PromotionTiersList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionTiersList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionTier[]', + 'total' => 'int', + 'hasMore' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'tiers' => null, + 'total' => null, + 'hasMore' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'tiers' => true, + 'total' => true, + 'hasMore' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'tiers' => 'tiers', + 'total' => 'total', + 'hasMore' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'tiers' => 'setTiers', + 'total' => 'setTotal', + 'hasMore' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'tiers' => 'getTiers', + 'total' => 'getTotal', + 'hasMore' => 'getHasMore' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'tiers'); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('hasMore', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of promotion tier objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionTier[]|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionTier[]|null $tiers Contains array of promotion tier objects. + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of promotion tiers. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + 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/PromotionsStacksCreateRequestBody.php b/src/Model/PromotionsStacksCreateRequestBody.php new file mode 100644 index 0000000..c8b917a --- /dev/null +++ b/src/Model/PromotionsStacksCreateRequestBody.php @@ -0,0 +1,500 @@ + + */ +class PromotionsStacksCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionsStacksCreateRequestBodyTiers', + 'categoryId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'tiers' => null, + 'categoryId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'tiers' => true, + 'categoryId' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'tiers' => 'tiers', + 'categoryId' => 'category_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'tiers' => 'setTiers', + 'categoryId' => 'setCategoryId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'tiers' => 'getTiers', + 'categoryId' => 'getCategoryId' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('categoryId', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Promotion stack name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionsStacksCreateRequestBodyTiers|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionsStacksCreateRequestBodyTiers|null $tiers tiers + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion stack category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + 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/PromotionsStacksCreateRequestBodyTiers.php b/src/Model/PromotionsStacksCreateRequestBodyTiers.php new file mode 100644 index 0000000..d001a89 --- /dev/null +++ b/src/Model/PromotionsStacksCreateRequestBodyTiers.php @@ -0,0 +1,500 @@ + + */ +class PromotionsStacksCreateRequestBodyTiers implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksCreateRequestBodyTiers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => 'string[]', + 'hierarchyMode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'hierarchyMode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => true, + 'hierarchyMode' => true + ]; + + /** + * 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 = [ + 'ids' => 'ids', + 'hierarchyMode' => 'hierarchy_mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'hierarchyMode' => 'setHierarchyMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'hierarchyMode' => 'getHierarchyMode' + ]; + + /** + * 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 HIERARCHY_MODE_MANUAL = 'MANUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHierarchyModeAllowableValues() + { + return [ + self::HIERARCHY_MODE_MANUAL, + ]; + } + + /** + * 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('ids', $data ?? [], null); + $this->setIfExists('hierarchyMode', $data ?? [], 'MANUAL'); + } + + /** + * 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 = []; + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($this->container['hierarchyMode']) && !in_array($this->container['hierarchyMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $this->container['hierarchyMode'], + 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 ids + * + * @return string[]|null + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param string[]|null $ids Contains the list of tiers in a pre-defined sequence. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + array_push($this->openAPINullablesSetToNull, 'ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + + if (!is_null($ids) && (count($ids) < 1)) { + throw new \InvalidArgumentException('invalid length for $ids when calling PromotionsStacksCreateRequestBodyTiers., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets hierarchyMode + * + * @return string|null + */ + public function getHierarchyMode() + { + return $this->container['hierarchyMode']; + } + + /** + * Sets hierarchyMode + * + * @param string|null $hierarchyMode hierarchyMode + * + * @return self + */ + public function setHierarchyMode($hierarchyMode) + { + if (is_null($hierarchyMode)) { + array_push($this->openAPINullablesSetToNull, 'hierarchyMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchyMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($hierarchyMode) && !in_array($hierarchyMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $hierarchyMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['hierarchyMode'] = $hierarchyMode; + + 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/PromotionsStacksCreateResponseBody.php b/src/Model/PromotionsStacksCreateResponseBody.php new file mode 100644 index 0000000..f362243 --- /dev/null +++ b/src/Model/PromotionsStacksCreateResponseBody.php @@ -0,0 +1,737 @@ + + */ +class PromotionsStacksCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionsStacksCreateResponseBodyTiers', + 'id' => 'string', + 'createdAt' => '\DateTime', + 'campaignId' => 'string', + 'object' => 'string', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\PromotionStackBase[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'tiers' => null, + 'id' => null, + 'createdAt' => 'date-time', + 'campaignId' => null, + 'object' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'tiers' => true, + 'id' => true, + 'createdAt' => true, + 'campaignId' => true, + 'object' => true, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'tiers' => 'tiers', + 'id' => 'id', + 'createdAt' => 'created_at', + 'campaignId' => 'campaign_id', + 'object' => 'object', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'tiers' => 'setTiers', + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'campaignId' => 'setCampaignId', + 'object' => 'setObject', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'tiers' => 'getTiers', + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'campaignId' => 'getCampaignId', + 'object' => 'getObject', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 OBJECT_PROMOTION_STACK = 'promotion_stack'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PROMOTION_STACK, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_stack'); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Promotion stack name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionsStacksCreateResponseBodyTiers|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionsStacksCreateResponseBodyTiers|null $tiers tiers + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion stack ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion stack's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion stack category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\PromotionStackBase[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\PromotionStackBase[]|null $categories Details about the category assigned to the promotion stack. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionsStacksCreateResponseBodyTiers.php b/src/Model/PromotionsStacksCreateResponseBodyTiers.php new file mode 100644 index 0000000..c064341 --- /dev/null +++ b/src/Model/PromotionsStacksCreateResponseBodyTiers.php @@ -0,0 +1,500 @@ + + */ +class PromotionsStacksCreateResponseBodyTiers implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksCreateResponseBodyTiers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => 'string[]', + 'hierarchyMode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'hierarchyMode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => true, + 'hierarchyMode' => true + ]; + + /** + * 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 = [ + 'ids' => 'ids', + 'hierarchyMode' => 'hierarchy_mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'hierarchyMode' => 'setHierarchyMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'hierarchyMode' => 'getHierarchyMode' + ]; + + /** + * 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 HIERARCHY_MODE_MANUAL = 'MANUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHierarchyModeAllowableValues() + { + return [ + self::HIERARCHY_MODE_MANUAL, + ]; + } + + /** + * 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('ids', $data ?? [], null); + $this->setIfExists('hierarchyMode', $data ?? [], 'MANUAL'); + } + + /** + * 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 = []; + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($this->container['hierarchyMode']) && !in_array($this->container['hierarchyMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $this->container['hierarchyMode'], + 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 ids + * + * @return string[]|null + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param string[]|null $ids Contains the list of tiers in a pre-defined sequence. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + array_push($this->openAPINullablesSetToNull, 'ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + + if (!is_null($ids) && (count($ids) < 1)) { + throw new \InvalidArgumentException('invalid length for $ids when calling PromotionsStacksCreateResponseBodyTiers., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets hierarchyMode + * + * @return string|null + */ + public function getHierarchyMode() + { + return $this->container['hierarchyMode']; + } + + /** + * Sets hierarchyMode + * + * @param string|null $hierarchyMode hierarchyMode + * + * @return self + */ + public function setHierarchyMode($hierarchyMode) + { + if (is_null($hierarchyMode)) { + array_push($this->openAPINullablesSetToNull, 'hierarchyMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchyMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($hierarchyMode) && !in_array($hierarchyMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $hierarchyMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['hierarchyMode'] = $hierarchyMode; + + 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/PromotionsStacksGetResponseBody.php b/src/Model/PromotionsStacksGetResponseBody.php new file mode 100644 index 0000000..7864052 --- /dev/null +++ b/src/Model/PromotionsStacksGetResponseBody.php @@ -0,0 +1,778 @@ + + */ +class PromotionsStacksGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionsStacksGetResponseBodyTiers', + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'campaignId' => 'string', + 'object' => 'string', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'tiers' => null, + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'campaignId' => null, + 'object' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'tiers' => true, + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'campaignId' => true, + 'object' => true, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'tiers' => 'tiers', + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'campaignId' => 'campaign_id', + 'object' => 'object', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'tiers' => 'setTiers', + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'campaignId' => 'setCampaignId', + 'object' => 'setObject', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'tiers' => 'getTiers', + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'campaignId' => 'getCampaignId', + 'object' => 'getObject', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 OBJECT_PROMOTION_STACK = 'promotion_stack'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PROMOTION_STACK, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_stack'); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Promotion stack name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionsStacksGetResponseBodyTiers|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionsStacksGetResponseBodyTiers|null $tiers tiers + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion stack ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion stack's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion stack category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Details about the category assigned to the promotion stack. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionsStacksGetResponseBodyTiers.php b/src/Model/PromotionsStacksGetResponseBodyTiers.php new file mode 100644 index 0000000..0f52e75 --- /dev/null +++ b/src/Model/PromotionsStacksGetResponseBodyTiers.php @@ -0,0 +1,500 @@ + + */ +class PromotionsStacksGetResponseBodyTiers implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksGetResponseBodyTiers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => 'string[]', + 'hierarchyMode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'hierarchyMode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => true, + 'hierarchyMode' => true + ]; + + /** + * 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 = [ + 'ids' => 'ids', + 'hierarchyMode' => 'hierarchy_mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'hierarchyMode' => 'setHierarchyMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'hierarchyMode' => 'getHierarchyMode' + ]; + + /** + * 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 HIERARCHY_MODE_MANUAL = 'MANUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHierarchyModeAllowableValues() + { + return [ + self::HIERARCHY_MODE_MANUAL, + ]; + } + + /** + * 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('ids', $data ?? [], null); + $this->setIfExists('hierarchyMode', $data ?? [], 'MANUAL'); + } + + /** + * 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 = []; + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($this->container['hierarchyMode']) && !in_array($this->container['hierarchyMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $this->container['hierarchyMode'], + 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 ids + * + * @return string[]|null + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param string[]|null $ids Contains the list of tiers in a pre-defined sequence. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + array_push($this->openAPINullablesSetToNull, 'ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + + if (!is_null($ids) && (count($ids) < 1)) { + throw new \InvalidArgumentException('invalid length for $ids when calling PromotionsStacksGetResponseBodyTiers., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets hierarchyMode + * + * @return string|null + */ + public function getHierarchyMode() + { + return $this->container['hierarchyMode']; + } + + /** + * Sets hierarchyMode + * + * @param string|null $hierarchyMode hierarchyMode + * + * @return self + */ + public function setHierarchyMode($hierarchyMode) + { + if (is_null($hierarchyMode)) { + array_push($this->openAPINullablesSetToNull, 'hierarchyMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchyMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($hierarchyMode) && !in_array($hierarchyMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $hierarchyMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['hierarchyMode'] = $hierarchyMode; + + 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/PromotionsStacksListResponseBody.php b/src/Model/PromotionsStacksListResponseBody.php new file mode 100644 index 0000000..267fc93 --- /dev/null +++ b/src/Model/PromotionsStacksListResponseBody.php @@ -0,0 +1,614 @@ + + */ +class PromotionsStacksListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\PromotionStack[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['total']) && ($this->container['total'] < 0)) { + $invalidProperties[] = "invalid value for 'total', must be bigger than or equal to 0."; + } + + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about promotion stacks in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of promotion stack objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\PromotionStack[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\PromotionStack[]|null $data Contains array of promotion stack objects. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of promotion stacks. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($total) && ($total < 0)) { + throw new \InvalidArgumentException('invalid value for $total when calling PromotionsStacksListResponseBody., must be bigger than or equal to 0.'); + } + + $this->container['total'] = $total; + + 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/PromotionsStacksUpdateRequestBody.php b/src/Model/PromotionsStacksUpdateRequestBody.php new file mode 100644 index 0000000..34ebc25 --- /dev/null +++ b/src/Model/PromotionsStacksUpdateRequestBody.php @@ -0,0 +1,500 @@ + + */ +class PromotionsStacksUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionsStacksUpdateRequestBodyTiers', + 'categoryId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'tiers' => null, + 'categoryId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'tiers' => true, + 'categoryId' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'tiers' => 'tiers', + 'categoryId' => 'category_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'tiers' => 'setTiers', + 'categoryId' => 'setCategoryId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'tiers' => 'getTiers', + 'categoryId' => 'getCategoryId' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('categoryId', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Promotion stack name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionsStacksUpdateRequestBodyTiers|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionsStacksUpdateRequestBodyTiers|null $tiers tiers + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion stack category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + 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/PromotionsStacksUpdateRequestBodyTiers.php b/src/Model/PromotionsStacksUpdateRequestBodyTiers.php new file mode 100644 index 0000000..510d070 --- /dev/null +++ b/src/Model/PromotionsStacksUpdateRequestBodyTiers.php @@ -0,0 +1,491 @@ + + */ +class PromotionsStacksUpdateRequestBodyTiers implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksUpdateRequestBodyTiers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => 'string[]', + 'hierarchyMode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'hierarchyMode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => true, + 'hierarchyMode' => true + ]; + + /** + * 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 = [ + 'ids' => 'ids', + 'hierarchyMode' => 'hierarchy_mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'hierarchyMode' => 'setHierarchyMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'hierarchyMode' => 'getHierarchyMode' + ]; + + /** + * 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 HIERARCHY_MODE_MANUAL = 'MANUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHierarchyModeAllowableValues() + { + return [ + self::HIERARCHY_MODE_MANUAL, + ]; + } + + /** + * 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('ids', $data ?? [], null); + $this->setIfExists('hierarchyMode', $data ?? [], 'MANUAL'); + } + + /** + * 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->getHierarchyModeAllowableValues(); + if (!is_null($this->container['hierarchyMode']) && !in_array($this->container['hierarchyMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $this->container['hierarchyMode'], + 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 ids + * + * @return string[]|null + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param string[]|null $ids Contains the list of tiers in a pre-defined sequence. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + array_push($this->openAPINullablesSetToNull, 'ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets hierarchyMode + * + * @return string|null + */ + public function getHierarchyMode() + { + return $this->container['hierarchyMode']; + } + + /** + * Sets hierarchyMode + * + * @param string|null $hierarchyMode Category hierarchy. + * + * @return self + */ + public function setHierarchyMode($hierarchyMode) + { + if (is_null($hierarchyMode)) { + array_push($this->openAPINullablesSetToNull, 'hierarchyMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchyMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($hierarchyMode) && !in_array($hierarchyMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $hierarchyMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['hierarchyMode'] = $hierarchyMode; + + 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/PromotionsStacksUpdateResponseBody.php b/src/Model/PromotionsStacksUpdateResponseBody.php new file mode 100644 index 0000000..66e812c --- /dev/null +++ b/src/Model/PromotionsStacksUpdateResponseBody.php @@ -0,0 +1,778 @@ + + */ +class PromotionsStacksUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionsStacksUpdateResponseBodyTiers', + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'campaignId' => 'string', + 'object' => 'string', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\PromotionStackBase[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'tiers' => null, + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'campaignId' => null, + 'object' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'tiers' => true, + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'campaignId' => true, + 'object' => true, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'tiers' => 'tiers', + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'campaignId' => 'campaign_id', + 'object' => 'object', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'tiers' => 'setTiers', + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'campaignId' => 'setCampaignId', + 'object' => 'setObject', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'tiers' => 'getTiers', + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'campaignId' => 'getCampaignId', + 'object' => 'getObject', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 OBJECT_PROMOTION_STACK = 'promotion_stack'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PROMOTION_STACK, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_stack'); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Promotion stack name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionsStacksUpdateResponseBodyTiers|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionsStacksUpdateResponseBodyTiers|null $tiers tiers + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion stack ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion stack's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion stack category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\PromotionStackBase[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\PromotionStackBase[]|null $categories Details about the category assigned to the promotion stack. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionsStacksUpdateResponseBodyTiers.php b/src/Model/PromotionsStacksUpdateResponseBodyTiers.php new file mode 100644 index 0000000..d0ec800 --- /dev/null +++ b/src/Model/PromotionsStacksUpdateResponseBodyTiers.php @@ -0,0 +1,500 @@ + + */ +class PromotionsStacksUpdateResponseBodyTiers implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsStacksUpdateResponseBodyTiers'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => 'string[]', + 'hierarchyMode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'hierarchyMode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => true, + 'hierarchyMode' => true + ]; + + /** + * 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 = [ + 'ids' => 'ids', + 'hierarchyMode' => 'hierarchy_mode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'hierarchyMode' => 'setHierarchyMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'hierarchyMode' => 'getHierarchyMode' + ]; + + /** + * 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 HIERARCHY_MODE_MANUAL = 'MANUAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getHierarchyModeAllowableValues() + { + return [ + self::HIERARCHY_MODE_MANUAL, + ]; + } + + /** + * 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('ids', $data ?? [], null); + $this->setIfExists('hierarchyMode', $data ?? [], 'MANUAL'); + } + + /** + * 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 = []; + + if (!is_null($this->container['ids']) && (count($this->container['ids']) < 1)) { + $invalidProperties[] = "invalid value for 'ids', number of items must be greater than or equal to 1."; + } + + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($this->container['hierarchyMode']) && !in_array($this->container['hierarchyMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $this->container['hierarchyMode'], + 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 ids + * + * @return string[]|null + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param string[]|null $ids Contains the list of tiers in a pre-defined sequence. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + array_push($this->openAPINullablesSetToNull, 'ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ids', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + + if (!is_null($ids) && (count($ids) < 1)) { + throw new \InvalidArgumentException('invalid length for $ids when calling PromotionsStacksUpdateResponseBodyTiers., number of items must be greater than or equal to 1.'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets hierarchyMode + * + * @return string|null + */ + public function getHierarchyMode() + { + return $this->container['hierarchyMode']; + } + + /** + * Sets hierarchyMode + * + * @param string|null $hierarchyMode hierarchyMode + * + * @return self + */ + public function setHierarchyMode($hierarchyMode) + { + if (is_null($hierarchyMode)) { + array_push($this->openAPINullablesSetToNull, 'hierarchyMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchyMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getHierarchyModeAllowableValues(); + if (!is_null($hierarchyMode) && !in_array($hierarchyMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'hierarchyMode', must be one of '%s'", + $hierarchyMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['hierarchyMode'] = $hierarchyMode; + + 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/PromotionsTiersCreateRequestBody.php b/src/Model/PromotionsTiersCreateRequestBody.php new file mode 100644 index 0000000..41b6b92 --- /dev/null +++ b/src/Model/PromotionsTiersCreateRequestBody.php @@ -0,0 +1,964 @@ + + */ +class PromotionsTiersCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionsTiersCreateRequestBodyAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'category' => 'string', + 'categoryId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'validationRuleAssignments' => null, + 'category' => null, + 'categoryId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'validationRuleAssignments' => false, + 'category' => true, + 'categoryId' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'category' => 'category', + 'categoryId' => 'category_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionsTiersCreateRequestBodyAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionsTiersCreateRequestBodyAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Assign a new or update the promotion tier's category using name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Assign a new or update the promotion tier's category using id + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + 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/PromotionsTiersCreateRequestBodyAction.php b/src/Model/PromotionsTiersCreateRequestBodyAction.php new file mode 100644 index 0000000..317a1c3 --- /dev/null +++ b/src/Model/PromotionsTiersCreateRequestBodyAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionsTiersCreateRequestBodyAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersCreateRequestBodyAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionsTiersCreateResponseBody.php b/src/Model/PromotionsTiersCreateResponseBody.php new file mode 100644 index 0000000..fe20868 --- /dev/null +++ b/src/Model/PromotionsTiersCreateResponseBody.php @@ -0,0 +1,1292 @@ + + */ +class PromotionsTiersCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodyAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodyCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => true, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => true, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodyAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodyAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodyCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodyCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + array_push($this->openAPINullablesSetToNull, 'summary'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('summary', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionsTiersCreateResponseBodyAction.php b/src/Model/PromotionsTiersCreateResponseBodyAction.php new file mode 100644 index 0000000..ae589b7 --- /dev/null +++ b/src/Model/PromotionsTiersCreateResponseBodyAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionsTiersCreateResponseBodyAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersCreateResponseBodyAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionsTiersCreateResponseBodyCampaign.php b/src/Model/PromotionsTiersCreateResponseBodyCampaign.php new file mode 100644 index 0000000..814ab71 --- /dev/null +++ b/src/Model/PromotionsTiersCreateResponseBodyCampaign.php @@ -0,0 +1,766 @@ + + */ +class PromotionsTiersCreateResponseBodyCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersCreateResponseBodyCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/PromotionsTiersCreateResponseBodySummary.php b/src/Model/PromotionsTiersCreateResponseBodySummary.php new file mode 100644 index 0000000..e13f7c6 --- /dev/null +++ b/src/Model/PromotionsTiersCreateResponseBodySummary.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersCreateResponseBodySummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersCreateResponseBodySummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'orders' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\PromotionsTiersCreateResponseBodySummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + 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/PromotionsTiersCreateResponseBodySummaryOrders.php b/src/Model/PromotionsTiersCreateResponseBodySummaryOrders.php new file mode 100644 index 0000000..df876d6 --- /dev/null +++ b/src/Model/PromotionsTiersCreateResponseBodySummaryOrders.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersCreateResponseBodySummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersCreateResponseBodySummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/PromotionsTiersCreateResponseBodySummaryRedemptions.php b/src/Model/PromotionsTiersCreateResponseBodySummaryRedemptions.php new file mode 100644 index 0000000..1df8596 --- /dev/null +++ b/src/Model/PromotionsTiersCreateResponseBodySummaryRedemptions.php @@ -0,0 +1,418 @@ + + */ +class PromotionsTiersCreateResponseBodySummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersCreateResponseBodySummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/PromotionsTiersDisableResponseBody.php b/src/Model/PromotionsTiersDisableResponseBody.php new file mode 100644 index 0000000..2f07a98 --- /dev/null +++ b/src/Model/PromotionsTiersDisableResponseBody.php @@ -0,0 +1,1292 @@ + + */ +class PromotionsTiersDisableResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersDisableResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodyAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodyCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => true, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => true, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodyAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodyAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodyCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodyCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + array_push($this->openAPINullablesSetToNull, 'summary'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('summary', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionsTiersDisableResponseBodyAction.php b/src/Model/PromotionsTiersDisableResponseBodyAction.php new file mode 100644 index 0000000..9d904fc --- /dev/null +++ b/src/Model/PromotionsTiersDisableResponseBodyAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionsTiersDisableResponseBodyAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersDisableResponseBodyAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionsTiersDisableResponseBodyCampaign.php b/src/Model/PromotionsTiersDisableResponseBodyCampaign.php new file mode 100644 index 0000000..0c1bf91 --- /dev/null +++ b/src/Model/PromotionsTiersDisableResponseBodyCampaign.php @@ -0,0 +1,766 @@ + + */ +class PromotionsTiersDisableResponseBodyCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersDisableResponseBodyCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/PromotionsTiersDisableResponseBodySummary.php b/src/Model/PromotionsTiersDisableResponseBodySummary.php new file mode 100644 index 0000000..9acdef7 --- /dev/null +++ b/src/Model/PromotionsTiersDisableResponseBodySummary.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersDisableResponseBodySummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersDisableResponseBodySummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'orders' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\PromotionsTiersDisableResponseBodySummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + 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/PromotionsTiersDisableResponseBodySummaryOrders.php b/src/Model/PromotionsTiersDisableResponseBodySummaryOrders.php new file mode 100644 index 0000000..3bb7560 --- /dev/null +++ b/src/Model/PromotionsTiersDisableResponseBodySummaryOrders.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersDisableResponseBodySummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersDisableResponseBodySummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/PromotionsTiersDisableResponseBodySummaryRedemptions.php b/src/Model/PromotionsTiersDisableResponseBodySummaryRedemptions.php new file mode 100644 index 0000000..74766d1 --- /dev/null +++ b/src/Model/PromotionsTiersDisableResponseBodySummaryRedemptions.php @@ -0,0 +1,418 @@ + + */ +class PromotionsTiersDisableResponseBodySummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersDisableResponseBodySummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/PromotionsTiersEnableResponseBody.php b/src/Model/PromotionsTiersEnableResponseBody.php new file mode 100644 index 0000000..f03aec7 --- /dev/null +++ b/src/Model/PromotionsTiersEnableResponseBody.php @@ -0,0 +1,1292 @@ + + */ +class PromotionsTiersEnableResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersEnableResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodyAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodyCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => true, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => true, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodyAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodyAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodyCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodyCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + array_push($this->openAPINullablesSetToNull, 'summary'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('summary', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionsTiersEnableResponseBodyAction.php b/src/Model/PromotionsTiersEnableResponseBodyAction.php new file mode 100644 index 0000000..ab04040 --- /dev/null +++ b/src/Model/PromotionsTiersEnableResponseBodyAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionsTiersEnableResponseBodyAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersEnableResponseBodyAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionsTiersEnableResponseBodyCampaign.php b/src/Model/PromotionsTiersEnableResponseBodyCampaign.php new file mode 100644 index 0000000..809b2a9 --- /dev/null +++ b/src/Model/PromotionsTiersEnableResponseBodyCampaign.php @@ -0,0 +1,766 @@ + + */ +class PromotionsTiersEnableResponseBodyCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersEnableResponseBodyCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/PromotionsTiersEnableResponseBodySummary.php b/src/Model/PromotionsTiersEnableResponseBodySummary.php new file mode 100644 index 0000000..2dfc214 --- /dev/null +++ b/src/Model/PromotionsTiersEnableResponseBodySummary.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersEnableResponseBodySummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersEnableResponseBodySummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'orders' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\PromotionsTiersEnableResponseBodySummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + 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/PromotionsTiersEnableResponseBodySummaryOrders.php b/src/Model/PromotionsTiersEnableResponseBodySummaryOrders.php new file mode 100644 index 0000000..72649e5 --- /dev/null +++ b/src/Model/PromotionsTiersEnableResponseBodySummaryOrders.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersEnableResponseBodySummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersEnableResponseBodySummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/PromotionsTiersEnableResponseBodySummaryRedemptions.php b/src/Model/PromotionsTiersEnableResponseBodySummaryRedemptions.php new file mode 100644 index 0000000..1c293f0 --- /dev/null +++ b/src/Model/PromotionsTiersEnableResponseBodySummaryRedemptions.php @@ -0,0 +1,418 @@ + + */ +class PromotionsTiersEnableResponseBodySummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersEnableResponseBodySummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/PromotionsTiersGetResponseBody.php b/src/Model/PromotionsTiersGetResponseBody.php new file mode 100644 index 0000000..52c0cca --- /dev/null +++ b/src/Model/PromotionsTiersGetResponseBody.php @@ -0,0 +1,1292 @@ + + */ +class PromotionsTiersGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionsTiersGetResponseBodyAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\PromotionsTiersGetResponseBodyCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => true, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => true, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionsTiersGetResponseBodyAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionsTiersGetResponseBodyAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\PromotionsTiersGetResponseBodyCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\PromotionsTiersGetResponseBodyCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + array_push($this->openAPINullablesSetToNull, 'summary'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('summary', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionsTiersGetResponseBodyAction.php b/src/Model/PromotionsTiersGetResponseBodyAction.php new file mode 100644 index 0000000..88a0484 --- /dev/null +++ b/src/Model/PromotionsTiersGetResponseBodyAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionsTiersGetResponseBodyAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersGetResponseBodyAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionsTiersGetResponseBodyCampaign.php b/src/Model/PromotionsTiersGetResponseBodyCampaign.php new file mode 100644 index 0000000..4e50e65 --- /dev/null +++ b/src/Model/PromotionsTiersGetResponseBodyCampaign.php @@ -0,0 +1,766 @@ + + */ +class PromotionsTiersGetResponseBodyCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersGetResponseBodyCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/PromotionsTiersGetResponseBodySummary.php b/src/Model/PromotionsTiersGetResponseBodySummary.php new file mode 100644 index 0000000..a2a37bb --- /dev/null +++ b/src/Model/PromotionsTiersGetResponseBodySummary.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersGetResponseBodySummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersGetResponseBodySummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'orders' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\PromotionsTiersGetResponseBodySummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + 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/PromotionsTiersGetResponseBodySummaryOrders.php b/src/Model/PromotionsTiersGetResponseBodySummaryOrders.php new file mode 100644 index 0000000..0f476eb --- /dev/null +++ b/src/Model/PromotionsTiersGetResponseBodySummaryOrders.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersGetResponseBodySummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersGetResponseBodySummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/PromotionsTiersGetResponseBodySummaryRedemptions.php b/src/Model/PromotionsTiersGetResponseBodySummaryRedemptions.php new file mode 100644 index 0000000..5698475 --- /dev/null +++ b/src/Model/PromotionsTiersGetResponseBodySummaryRedemptions.php @@ -0,0 +1,418 @@ + + */ +class PromotionsTiersGetResponseBodySummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersGetResponseBodySummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/PromotionsTiersListResponseBody.php b/src/Model/PromotionsTiersListResponseBody.php new file mode 100644 index 0000000..365067a --- /dev/null +++ b/src/Model/PromotionsTiersListResponseBody.php @@ -0,0 +1,582 @@ + + */ +class PromotionsTiersListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'tiers' => '\OpenAPI\Client\Model\PromotionTier[]', + 'total' => 'int', + 'hasMore' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'tiers' => null, + 'total' => null, + 'hasMore' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'tiers' => true, + 'total' => true, + 'hasMore' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'tiers' => 'tiers', + 'total' => 'total', + 'hasMore' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'tiers' => 'setTiers', + 'total' => 'setTotal', + 'hasMore' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'tiers' => 'getTiers', + 'total' => 'getTotal', + 'hasMore' => 'getHasMore' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'tiers'); + $this->setIfExists('tiers', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('hasMore', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of promotion tier objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets tiers + * + * @return \OpenAPI\Client\Model\PromotionTier[]|null + */ + public function getTiers() + { + return $this->container['tiers']; + } + + /** + * Sets tiers + * + * @param \OpenAPI\Client\Model\PromotionTier[]|null $tiers Contains array of promotion tier objects. + * + * @return self + */ + public function setTiers($tiers) + { + if (is_null($tiers)) { + array_push($this->openAPINullablesSetToNull, 'tiers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tiers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tiers'] = $tiers; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of promotion tiers. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + 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/PromotionsTiersUpdateRequestBody.php b/src/Model/PromotionsTiersUpdateRequestBody.php new file mode 100644 index 0000000..ab7d174 --- /dev/null +++ b/src/Model/PromotionsTiersUpdateRequestBody.php @@ -0,0 +1,923 @@ + + */ +class PromotionsTiersUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionsTiersUpdateRequestBodyAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'category' => 'string', + 'categoryId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'validationRuleAssignments' => null, + 'category' => null, + 'categoryId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'validationRuleAssignments' => false, + 'category' => true, + 'categoryId' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'category' => 'category', + 'categoryId' => 'category_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionsTiersUpdateRequestBodyAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateRequestBodyAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Assign a new or update the promotion tier's category using name. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Assign a new or update the promotion tier's category using id + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + 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/PromotionsTiersUpdateRequestBodyAction.php b/src/Model/PromotionsTiersUpdateRequestBodyAction.php new file mode 100644 index 0000000..b01db28 --- /dev/null +++ b/src/Model/PromotionsTiersUpdateRequestBodyAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionsTiersUpdateRequestBodyAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersUpdateRequestBodyAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionsTiersUpdateResponseBody.php b/src/Model/PromotionsTiersUpdateResponseBody.php new file mode 100644 index 0000000..10cf5e0 --- /dev/null +++ b/src/Model/PromotionsTiersUpdateResponseBody.php @@ -0,0 +1,1292 @@ + + */ +class PromotionsTiersUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodyAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodyCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => true, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => true, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodyAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodyAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodyCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodyCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + array_push($this->openAPINullablesSetToNull, 'summary'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('summary', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/PromotionsTiersUpdateResponseBodyAction.php b/src/Model/PromotionsTiersUpdateResponseBodyAction.php new file mode 100644 index 0000000..fa4ce29 --- /dev/null +++ b/src/Model/PromotionsTiersUpdateResponseBodyAction.php @@ -0,0 +1,411 @@ + + */ +class PromotionsTiersUpdateResponseBodyAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersUpdateResponseBodyAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/PromotionsTiersUpdateResponseBodyCampaign.php b/src/Model/PromotionsTiersUpdateResponseBodyCampaign.php new file mode 100644 index 0000000..e3402ff --- /dev/null +++ b/src/Model/PromotionsTiersUpdateResponseBodyCampaign.php @@ -0,0 +1,766 @@ + + */ +class PromotionsTiersUpdateResponseBodyCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersUpdateResponseBodyCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/PromotionsTiersUpdateResponseBodySummary.php b/src/Model/PromotionsTiersUpdateResponseBodySummary.php new file mode 100644 index 0000000..e023add --- /dev/null +++ b/src/Model/PromotionsTiersUpdateResponseBodySummary.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersUpdateResponseBodySummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersUpdateResponseBodySummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'orders' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\PromotionsTiersUpdateResponseBodySummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + 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/PromotionsTiersUpdateResponseBodySummaryOrders.php b/src/Model/PromotionsTiersUpdateResponseBodySummaryOrders.php new file mode 100644 index 0000000..cd0423b --- /dev/null +++ b/src/Model/PromotionsTiersUpdateResponseBodySummaryOrders.php @@ -0,0 +1,459 @@ + + */ +class PromotionsTiersUpdateResponseBodySummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersUpdateResponseBodySummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/PromotionsTiersUpdateResponseBodySummaryRedemptions.php b/src/Model/PromotionsTiersUpdateResponseBodySummaryRedemptions.php new file mode 100644 index 0000000..e6e7ffb --- /dev/null +++ b/src/Model/PromotionsTiersUpdateResponseBodySummaryRedemptions.php @@ -0,0 +1,418 @@ + + */ +class PromotionsTiersUpdateResponseBodySummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PromotionsTiersUpdateResponseBodySummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/PublicationsCreateRequestBody.php b/src/Model/PublicationsCreateRequestBody.php new file mode 100644 index 0000000..ba70f73 --- /dev/null +++ b/src/Model/PublicationsCreateRequestBody.php @@ -0,0 +1,615 @@ + + */ +class PublicationsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicationsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'voucher' => 'string', + 'sourceId' => 'string', + 'customer' => '\OpenAPI\Client\Model\PublicationsCreateRequestBodyCustomer', + 'metadata' => 'object', + 'channel' => 'string', + 'campaign' => '\OpenAPI\Client\Model\CreatePublicationCampaign' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'voucher' => null, + 'sourceId' => null, + 'customer' => null, + 'metadata' => null, + 'channel' => null, + 'campaign' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'voucher' => true, + 'sourceId' => true, + 'customer' => true, + 'metadata' => true, + 'channel' => true, + 'campaign' => 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 = [ + 'voucher' => 'voucher', + 'sourceId' => 'source_id', + 'customer' => 'customer', + 'metadata' => 'metadata', + 'channel' => 'channel', + 'campaign' => 'campaign' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'voucher' => 'setVoucher', + 'sourceId' => 'setSourceId', + 'customer' => 'setCustomer', + 'metadata' => 'setMetadata', + 'channel' => 'setChannel', + 'campaign' => 'setCampaign' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'voucher' => 'getVoucher', + 'sourceId' => 'getSourceId', + 'customer' => 'getCustomer', + 'metadata' => 'getMetadata', + 'channel' => 'getChannel', + 'campaign' => 'getCampaign' + ]; + + /** + * 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('voucher', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('campaign', $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 voucher + * + * @return string|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param string|null $voucher Code of the voucher being published. + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + array_push($this->openAPINullablesSetToNull, 'voucher'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucher', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\PublicationsCreateRequestBodyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\PublicationsCreateRequestBodyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel Specify the distribution channel. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\CreatePublicationCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\CreatePublicationCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + throw new \InvalidArgumentException('non-nullable campaign cannot be null'); + } + $this->container['campaign'] = $campaign; + + 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/PublicationsCreateRequestBodyCustomer.php b/src/Model/PublicationsCreateRequestBodyCustomer.php new file mode 100644 index 0000000..07bfc3c --- /dev/null +++ b/src/Model/PublicationsCreateRequestBodyCustomer.php @@ -0,0 +1,786 @@ + + */ +class PublicationsCreateRequestBodyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicationsCreateRequestBodyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\PublicationsCreateRequestBodyCustomerAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\PublicationsCreateRequestBodyCustomerAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\PublicationsCreateRequestBodyCustomerAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/PublicationsCreateRequestBodyCustomerAddress.php b/src/Model/PublicationsCreateRequestBodyCustomerAddress.php new file mode 100644 index 0000000..f69061b --- /dev/null +++ b/src/Model/PublicationsCreateRequestBodyCustomerAddress.php @@ -0,0 +1,622 @@ + + */ +class PublicationsCreateRequestBodyCustomerAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicationsCreateRequestBodyCustomerAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/PublicationsCreateResponseBody.php b/src/Model/PublicationsCreateResponseBody.php new file mode 100644 index 0000000..77eb031 --- /dev/null +++ b/src/Model/PublicationsCreateResponseBody.php @@ -0,0 +1,991 @@ + + */ +class PublicationsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicationsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => 'object', + 'channel' => 'string', + 'sourceId' => 'string', + 'result' => 'string', + 'customer' => '\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals', + 'vouchersId' => 'string[]', + 'voucher' => '\OpenAPI\Client\Model\Voucher', + 'vouchers' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'channel' => null, + 'sourceId' => null, + 'result' => null, + 'customer' => null, + 'vouchersId' => null, + 'voucher' => null, + 'vouchers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => true, + 'channel' => true, + 'sourceId' => true, + 'result' => true, + 'customer' => false, + 'vouchersId' => true, + 'voucher' => false, + 'vouchers' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'channel' => 'channel', + 'sourceId' => 'source_id', + 'result' => 'result', + 'customer' => 'customer', + 'vouchersId' => 'vouchers_id', + 'voucher' => 'voucher', + 'vouchers' => 'vouchers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'channel' => 'setChannel', + 'sourceId' => 'setSourceId', + 'result' => 'setResult', + 'customer' => 'setCustomer', + 'vouchersId' => 'setVouchersId', + 'voucher' => 'setVoucher', + 'vouchers' => 'setVouchers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'channel' => 'getChannel', + 'sourceId' => 'getSourceId', + 'result' => 'getResult', + 'customer' => 'getCustomer', + 'vouchersId' => 'getVouchersId', + 'voucher' => 'getVoucher', + 'vouchers' => 'getVouchers' + ]; + + /** + * 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 OBJECT_PUBLICATION = 'publication'; + public const CHANNEL_API = 'API'; + public const RESULT_SUCCESS = 'SUCCESS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PUBLICATION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_API, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'publication'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'API'); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('result', $data ?? [], 'SUCCESS'); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('vouchersId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('vouchers', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique publication ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the `publication`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer receiving the publication. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Customer's `source_id`. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel How the publication was originated. It can be your own custom channel or an example value provided here. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result Status of the publication attempt. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($result) && !in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets vouchersId + * + * @return string[]|null + */ + public function getVouchersId() + { + return $this->container['vouchersId']; + } + + /** + * Sets vouchersId + * + * @param string[]|null $vouchersId Contains the unique internal voucher ID that was assigned by Voucherify. + * + * @return self + */ + public function setVouchersId($vouchersId) + { + if (is_null($vouchersId)) { + array_push($this->openAPINullablesSetToNull, 'vouchersId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersId'] = $vouchersId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\Voucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\Voucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets vouchers + * + * @return string[]|null + */ + public function getVouchers() + { + return $this->container['vouchers']; + } + + /** + * Sets vouchers + * + * @param string[]|null $vouchers Contains the unique voucher codes that was assigned by Voucherify. + * + * @return self + */ + public function setVouchers($vouchers) + { + if (is_null($vouchers)) { + array_push($this->openAPINullablesSetToNull, 'vouchers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchers'] = $vouchers; + + 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/PublicationsListResponseBody.php b/src/Model/PublicationsListResponseBody.php new file mode 100644 index 0000000..d30e620 --- /dev/null +++ b/src/Model/PublicationsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class PublicationsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicationsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'publications' => '\OpenAPI\Client\Model\PublicationsListResponseBodyPublicationsItem[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'publications' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'publications' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'publications' => 'publications', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'publications' => 'setPublications', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'publications' => 'getPublications', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'publications'); + $this->setIfExists('publications', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about publications in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of publications. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets publications + * + * @return \OpenAPI\Client\Model\PublicationsListResponseBodyPublicationsItem[]|null + */ + public function getPublications() + { + return $this->container['publications']; + } + + /** + * Sets publications + * + * @param \OpenAPI\Client\Model\PublicationsListResponseBodyPublicationsItem[]|null $publications Response schema model for publishing vouchers to a specific customer. + * + * @return self + */ + public function setPublications($publications) + { + if (is_null($publications)) { + array_push($this->openAPINullablesSetToNull, 'publications'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publications', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publications'] = $publications; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of publications. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/PublicationsListResponseBodyPublicationsItem.php b/src/Model/PublicationsListResponseBodyPublicationsItem.php new file mode 100644 index 0000000..15865ff --- /dev/null +++ b/src/Model/PublicationsListResponseBodyPublicationsItem.php @@ -0,0 +1,1022 @@ + + */ +class PublicationsListResponseBodyPublicationsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicationsListResponseBodyPublicationsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => '\OpenAPI\Client\Model\PublicationsListResponseBodyPublicationsItemMetadata', + 'channel' => 'string', + 'sourceId' => 'string', + 'customer' => '\OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals', + 'vouchers' => 'string[]', + 'vouchersId' => 'string[]', + 'result' => 'string', + 'voucher' => '\OpenAPI\Client\Model\ListPublicationsItemVoucher', + 'failureCode' => 'string', + 'failureMessage' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'channel' => null, + 'sourceId' => null, + 'customer' => null, + 'vouchers' => null, + 'vouchersId' => null, + 'result' => null, + 'voucher' => null, + 'failureCode' => null, + 'failureMessage' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => false, + 'channel' => true, + 'sourceId' => true, + 'customer' => false, + 'vouchers' => false, + 'vouchersId' => true, + 'result' => false, + 'voucher' => false, + 'failureCode' => true, + 'failureMessage' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'channel' => 'channel', + 'sourceId' => 'source_id', + 'customer' => 'customer', + 'vouchers' => 'vouchers', + 'vouchersId' => 'vouchers_id', + 'result' => 'result', + 'voucher' => 'voucher', + 'failureCode' => 'failure_code', + 'failureMessage' => 'failure_message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'channel' => 'setChannel', + 'sourceId' => 'setSourceId', + 'customer' => 'setCustomer', + 'vouchers' => 'setVouchers', + 'vouchersId' => 'setVouchersId', + 'result' => 'setResult', + 'voucher' => 'setVoucher', + 'failureCode' => 'setFailureCode', + 'failureMessage' => 'setFailureMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'channel' => 'getChannel', + 'sourceId' => 'getSourceId', + 'customer' => 'getCustomer', + 'vouchers' => 'getVouchers', + 'vouchersId' => 'getVouchersId', + 'result' => 'getResult', + 'voucher' => 'getVoucher', + 'failureCode' => 'getFailureCode', + 'failureMessage' => 'getFailureMessage' + ]; + + /** + * 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 OBJECT_PUBLICATION = 'publication'; + public const RESULT_SUCCESS = 'SUCCESS'; + public const RESULT_FAILURE = 'FAILURE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_PUBLICATION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + self::RESULT_FAILURE, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'publication'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('vouchers', $data ?? [], null); + $this->setIfExists('vouchersId', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('failureMessage', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique publication ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the `publication`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer receiving the publication. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Customer's `source_id`. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\PublicationsListResponseBodyPublicationsItemMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\PublicationsListResponseBodyPublicationsItemMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel How the publication was originated. It can be your own custom channel or an example value provided here. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\CustomerWithSummaryLoyaltyReferrals|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets vouchers + * + * @return string[]|null + */ + public function getVouchers() + { + return $this->container['vouchers']; + } + + /** + * Sets vouchers + * + * @param string[]|null $vouchers Contains the voucher IDs that was assigned by Voucherify. and Contains the unique voucher codes that was assigned by Voucherify. + * + * @return self + */ + public function setVouchers($vouchers) + { + if (is_null($vouchers)) { + throw new \InvalidArgumentException('non-nullable vouchers cannot be null'); + } + $this->container['vouchers'] = $vouchers; + + return $this; + } + + /** + * Gets vouchersId + * + * @return string[]|null + */ + public function getVouchersId() + { + return $this->container['vouchersId']; + } + + /** + * Sets vouchersId + * + * @param string[]|null $vouchersId Contains the unique internal voucher IDs that was assigned by Voucherify. + * + * @return self + */ + public function setVouchersId($vouchersId) + { + if (is_null($vouchersId)) { + array_push($this->openAPINullablesSetToNull, 'vouchersId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchersId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchersId'] = $vouchersId; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $allowedValues = $this->getResultAllowableValues(); + if (!in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\ListPublicationsItemVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\ListPublicationsItemVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets failureCode + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param string|null $failureCode Generic reason as to why the create publication operation failed. + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets failureMessage + * + * @return string|null + */ + public function getFailureMessage() + { + return $this->container['failureMessage']; + } + + /** + * Sets failureMessage + * + * @param string|null $failureMessage This parameter will provide more expanded reason as to why the create publication operation failed. + * + * @return self + */ + public function setFailureMessage($failureMessage) + { + if (is_null($failureMessage)) { + array_push($this->openAPINullablesSetToNull, 'failureMessage'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureMessage', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureMessage'] = $failureMessage; + + 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/PublicationsListResponseBodyPublicationsItemMetadata.php b/src/Model/PublicationsListResponseBodyPublicationsItemMetadata.php new file mode 100644 index 0000000..76638c2 --- /dev/null +++ b/src/Model/PublicationsListResponseBodyPublicationsItemMetadata.php @@ -0,0 +1,499 @@ + + */ +class PublicationsListResponseBodyPublicationsItemMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PublicationsListResponseBodyPublicationsItemMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sourceType' => 'string', + 'sourceId' => 'string', + 'distributionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sourceType' => null, + 'sourceId' => null, + 'distributionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sourceType' => true, + 'sourceId' => true, + 'distributionId' => true + ]; + + /** + * 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 = [ + 'sourceType' => 'source_type', + 'sourceId' => 'source_id', + 'distributionId' => 'distribution_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sourceType' => 'setSourceType', + 'sourceId' => 'setSourceId', + 'distributionId' => 'setDistributionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sourceType' => 'getSourceType', + 'sourceId' => 'getSourceId', + 'distributionId' => 'getDistributionId' + ]; + + /** + * 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('sourceType', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('distributionId', $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 sourceType + * + * @return string|null + */ + public function getSourceType() + { + return $this->container['sourceType']; + } + + /** + * Sets sourceType + * + * @param string|null $sourceType Defines the type of the distribution source. + * + * @return self + */ + public function setSourceType($sourceType) + { + if (is_null($sourceType)) { + array_push($this->openAPINullablesSetToNull, 'sourceType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceType'] = $sourceType; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique identifier of the distribution source. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets distributionId + * + * @return string|null + */ + public function getDistributionId() + { + return $this->container['distributionId']; + } + + /** + * Sets distributionId + * + * @param string|null $distributionId Unique identifier of the distribution. + * + * @return self + */ + public function setDistributionId($distributionId) + { + if (is_null($distributionId)) { + array_push($this->openAPINullablesSetToNull, 'distributionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('distributionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['distributionId'] = $distributionId; + + 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/QualificationsCheckEligibilityRequestBody.php b/src/Model/QualificationsCheckEligibilityRequestBody.php new file mode 100644 index 0000000..d57e1be --- /dev/null +++ b/src/Model/QualificationsCheckEligibilityRequestBody.php @@ -0,0 +1,648 @@ + + */ +class QualificationsCheckEligibilityRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsCheckEligibilityRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customer' => '\OpenAPI\Client\Model\Customer', + 'order' => '\OpenAPI\Client\Model\Order', + 'trackingId' => 'string', + 'scenario' => 'string', + 'options' => '\OpenAPI\Client\Model\QualificationsOption', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customer' => null, + 'order' => null, + 'trackingId' => null, + 'scenario' => null, + 'options' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customer' => false, + 'order' => false, + 'trackingId' => true, + 'scenario' => true, + 'options' => false, + 'metadata' => true + ]; + + /** + * 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 = [ + 'customer' => 'customer', + 'order' => 'order', + 'trackingId' => 'tracking_id', + 'scenario' => 'scenario', + 'options' => 'options', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customer' => 'setCustomer', + 'order' => 'setOrder', + 'trackingId' => 'setTrackingId', + 'scenario' => 'setScenario', + 'options' => 'setOptions', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customer' => 'getCustomer', + 'order' => 'getOrder', + 'trackingId' => 'getTrackingId', + 'scenario' => 'getScenario', + 'options' => 'getOptions', + 'metadata' => 'getMetadata' + ]; + + /** + * 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 SCENARIO_ALL = 'ALL'; + public const SCENARIO_CUSTOMER_WALLET = 'CUSTOMER_WALLET'; + public const SCENARIO_AUDIENCE_ONLY = 'AUDIENCE_ONLY'; + public const SCENARIO_PRODUCTS = 'PRODUCTS'; + public const SCENARIO_PRODUCTS_DISCOUNT = 'PRODUCTS_DISCOUNT'; + public const SCENARIO_PROMOTION_STACKS = 'PROMOTION_STACKS'; + public const SCENARIO_PRODUCTS_BY_CUSTOMER = 'PRODUCTS_BY_CUSTOMER'; + public const SCENARIO_PRODUCTS_DISCOUNT_BY_CUSTOMER = 'PRODUCTS_DISCOUNT_BY_CUSTOMER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getScenarioAllowableValues() + { + return [ + self::SCENARIO_ALL, + self::SCENARIO_CUSTOMER_WALLET, + self::SCENARIO_AUDIENCE_ONLY, + self::SCENARIO_PRODUCTS, + self::SCENARIO_PRODUCTS_DISCOUNT, + self::SCENARIO_PROMOTION_STACKS, + self::SCENARIO_PRODUCTS_BY_CUSTOMER, + self::SCENARIO_PRODUCTS_DISCOUNT_BY_CUSTOMER, + ]; + } + + /** + * 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('customer', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('scenario', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('metadata', $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->getScenarioAllowableValues(); + if (!is_null($this->container['scenario']) && !in_array($this->container['scenario'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'scenario', must be one of '%s'", + $this->container['scenario'], + 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 customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Is correspondent to Customer's source_id + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets scenario + * + * @return string|null + */ + public function getScenario() + { + return $this->container['scenario']; + } + + /** + * Sets scenario + * + * @param string|null $scenario Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). + * + * @return self + */ + public function setScenario($scenario) + { + if (is_null($scenario)) { + array_push($this->openAPINullablesSetToNull, 'scenario'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('scenario', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getScenarioAllowableValues(); + if (!is_null($scenario) && !in_array($scenario, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'scenario', must be one of '%s'", + $scenario, + implode("', '", $allowedValues) + ) + ); + } + $this->container['scenario'] = $scenario; + + return $this; + } + + /** + * Gets options + * + * @return \OpenAPI\Client\Model\QualificationsOption|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \OpenAPI\Client\Model\QualificationsOption|null $options options + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Advanced_ → _Redemption metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/QualificationsCheckEligibilityResponseBody.php b/src/Model/QualificationsCheckEligibilityResponseBody.php new file mode 100644 index 0000000..5eb88c2 --- /dev/null +++ b/src/Model/QualificationsCheckEligibilityResponseBody.php @@ -0,0 +1,520 @@ + + */ +class QualificationsCheckEligibilityResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsCheckEligibilityResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redeemables' => '\OpenAPI\Client\Model\QualificationsRedeemables', + 'trackingId' => 'string', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'stackingRules' => '\OpenAPI\Client\Model\StackingRules' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redeemables' => null, + 'trackingId' => null, + 'order' => null, + 'stackingRules' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redeemables' => false, + 'trackingId' => true, + 'order' => false, + 'stackingRules' => 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 = [ + 'redeemables' => 'redeemables', + 'trackingId' => 'tracking_id', + 'order' => 'order', + 'stackingRules' => 'stacking_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redeemables' => 'setRedeemables', + 'trackingId' => 'setTrackingId', + 'order' => 'setOrder', + 'stackingRules' => 'setStackingRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redeemables' => 'getRedeemables', + 'trackingId' => 'getTrackingId', + 'order' => 'getOrder', + 'stackingRules' => 'getStackingRules' + ]; + + /** + * 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('redeemables', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('stackingRules', $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 redeemables + * + * @return \OpenAPI\Client\Model\QualificationsRedeemables|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\QualificationsRedeemables|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + throw new \InvalidArgumentException('non-nullable redeemables cannot be null'); + } + $this->container['redeemables'] = $redeemables; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets stackingRules + * + * @return \OpenAPI\Client\Model\StackingRules|null + */ + public function getStackingRules() + { + return $this->container['stackingRules']; + } + + /** + * Sets stackingRules + * + * @param \OpenAPI\Client\Model\StackingRules|null $stackingRules stackingRules + * + * @return self + */ + public function setStackingRules($stackingRules) + { + if (is_null($stackingRules)) { + throw new \InvalidArgumentException('non-nullable stackingRules cannot be null'); + } + $this->container['stackingRules'] = $stackingRules; + + 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/QualificationsFieldConditions.php b/src/Model/QualificationsFieldConditions.php new file mode 100644 index 0000000..8b44dc1 --- /dev/null +++ b/src/Model/QualificationsFieldConditions.php @@ -0,0 +1,410 @@ + + */ +class QualificationsFieldConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsFieldConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\QualificationsFiltersCondition' + ]; + + /** + * 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\QualificationsFiltersCondition|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\QualificationsFiltersCondition|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/QualificationsFiltersCondition.php b/src/Model/QualificationsFiltersCondition.php new file mode 100644 index 0000000..96fd58c --- /dev/null +++ b/src/Model/QualificationsFiltersCondition.php @@ -0,0 +1,622 @@ + + */ +class QualificationsFiltersCondition implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsFiltersCondition'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is' => 'string[]', + 'isNot' => 'string[]', + 'hasValue' => 'mixed', + 'isUnknown' => 'mixed', + 'in' => 'string[]', + 'notIn' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is' => null, + 'isNot' => null, + 'hasValue' => null, + 'isUnknown' => null, + 'in' => null, + 'notIn' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is' => true, + 'isNot' => true, + 'hasValue' => true, + 'isUnknown' => true, + 'in' => true, + 'notIn' => true + ]; + + /** + * 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', + 'isNot' => '$is_not', + 'hasValue' => '$has_value', + 'isUnknown' => '$is_unknown', + 'in' => '$in', + 'notIn' => '$not_in' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'hasValue' => 'setHasValue', + 'isUnknown' => 'setIsUnknown', + 'in' => 'setIn', + 'notIn' => 'setNotIn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'hasValue' => 'getHasValue', + 'isUnknown' => 'getIsUnknown', + 'in' => 'getIn', + 'notIn' => '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; + } + + + /** + * 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('isNot', $data ?? [], null); + $this->setIfExists('hasValue', $data ?? [], null); + $this->setIfExists('isUnknown', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('notIn', $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 is + * + * @return string[]|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string[]|null $is is + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string[]|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string[]|null $isNot isNot + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets hasValue + * + * @return mixed|null + */ + public function getHasValue() + { + return $this->container['hasValue']; + } + + /** + * Sets hasValue + * + * @param mixed|null $hasValue hasValue + * + * @return self + */ + public function setHasValue($hasValue) + { + if (is_null($hasValue)) { + array_push($this->openAPINullablesSetToNull, 'hasValue'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasValue', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasValue'] = $hasValue; + + return $this; + } + + /** + * Gets isUnknown + * + * @return mixed|null + */ + public function getIsUnknown() + { + return $this->container['isUnknown']; + } + + /** + * Sets isUnknown + * + * @param mixed|null $isUnknown isUnknown + * + * @return self + */ + public function setIsUnknown($isUnknown) + { + if (is_null($isUnknown)) { + array_push($this->openAPINullablesSetToNull, 'isUnknown'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isUnknown', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isUnknown'] = $isUnknown; + + return $this; + } + + /** + * Gets in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in in + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn notIn + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['notIn'] = $notIn; + + 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/QualificationsOption.php b/src/Model/QualificationsOption.php new file mode 100644 index 0000000..daae871 --- /dev/null +++ b/src/Model/QualificationsOption.php @@ -0,0 +1,653 @@ + + */ +class QualificationsOption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'limit' => 'int', + 'startingAfter' => '\DateTime', + 'filters' => '\OpenAPI\Client\Model\QualificationsOptionFilters', + 'expand' => 'string[]', + 'sortingRule' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'limit' => null, + 'startingAfter' => 'date-time', + 'filters' => null, + 'expand' => null, + 'sortingRule' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'limit' => true, + 'startingAfter' => true, + 'filters' => true, + 'expand' => true, + 'sortingRule' => true + ]; + + /** + * 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 = [ + 'limit' => 'limit', + 'startingAfter' => 'starting_after', + 'filters' => 'filters', + 'expand' => 'expand', + 'sortingRule' => 'sorting_rule' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'limit' => 'setLimit', + 'startingAfter' => 'setStartingAfter', + 'filters' => 'setFilters', + 'expand' => 'setExpand', + 'sortingRule' => 'setSortingRule' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'limit' => 'getLimit', + 'startingAfter' => 'getStartingAfter', + 'filters' => 'getFilters', + 'expand' => 'getExpand', + 'sortingRule' => 'getSortingRule' + ]; + + /** + * 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 EXPAND_REDEEMABLE = 'redeemable'; + public const EXPAND_CATEGORY = 'category'; + public const EXPAND_VALIDATION_RULES = 'validation_rules'; + public const SORTING_RULE_BEST_DEAL = 'BEST_DEAL'; + public const SORTING_RULE_LEAST_DEAL = 'LEAST_DEAL'; + public const SORTING_RULE__DEFAULT = 'DEFAULT'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExpandAllowableValues() + { + return [ + self::EXPAND_REDEEMABLE, + self::EXPAND_CATEGORY, + self::EXPAND_VALIDATION_RULES, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSortingRuleAllowableValues() + { + return [ + self::SORTING_RULE_BEST_DEAL, + self::SORTING_RULE_LEAST_DEAL, + self::SORTING_RULE__DEFAULT, + ]; + } + + /** + * 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('limit', $data ?? [], null); + $this->setIfExists('startingAfter', $data ?? [], null); + $this->setIfExists('filters', $data ?? [], null); + $this->setIfExists('expand', $data ?? [], null); + $this->setIfExists('sortingRule', $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 = []; + + if (!is_null($this->container['limit']) && ($this->container['limit'] > 100)) { + $invalidProperties[] = "invalid value for 'limit', must be smaller than or equal to 100."; + } + + $allowedValues = $this->getSortingRuleAllowableValues(); + if (!is_null($this->container['sortingRule']) && !in_array($this->container['sortingRule'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'sortingRule', must be one of '%s'", + $this->container['sortingRule'], + 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 limit + * + * @return int|null + */ + public function getLimit() + { + return $this->container['limit']; + } + + /** + * Sets limit + * + * @param int|null $limit The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5 + * + * @return self + */ + public function setLimit($limit) + { + if (is_null($limit)) { + array_push($this->openAPINullablesSetToNull, 'limit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('limit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($limit) && ($limit > 100)) { + throw new \InvalidArgumentException('invalid value for $limit when calling QualificationsOption., must be smaller than or equal to 100.'); + } + + $this->container['limit'] = $limit; + + return $this; + } + + /** + * Gets startingAfter + * + * @return \DateTime|null + */ + public function getStartingAfter() + { + return $this->container['startingAfter']; + } + + /** + * Sets startingAfter + * + * @param \DateTime|null $startingAfter Cursor used for paging. + * + * @return self + */ + public function setStartingAfter($startingAfter) + { + if (is_null($startingAfter)) { + array_push($this->openAPINullablesSetToNull, 'startingAfter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startingAfter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startingAfter'] = $startingAfter; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\QualificationsOptionFilters|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\QualificationsOptionFilters|null $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + array_push($this->openAPINullablesSetToNull, 'filters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets expand + * + * @return string[]|null + */ + public function getExpand() + { + return $this->container['expand']; + } + + /** + * Sets expand + * + * @param string[]|null $expand The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"redeemable\"] | - Returns the redeemables' metadata. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [\"validation_rules\"] | - Returns an expanded `validation_rules` object, showing details about the validation rules. | + * + * @return self + */ + public function setExpand($expand) + { + if (is_null($expand)) { + array_push($this->openAPINullablesSetToNull, 'expand'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expand', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExpandAllowableValues(); + if (!is_null($expand) && array_diff($expand, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'expand', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['expand'] = $expand; + + return $this; + } + + /** + * Gets sortingRule + * + * @return string|null + */ + public function getSortingRule() + { + return $this->container['sortingRule']; + } + + /** + * Sets sortingRule + * + * @param string|null $sortingRule Is used to determine the order in which data is displayed in the result array. - `DEFAULT` - Sorting descending by `created_at` - `BEST_DEAL` - Sorting descending by `total_applied_discount_amount` - `LEAST_DEAL` - Sorting ascending by `total_applied_discount_amount` + * + * @return self + */ + public function setSortingRule($sortingRule) + { + if (is_null($sortingRule)) { + array_push($this->openAPINullablesSetToNull, 'sortingRule'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sortingRule', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getSortingRuleAllowableValues(); + if (!is_null($sortingRule) && !in_array($sortingRule, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'sortingRule', must be one of '%s'", + $sortingRule, + implode("', '", $allowedValues) + ) + ); + } + $this->container['sortingRule'] = $sortingRule; + + 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/QualificationsOptionFilters.php b/src/Model/QualificationsOptionFilters.php new file mode 100644 index 0000000..57ce91b --- /dev/null +++ b/src/Model/QualificationsOptionFilters.php @@ -0,0 +1,745 @@ + + */ +class QualificationsOptionFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOptionFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'junction' => 'string', + 'categoryId' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'campaignId' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'campaignType' => '\OpenAPI\Client\Model\QualificationsOptionFiltersCampaignType', + 'resourceId' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'resourceType' => '\OpenAPI\Client\Model\QualificationsOptionFiltersResourceType', + 'voucherType' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'code' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'holderRole' => '\OpenAPI\Client\Model\QualificationsOptionFiltersHolderRole' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'junction' => null, + 'categoryId' => null, + 'campaignId' => null, + 'campaignType' => null, + 'resourceId' => null, + 'resourceType' => null, + 'voucherType' => null, + 'code' => null, + 'holderRole' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'junction' => true, + 'categoryId' => false, + 'campaignId' => false, + 'campaignType' => true, + 'resourceId' => false, + 'resourceType' => true, + 'voucherType' => false, + 'code' => false, + 'holderRole' => true + ]; + + /** + * 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 = [ + 'junction' => 'junction', + 'categoryId' => 'category_id', + 'campaignId' => 'campaign_id', + 'campaignType' => 'campaign_type', + 'resourceId' => 'resource_id', + 'resourceType' => 'resource_type', + 'voucherType' => 'voucher_type', + 'code' => 'code', + 'holderRole' => 'holder_role' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'junction' => 'setJunction', + 'categoryId' => 'setCategoryId', + 'campaignId' => 'setCampaignId', + 'campaignType' => 'setCampaignType', + 'resourceId' => 'setResourceId', + 'resourceType' => 'setResourceType', + 'voucherType' => 'setVoucherType', + 'code' => 'setCode', + 'holderRole' => 'setHolderRole' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'junction' => 'getJunction', + 'categoryId' => 'getCategoryId', + 'campaignId' => 'getCampaignId', + 'campaignType' => 'getCampaignType', + 'resourceId' => 'getResourceId', + 'resourceType' => 'getResourceType', + 'voucherType' => 'getVoucherType', + 'code' => 'getCode', + 'holderRole' => 'getHolderRole' + ]; + + /** + * 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 JUNCTION__AND = 'and'; + public const JUNCTION__OR = 'or'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getJunctionAllowableValues() + { + return [ + self::JUNCTION__AND, + self::JUNCTION__OR, + ]; + } + + /** + * 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('junction', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('campaignType', $data ?? [], null); + $this->setIfExists('resourceId', $data ?? [], null); + $this->setIfExists('resourceType', $data ?? [], null); + $this->setIfExists('voucherType', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('holderRole', $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->getJunctionAllowableValues(); + if (!is_null($this->container['junction']) && !in_array($this->container['junction'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'junction', must be one of '%s'", + $this->container['junction'], + 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 junction + * + * @return string|null + */ + public function getJunction() + { + return $this->container['junction']; + } + + /** + * Sets junction + * + * @param string|null $junction Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + * + * @return self + */ + public function setJunction($junction) + { + if (is_null($junction)) { + array_push($this->openAPINullablesSetToNull, 'junction'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('junction', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getJunctionAllowableValues(); + if (!is_null($junction) && !in_array($junction, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'junction', must be one of '%s'", + $junction, + implode("', '", $allowedValues) + ) + ); + } + $this->container['junction'] = $junction; + + return $this; + } + + /** + * Gets categoryId + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $categoryId categoryId + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + throw new \InvalidArgumentException('non-nullable categoryId cannot be null'); + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets campaignId + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $campaignId campaignId + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + throw new \InvalidArgumentException('non-nullable campaignId cannot be null'); + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets campaignType + * + * @return \OpenAPI\Client\Model\QualificationsOptionFiltersCampaignType|null + */ + public function getCampaignType() + { + return $this->container['campaignType']; + } + + /** + * Sets campaignType + * + * @param \OpenAPI\Client\Model\QualificationsOptionFiltersCampaignType|null $campaignType campaignType + * + * @return self + */ + public function setCampaignType($campaignType) + { + if (is_null($campaignType)) { + array_push($this->openAPINullablesSetToNull, 'campaignType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignType'] = $campaignType; + + return $this; + } + + /** + * Gets resourceId + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getResourceId() + { + return $this->container['resourceId']; + } + + /** + * Sets resourceId + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $resourceId resourceId + * + * @return self + */ + public function setResourceId($resourceId) + { + if (is_null($resourceId)) { + throw new \InvalidArgumentException('non-nullable resourceId cannot be null'); + } + $this->container['resourceId'] = $resourceId; + + return $this; + } + + /** + * Gets resourceType + * + * @return \OpenAPI\Client\Model\QualificationsOptionFiltersResourceType|null + */ + public function getResourceType() + { + return $this->container['resourceType']; + } + + /** + * Sets resourceType + * + * @param \OpenAPI\Client\Model\QualificationsOptionFiltersResourceType|null $resourceType resourceType + * + * @return self + */ + public function setResourceType($resourceType) + { + if (is_null($resourceType)) { + array_push($this->openAPINullablesSetToNull, 'resourceType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('resourceType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['resourceType'] = $resourceType; + + return $this; + } + + /** + * Gets voucherType + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getVoucherType() + { + return $this->container['voucherType']; + } + + /** + * Sets voucherType + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $voucherType voucherType + * + * @return self + */ + public function setVoucherType($voucherType) + { + if (is_null($voucherType)) { + throw new \InvalidArgumentException('non-nullable voucherType cannot be null'); + } + $this->container['voucherType'] = $voucherType; + + return $this; + } + + /** + * Gets code + * + * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets holderRole + * + * @return \OpenAPI\Client\Model\QualificationsOptionFiltersHolderRole|null + */ + public function getHolderRole() + { + return $this->container['holderRole']; + } + + /** + * Sets holderRole + * + * @param \OpenAPI\Client\Model\QualificationsOptionFiltersHolderRole|null $holderRole holderRole + * + * @return self + */ + public function setHolderRole($holderRole) + { + if (is_null($holderRole)) { + array_push($this->openAPINullablesSetToNull, 'holderRole'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderRole', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderRole'] = $holderRole; + + 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/QualificationsOptionFiltersCampaignType.php b/src/Model/QualificationsOptionFiltersCampaignType.php new file mode 100644 index 0000000..5581cbb --- /dev/null +++ b/src/Model/QualificationsOptionFiltersCampaignType.php @@ -0,0 +1,418 @@ + + */ +class QualificationsOptionFiltersCampaignType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOptionFiltersCampaignType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\QualificationsOptionFiltersCampaignTypeConditions' + ]; + + /** + * 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' => true + ]; + + /** + * 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\QualificationsOptionFiltersCampaignTypeConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\QualificationsOptionFiltersCampaignTypeConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $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/QualificationsOptionFiltersCampaignTypeConditions.php b/src/Model/QualificationsOptionFiltersCampaignTypeConditions.php new file mode 100644 index 0000000..e9cb17e --- /dev/null +++ b/src/Model/QualificationsOptionFiltersCampaignTypeConditions.php @@ -0,0 +1,669 @@ + + */ +class QualificationsOptionFiltersCampaignTypeConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOptionFiltersCampaignTypeConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is' => 'string[]', + 'isNot' => 'string[]', + 'in' => 'string[]', + 'notIn' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is' => null, + 'isNot' => null, + 'in' => null, + 'notIn' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is' => true, + 'isNot' => true, + 'in' => true, + 'notIn' => true + ]; + + /** + * 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', + 'isNot' => '$is_not', + 'in' => '$in', + 'notIn' => '$not_in' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'in' => 'setIn', + 'notIn' => 'setNotIn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'in' => 'getIn', + 'notIn' => '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_PROMOTION = 'PROMOTION'; + public const IS_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const IS_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const IS_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const IS_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const IS_LUCKY_DRAW = 'LUCKY_DRAW'; + public const IS_NOT_PROMOTION = 'PROMOTION'; + public const IS_NOT_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const IS_NOT_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const IS_NOT_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const IS_NOT_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const IS_NOT_LUCKY_DRAW = 'LUCKY_DRAW'; + public const IN_PROMOTION = 'PROMOTION'; + public const IN_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const IN_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const IN_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const IN_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const IN_LUCKY_DRAW = 'LUCKY_DRAW'; + public const NOT_IN_PROMOTION = 'PROMOTION'; + public const NOT_IN_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const NOT_IN_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; + public const NOT_IN_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const NOT_IN_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + public const NOT_IN_LUCKY_DRAW = 'LUCKY_DRAW'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsAllowableValues() + { + return [ + self::IS_PROMOTION, + self::IS_GIFT_VOUCHERS, + self::IS_REFERRAL_PROGRAM, + self::IS_DISCOUNT_COUPONS, + self::IS_LOYALTY_PROGRAM, + self::IS_LUCKY_DRAW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsNotAllowableValues() + { + return [ + self::IS_NOT_PROMOTION, + self::IS_NOT_GIFT_VOUCHERS, + self::IS_NOT_REFERRAL_PROGRAM, + self::IS_NOT_DISCOUNT_COUPONS, + self::IS_NOT_LOYALTY_PROGRAM, + self::IS_NOT_LUCKY_DRAW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInAllowableValues() + { + return [ + self::IN_PROMOTION, + self::IN_GIFT_VOUCHERS, + self::IN_REFERRAL_PROGRAM, + self::IN_DISCOUNT_COUPONS, + self::IN_LOYALTY_PROGRAM, + self::IN_LUCKY_DRAW, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNotInAllowableValues() + { + return [ + self::NOT_IN_PROMOTION, + self::NOT_IN_GIFT_VOUCHERS, + self::NOT_IN_REFERRAL_PROGRAM, + self::NOT_IN_DISCOUNT_COUPONS, + self::NOT_IN_LOYALTY_PROGRAM, + self::NOT_IN_LUCKY_DRAW, + ]; + } + + /** + * 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('isNot', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('notIn', $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 is + * + * @return string[]|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string[]|null $is is + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsAllowableValues(); + if (!is_null($is) && array_diff($is, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'is', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string[]|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string[]|null $isNot isNot + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsNotAllowableValues(); + if (!is_null($isNot) && array_diff($isNot, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'isNot', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in in + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInAllowableValues(); + if (!is_null($in) && 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 notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn notIn + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getNotInAllowableValues(); + if (!is_null($notIn) && array_diff($notIn, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'notIn', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['notIn'] = $notIn; + + 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/QualificationsOptionFiltersHolderRole.php b/src/Model/QualificationsOptionFiltersHolderRole.php new file mode 100644 index 0000000..e68ea54 --- /dev/null +++ b/src/Model/QualificationsOptionFiltersHolderRole.php @@ -0,0 +1,417 @@ + + */ +class QualificationsOptionFiltersHolderRole implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOptionFiltersHolderRole'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\QualificationsOptionFiltersHolderRoleConditions' + ]; + + /** + * 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' => true + ]; + + /** + * 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\QualificationsOptionFiltersHolderRoleConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\QualificationsOptionFiltersHolderRoleConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $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/QualificationsOptionFiltersHolderRoleConditions.php b/src/Model/QualificationsOptionFiltersHolderRoleConditions.php new file mode 100644 index 0000000..db54f94 --- /dev/null +++ b/src/Model/QualificationsOptionFiltersHolderRoleConditions.php @@ -0,0 +1,645 @@ + + */ +class QualificationsOptionFiltersHolderRoleConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOptionFiltersHolderRoleConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is' => 'string[]', + 'isNot' => 'string[]', + 'in' => 'string[]', + 'notIn' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is' => null, + 'isNot' => null, + 'in' => null, + 'notIn' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is' => true, + 'isNot' => true, + 'in' => true, + 'notIn' => true + ]; + + /** + * 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', + 'isNot' => '$is_not', + 'in' => '$in', + 'notIn' => '$not_in' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'in' => 'setIn', + 'notIn' => 'setNotIn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'in' => 'getIn', + 'notIn' => '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_OWNER = 'OWNER'; + public const IS_REFERRER = 'REFERRER'; + public const IS_REFEREE = 'REFEREE'; + public const IS_NOT_OWNER = 'OWNER'; + public const IS_NOT_REFERRER = 'REFERRER'; + public const IS_NOT_REFEREE = 'REFEREE'; + public const IN_OWNER = 'OWNER'; + public const IN_REFERRER = 'REFERRER'; + public const IN_REFEREE = 'REFEREE'; + public const NOT_IN_OWNER = 'OWNER'; + public const NOT_IN_REFERRER = 'REFERRER'; + public const NOT_IN_REFEREE = 'REFEREE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsAllowableValues() + { + return [ + self::IS_OWNER, + self::IS_REFERRER, + self::IS_REFEREE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsNotAllowableValues() + { + return [ + self::IS_NOT_OWNER, + self::IS_NOT_REFERRER, + self::IS_NOT_REFEREE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInAllowableValues() + { + return [ + self::IN_OWNER, + self::IN_REFERRER, + self::IN_REFEREE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNotInAllowableValues() + { + return [ + self::NOT_IN_OWNER, + self::NOT_IN_REFERRER, + self::NOT_IN_REFEREE, + ]; + } + + /** + * 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('isNot', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('notIn', $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 is + * + * @return string[]|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string[]|null $is Will return records only for the first value in the array. + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsAllowableValues(); + if (!is_null($is) && array_diff($is, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'is', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string[]|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string[]|null $isNot Will return records only for the first value in the array. + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsNotAllowableValues(); + if (!is_null($isNot) && array_diff($isNot, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'isNot', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Will return records for the values in the array. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInAllowableValues(); + if (!is_null($in) && 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 notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn Will return records for the values in the array. + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getNotInAllowableValues(); + if (!is_null($notIn) && array_diff($notIn, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'notIn', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['notIn'] = $notIn; + + 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/QualificationsOptionFiltersResourceType.php b/src/Model/QualificationsOptionFiltersResourceType.php new file mode 100644 index 0000000..7e8a026 --- /dev/null +++ b/src/Model/QualificationsOptionFiltersResourceType.php @@ -0,0 +1,417 @@ + + */ +class QualificationsOptionFiltersResourceType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOptionFiltersResourceType'; + + /** + * 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' => true + ]; + + /** + * 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)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $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..5007453 --- /dev/null +++ b/src/Model/QualificationsOptionFiltersResourceTypeConditions.php @@ -0,0 +1,645 @@ + + */ +class QualificationsOptionFiltersResourceTypeConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOptionFiltersResourceTypeConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is' => 'string[]', + 'isNot' => 'string[]', + 'in' => 'string[]', + 'notIn' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is' => null, + 'isNot' => null, + 'in' => null, + 'notIn' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is' => true, + 'isNot' => true, + 'in' => true, + 'notIn' => true + ]; + + /** + * 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', + 'isNot' => '$is_not', + 'in' => '$in', + 'notIn' => '$not_in' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is' => 'setIs', + 'isNot' => 'setIsNot', + 'in' => 'setIn', + 'notIn' => 'setNotIn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is' => 'getIs', + 'isNot' => 'getIsNot', + 'in' => 'getIn', + 'notIn' => '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('isNot', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('notIn', $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 is + * + * @return string[]|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string[]|null $is is + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + array_push($this->openAPINullablesSetToNull, 'is'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsAllowableValues(); + if (!is_null($is) && array_diff($is, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'is', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets isNot + * + * @return string[]|null + */ + public function getIsNot() + { + return $this->container['isNot']; + } + + /** + * Sets isNot + * + * @param string[]|null $isNot isNot + * + * @return self + */ + public function setIsNot($isNot) + { + if (is_null($isNot)) { + array_push($this->openAPINullablesSetToNull, 'isNot'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isNot', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getIsNotAllowableValues(); + if (!is_null($isNot) && array_diff($isNot, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'isNot', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['isNot'] = $isNot; + + return $this; + } + + /** + * Gets in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in in + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInAllowableValues(); + if (!is_null($in) && 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 notIn + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['notIn']; + } + + /** + * Sets notIn + * + * @param string[]|null $notIn notIn + * + * @return self + */ + public function setNotIn($notIn) + { + if (is_null($notIn)) { + array_push($this->openAPINullablesSetToNull, 'notIn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('notIn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getNotInAllowableValues(); + if (!is_null($notIn) && array_diff($notIn, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'notIn', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['notIn'] = $notIn; + + 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/QualificationsRedeemable.php b/src/Model/QualificationsRedeemable.php new file mode 100644 index 0000000..56909f8 --- /dev/null +++ b/src/Model/QualificationsRedeemable.php @@ -0,0 +1,1035 @@ + + */ +class QualificationsRedeemable implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsRedeemable'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'result' => '\OpenAPI\Client\Model\RedeemableResult', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'validationRuleId' => 'string', + 'applicableTo' => '\OpenAPI\Client\Model\ApplicableToResultList', + 'inapplicableTo' => '\OpenAPI\Client\Model\InapplicableToResultList', + 'metadata' => 'object', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'banner' => 'string', + 'name' => 'string', + 'campaignName' => 'string', + 'campaignId' => 'string', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'redeemables' => '\OpenAPI\Client\Model\QualificationsRedeemableBase[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'result' => null, + 'order' => null, + 'validationRuleId' => null, + 'applicableTo' => null, + 'inapplicableTo' => null, + 'metadata' => null, + 'categories' => null, + 'banner' => null, + 'name' => null, + 'campaignName' => null, + 'campaignId' => null, + 'validationRulesAssignments' => null, + 'redeemables' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'result' => false, + 'order' => false, + 'validationRuleId' => true, + 'applicableTo' => false, + 'inapplicableTo' => false, + 'metadata' => true, + 'categories' => true, + 'banner' => true, + 'name' => true, + 'campaignName' => true, + 'campaignId' => true, + 'validationRulesAssignments' => false, + 'redeemables' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'result' => 'result', + 'order' => 'order', + 'validationRuleId' => 'validation_rule_id', + 'applicableTo' => 'applicable_to', + 'inapplicableTo' => 'inapplicable_to', + 'metadata' => 'metadata', + 'categories' => 'categories', + 'banner' => 'banner', + 'name' => 'name', + 'campaignName' => 'campaign_name', + 'campaignId' => 'campaign_id', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'redeemables' => 'redeemables' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'result' => 'setResult', + 'order' => 'setOrder', + 'validationRuleId' => 'setValidationRuleId', + 'applicableTo' => 'setApplicableTo', + 'inapplicableTo' => 'setInapplicableTo', + 'metadata' => 'setMetadata', + 'categories' => 'setCategories', + 'banner' => 'setBanner', + 'name' => 'setName', + 'campaignName' => 'setCampaignName', + 'campaignId' => 'setCampaignId', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'redeemables' => 'setRedeemables' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'result' => 'getResult', + 'order' => 'getOrder', + 'validationRuleId' => 'getValidationRuleId', + 'applicableTo' => 'getApplicableTo', + 'inapplicableTo' => 'getInapplicableTo', + 'metadata' => 'getMetadata', + 'categories' => 'getCategories', + 'banner' => 'getBanner', + 'name' => 'getName', + 'campaignName' => 'getCampaignName', + 'campaignId' => 'getCampaignId', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'redeemables' => 'getRedeemables' + ]; + + /** + * 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 OBJECT_CAMPAIGN = 'campaign'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + public const OBJECT_PROMOTION_STACK = 'promotion_stack'; + public const OBJECT_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CAMPAIGN, + self::OBJECT_PROMOTION_TIER, + self::OBJECT_PROMOTION_STACK, + self::OBJECT_VOUCHER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('validationRuleId', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('inapplicableTo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('campaignName', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('redeemables', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Id of the redeemable. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Object type of the redeemable. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\RedeemableResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\RedeemableResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets validationRuleId + * + * @return string|null + */ + public function getValidationRuleId() + { + return $this->container['validationRuleId']; + } + + /** + * Sets validationRuleId + * + * @param string|null $validationRuleId A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + * + * @return self + */ + public function setValidationRuleId($validationRuleId) + { + if (is_null($validationRuleId)) { + array_push($this->openAPINullablesSetToNull, 'validationRuleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRuleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRuleId'] = $validationRuleId; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ApplicableToResultList|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ApplicableToResultList|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + throw new \InvalidArgumentException('non-nullable applicableTo cannot be null'); + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets inapplicableTo + * + * @return \OpenAPI\Client\Model\InapplicableToResultList|null + */ + public function getInapplicableTo() + { + return $this->container['inapplicableTo']; + } + + /** + * Sets inapplicableTo + * + * @param \OpenAPI\Client\Model\InapplicableToResultList|null $inapplicableTo inapplicableTo + * + * @return self + */ + public function setInapplicableTo($inapplicableTo) + { + if (is_null($inapplicableTo)) { + throw new \InvalidArgumentException('non-nullable inapplicableTo cannot be null'); + } + $this->container['inapplicableTo'] = $inapplicableTo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories List of category information. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the redeemable. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets campaignName + * + * @return string|null + */ + public function getCampaignName() + { + return $this->container['campaignName']; + } + + /** + * Sets campaignName + * + * @param string|null $campaignName Name of the campaign associated to the redeemable. This field is available only if object is not `campaign` + * + * @return self + */ + public function setCampaignName($campaignName) + { + if (is_null($campaignName)) { + array_push($this->openAPINullablesSetToNull, 'campaignName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignName'] = $campaignName; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Id of the campaign associated to the redeemable. This field is available only if object is not `campaign` + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets redeemables + * + * @return \OpenAPI\Client\Model\QualificationsRedeemableBase[]|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\QualificationsRedeemableBase[]|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + array_push($this->openAPINullablesSetToNull, 'redeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemables'] = $redeemables; + + 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/QualificationsRedeemableBase.php b/src/Model/QualificationsRedeemableBase.php new file mode 100644 index 0000000..6383b1c --- /dev/null +++ b/src/Model/QualificationsRedeemableBase.php @@ -0,0 +1,995 @@ + + */ +class QualificationsRedeemableBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsRedeemableBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'result' => '\OpenAPI\Client\Model\RedeemableResult', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'validationRuleId' => 'string', + 'applicableTo' => '\OpenAPI\Client\Model\ApplicableToResultList', + 'inapplicableTo' => '\OpenAPI\Client\Model\InapplicableToResultList', + 'metadata' => 'object', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'banner' => 'string', + 'name' => 'string', + 'campaignName' => 'string', + 'campaignId' => 'string', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'result' => null, + 'order' => null, + 'validationRuleId' => null, + 'applicableTo' => null, + 'inapplicableTo' => null, + 'metadata' => null, + 'categories' => null, + 'banner' => null, + 'name' => null, + 'campaignName' => null, + 'campaignId' => null, + 'validationRulesAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'result' => false, + 'order' => false, + 'validationRuleId' => true, + 'applicableTo' => false, + 'inapplicableTo' => false, + 'metadata' => true, + 'categories' => true, + 'banner' => true, + 'name' => true, + 'campaignName' => true, + 'campaignId' => true, + 'validationRulesAssignments' => 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'result' => 'result', + 'order' => 'order', + 'validationRuleId' => 'validation_rule_id', + 'applicableTo' => 'applicable_to', + 'inapplicableTo' => 'inapplicable_to', + 'metadata' => 'metadata', + 'categories' => 'categories', + 'banner' => 'banner', + 'name' => 'name', + 'campaignName' => 'campaign_name', + 'campaignId' => 'campaign_id', + 'validationRulesAssignments' => 'validation_rules_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'result' => 'setResult', + 'order' => 'setOrder', + 'validationRuleId' => 'setValidationRuleId', + 'applicableTo' => 'setApplicableTo', + 'inapplicableTo' => 'setInapplicableTo', + 'metadata' => 'setMetadata', + 'categories' => 'setCategories', + 'banner' => 'setBanner', + 'name' => 'setName', + 'campaignName' => 'setCampaignName', + 'campaignId' => 'setCampaignId', + 'validationRulesAssignments' => 'setValidationRulesAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'result' => 'getResult', + 'order' => 'getOrder', + 'validationRuleId' => 'getValidationRuleId', + 'applicableTo' => 'getApplicableTo', + 'inapplicableTo' => 'getInapplicableTo', + 'metadata' => 'getMetadata', + 'categories' => 'getCategories', + 'banner' => 'getBanner', + 'name' => 'getName', + 'campaignName' => 'getCampaignName', + 'campaignId' => 'getCampaignId', + 'validationRulesAssignments' => 'getValidationRulesAssignments' + ]; + + /** + * 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 OBJECT_CAMPAIGN = 'campaign'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + public const OBJECT_PROMOTION_STACK = 'promotion_stack'; + public const OBJECT_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CAMPAIGN, + self::OBJECT_PROMOTION_TIER, + self::OBJECT_PROMOTION_STACK, + self::OBJECT_VOUCHER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('validationRuleId', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('inapplicableTo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('campaignName', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Id of the redeemable. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Object type of the redeemable. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\RedeemableResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\RedeemableResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets validationRuleId + * + * @return string|null + */ + public function getValidationRuleId() + { + return $this->container['validationRuleId']; + } + + /** + * Sets validationRuleId + * + * @param string|null $validationRuleId A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. + * + * @return self + */ + public function setValidationRuleId($validationRuleId) + { + if (is_null($validationRuleId)) { + array_push($this->openAPINullablesSetToNull, 'validationRuleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRuleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRuleId'] = $validationRuleId; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ApplicableToResultList|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ApplicableToResultList|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + throw new \InvalidArgumentException('non-nullable applicableTo cannot be null'); + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets inapplicableTo + * + * @return \OpenAPI\Client\Model\InapplicableToResultList|null + */ + public function getInapplicableTo() + { + return $this->container['inapplicableTo']; + } + + /** + * Sets inapplicableTo + * + * @param \OpenAPI\Client\Model\InapplicableToResultList|null $inapplicableTo inapplicableTo + * + * @return self + */ + public function setInapplicableTo($inapplicableTo) + { + if (is_null($inapplicableTo)) { + throw new \InvalidArgumentException('non-nullable inapplicableTo cannot be null'); + } + $this->container['inapplicableTo'] = $inapplicableTo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories List of category information. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the redeemable. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets campaignName + * + * @return string|null + */ + public function getCampaignName() + { + return $this->container['campaignName']; + } + + /** + * Sets campaignName + * + * @param string|null $campaignName Name of the campaign associated to the redeemable. This field is available only if object is not `campaign` + * + * @return self + */ + public function setCampaignName($campaignName) + { + if (is_null($campaignName)) { + array_push($this->openAPINullablesSetToNull, 'campaignName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignName'] = $campaignName; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Id of the campaign associated to the redeemable. This field is available only if object is not `campaign` + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + 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/QualificationsRedeemables.php b/src/Model/QualificationsRedeemables.php new file mode 100644 index 0000000..9a04dcb --- /dev/null +++ b/src/Model/QualificationsRedeemables.php @@ -0,0 +1,687 @@ + + */ +class QualificationsRedeemables implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsRedeemables'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\QualificationsRedeemable[]', + 'total' => 'int', + 'hasMore' => 'bool', + 'moreStartingAfter' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null, + 'hasMore' => null, + 'moreStartingAfter' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true, + 'hasMore' => true, + 'moreStartingAfter' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total', + 'hasMore' => 'has_more', + 'moreStartingAfter' => 'more_starting_after' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal', + 'hasMore' => 'setHasMore', + 'moreStartingAfter' => 'setMoreStartingAfter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal', + 'hasMore' => 'getHasMore', + 'moreStartingAfter' => 'getMoreStartingAfter' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('hasMore', $data ?? [], null); + $this->setIfExists('moreStartingAfter', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `list`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of qualified redeemables. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\QualificationsRedeemable[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\QualificationsRedeemable[]|null $data Array of qualified redeemables. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total The number of redeemables returned in the API request. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As results are always limited, the `has_more` flag indicates if there are more records for given parameters. This lets you know if you can run another request (with different options) to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + return $this; + } + + /** + * Gets moreStartingAfter + * + * @return \DateTime|null + */ + public function getMoreStartingAfter() + { + return $this->container['moreStartingAfter']; + } + + /** + * Sets moreStartingAfter + * + * @param \DateTime|null $moreStartingAfter Timestamp representing the date and time to use in `starting_after` cursor to get more redeemables. + * + * @return self + */ + public function setMoreStartingAfter($moreStartingAfter) + { + if (is_null($moreStartingAfter)) { + array_push($this->openAPINullablesSetToNull, 'moreStartingAfter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('moreStartingAfter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['moreStartingAfter'] = $moreStartingAfter; + + 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/RedeemableGift.php b/src/Model/RedeemableGift.php new file mode 100644 index 0000000..50ba29e --- /dev/null +++ b/src/Model/RedeemableGift.php @@ -0,0 +1,459 @@ + + */ +class RedeemableGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedeemableGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'balance' => 'float', + 'credits' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'balance' => null, + 'credits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'balance' => true, + 'credits' => true + ]; + + /** + * 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 = [ + 'balance' => 'balance', + 'credits' => 'credits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'balance' => 'setBalance', + 'credits' => 'setCredits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'balance' => 'getBalance', + 'credits' => 'getCredits' + ]; + + /** + * 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('balance', $data ?? [], null); + $this->setIfExists('credits', $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 balance + * + * @return float|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param float|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets credits + * + * @return float|null + */ + public function getCredits() + { + return $this->container['credits']; + } + + /** + * Sets credits + * + * @param float|null $credits The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setCredits($credits) + { + if (is_null($credits)) { + array_push($this->openAPINullablesSetToNull, 'credits'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('credits', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['credits'] = $credits; + + 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/RedeemableLoyaltyCard.php b/src/Model/RedeemableLoyaltyCard.php new file mode 100644 index 0000000..b5e06b1 --- /dev/null +++ b/src/Model/RedeemableLoyaltyCard.php @@ -0,0 +1,582 @@ + + */ +class RedeemableLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedeemableLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'exchangeRatio' => 'float', + 'pointsRatio' => 'int', + 'transfers' => '\OpenAPI\Client\Model\LoyaltiesTransferPoints[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'exchangeRatio' => null, + 'pointsRatio' => null, + 'transfers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'exchangeRatio' => true, + 'pointsRatio' => true, + 'transfers' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'exchangeRatio' => 'exchange_ratio', + 'pointsRatio' => 'points_ratio', + 'transfers' => 'transfers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'exchangeRatio' => 'setExchangeRatio', + 'pointsRatio' => 'setPointsRatio', + 'transfers' => 'setTransfers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'exchangeRatio' => 'getExchangeRatio', + 'pointsRatio' => 'getPointsRatio', + 'transfers' => 'getTransfers' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('exchangeRatio', $data ?? [], null); + $this->setIfExists('pointsRatio', $data ?? [], null); + $this->setIfExists('transfers', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets exchangeRatio + * + * @return float|null + */ + public function getExchangeRatio() + { + return $this->container['exchangeRatio']; + } + + /** + * Sets exchangeRatio + * + * @param float|null $exchangeRatio The cash equivalent of the points defined in the points_ratio property. + * + * @return self + */ + public function setExchangeRatio($exchangeRatio) + { + if (is_null($exchangeRatio)) { + array_push($this->openAPINullablesSetToNull, 'exchangeRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exchangeRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['exchangeRatio'] = $exchangeRatio; + + return $this; + } + + /** + * Gets pointsRatio + * + * @return int|null + */ + public function getPointsRatio() + { + return $this->container['pointsRatio']; + } + + /** + * Sets pointsRatio + * + * @param int|null $pointsRatio The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. + * + * @return self + */ + public function setPointsRatio($pointsRatio) + { + if (is_null($pointsRatio)) { + array_push($this->openAPINullablesSetToNull, 'pointsRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pointsRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pointsRatio'] = $pointsRatio; + + return $this; + } + + /** + * Gets transfers + * + * @return \OpenAPI\Client\Model\LoyaltiesTransferPoints[]|null + */ + public function getTransfers() + { + return $this->container['transfers']; + } + + /** + * Sets transfers + * + * @param \OpenAPI\Client\Model\LoyaltiesTransferPoints[]|null $transfers transfers + * + * @return self + */ + public function setTransfers($transfers) + { + if (is_null($transfers)) { + array_push($this->openAPINullablesSetToNull, 'transfers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('transfers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['transfers'] = $transfers; + + 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/RedeemableResult.php b/src/Model/RedeemableResult.php new file mode 100644 index 0000000..215f449 --- /dev/null +++ b/src/Model/RedeemableResult.php @@ -0,0 +1,513 @@ + + */ +class RedeemableResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedeemableResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\RedeemableGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedeemableLoyaltyCard', + 'error' => '\OpenAPI\Client\Model\Error' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => false, + 'gift' => false, + 'loyaltyCard' => false, + 'error' => 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 = [ + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'error' => 'getError' + ]; + + /** + * 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('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('error', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedeemableGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedeemableGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedeemableLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedeemableLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\Error|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\Error|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + 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/RedeemableVoucher.php b/src/Model/RedeemableVoucher.php new file mode 100644 index 0000000..90e1b0f --- /dev/null +++ b/src/Model/RedeemableVoucher.php @@ -0,0 +1,1567 @@ + + */ +class RedeemableVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedeemableVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'categories' => 'object[]', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\RedeemableVoucherGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedeemableVoucherLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'referrerId' => 'string', + 'holderId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\RedeemableVoucherPublish', + 'redemption' => '\OpenAPI\Client\Model\RedeemableVoucherRedemption' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'categories' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'referrerId' => null, + 'holderId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'categories' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'referrerId' => true, + 'holderId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'referrerId' => 'referrer_id', + 'holderId' => 'holder_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'referrerId' => 'setReferrerId', + 'holderId' => 'setHolderId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'referrerId' => 'getReferrerId', + 'holderId' => 'getHolderId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The value is null. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return object[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param object[]|null $categories Contains an empty array. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedeemableVoucherGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedeemableVoucherGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedeemableVoucherLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedeemableVoucherLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\RedeemableVoucherPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\RedeemableVoucherPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\RedeemableVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\RedeemableVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + 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/RedeemableVoucherGift.php b/src/Model/RedeemableVoucherGift.php new file mode 100644 index 0000000..aebfc8c --- /dev/null +++ b/src/Model/RedeemableVoucherGift.php @@ -0,0 +1,534 @@ + + */ +class RedeemableVoucherGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedeemableVoucherGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/RedeemableVoucherLoyaltyCard.php b/src/Model/RedeemableVoucherLoyaltyCard.php new file mode 100644 index 0000000..2b22f10 --- /dev/null +++ b/src/Model/RedeemableVoucherLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class RedeemableVoucherLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedeemableVoucherLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/RedeemableVoucherPublish.php b/src/Model/RedeemableVoucherPublish.php new file mode 100644 index 0000000..5974840 --- /dev/null +++ b/src/Model/RedeemableVoucherPublish.php @@ -0,0 +1,500 @@ + + */ +class RedeemableVoucherPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedeemableVoucherPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedeemableVoucherRedemption.php b/src/Model/RedeemableVoucherRedemption.php new file mode 100644 index 0000000..49057f5 --- /dev/null +++ b/src/Model/RedeemableVoucherRedemption.php @@ -0,0 +1,582 @@ + + */ +class RedeemableVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedeemableVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/Redemption.php b/src/Model/Redemption.php new file mode 100644 index 0000000..b1dd644 --- /dev/null +++ b/src/Model/Redemption.php @@ -0,0 +1,1430 @@ + + */ +class Redemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Redemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'date' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => 'object', + 'amount' => 'int', + 'redemption' => 'string', + 'result' => 'string', + 'status' => 'string', + 'relatedRedemptions' => '\OpenAPI\Client\Model\RedemptionRelatedRedemptions', + 'failureCode' => 'string', + 'failureMessage' => 'string', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'channel' => '\OpenAPI\Client\Model\RedemptionChannel', + 'customer' => '\OpenAPI\Client\Model\SimpleCustomer', + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string', + 'voucher' => '\OpenAPI\Client\Model\RedemptionVoucher', + 'promotionTier' => '\OpenAPI\Client\Model\PromotionTier', + 'reward' => '\OpenAPI\Client\Model\RedemptionRewardResult', + 'gift' => '\OpenAPI\Client\Model\RedemptionGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionLoyaltyCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'date' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'amount' => null, + 'redemption' => null, + 'result' => null, + 'status' => null, + 'relatedRedemptions' => null, + 'failureCode' => null, + 'failureMessage' => null, + 'order' => null, + 'channel' => null, + 'customer' => null, + 'relatedObjectType' => null, + 'relatedObjectId' => null, + 'voucher' => null, + 'promotionTier' => null, + 'reward' => null, + 'gift' => null, + 'loyaltyCard' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'date' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => true, + 'amount' => true, + 'redemption' => true, + 'result' => true, + 'status' => true, + 'relatedRedemptions' => true, + 'failureCode' => true, + 'failureMessage' => true, + 'order' => false, + 'channel' => true, + 'customer' => false, + 'relatedObjectType' => true, + 'relatedObjectId' => true, + 'voucher' => true, + 'promotionTier' => false, + 'reward' => false, + 'gift' => true, + 'loyaltyCard' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'date' => 'date', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'amount' => 'amount', + 'redemption' => 'redemption', + 'result' => 'result', + 'status' => 'status', + 'relatedRedemptions' => 'related_redemptions', + 'failureCode' => 'failure_code', + 'failureMessage' => 'failure_message', + 'order' => 'order', + 'channel' => 'channel', + 'customer' => 'customer', + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id', + 'voucher' => 'voucher', + 'promotionTier' => 'promotion_tier', + 'reward' => 'reward', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'date' => 'setDate', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'amount' => 'setAmount', + 'redemption' => 'setRedemption', + 'result' => 'setResult', + 'status' => 'setStatus', + 'relatedRedemptions' => 'setRelatedRedemptions', + 'failureCode' => 'setFailureCode', + 'failureMessage' => 'setFailureMessage', + 'order' => 'setOrder', + 'channel' => 'setChannel', + 'customer' => 'setCustomer', + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId', + 'voucher' => 'setVoucher', + 'promotionTier' => 'setPromotionTier', + 'reward' => 'setReward', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'date' => 'getDate', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'amount' => 'getAmount', + 'redemption' => 'getRedemption', + 'result' => 'getResult', + 'status' => 'getStatus', + 'relatedRedemptions' => 'getRelatedRedemptions', + 'failureCode' => 'getFailureCode', + 'failureMessage' => 'getFailureMessage', + 'order' => 'getOrder', + 'channel' => 'getChannel', + 'customer' => 'getCustomer', + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId', + 'voucher' => 'getVoucher', + 'promotionTier' => 'getPromotionTier', + 'reward' => 'getReward', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard' + ]; + + /** + * 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 OBJECT_REDEMPTION = 'redemption'; + public const RESULT_SUCCESS = 'SUCCESS'; + public const RESULT_FAILURE = 'FAILURE'; + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_ROLLED_BACK = 'ROLLED_BACK'; + public const RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_REDEMPTION = 'redemption'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REDEMPTION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + self::RESULT_FAILURE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + self::STATUS_ROLLED_BACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_REDEMPTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'redemption'); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('relatedRedemptions', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('failureMessage', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('promotionTier', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + array_push($this->openAPINullablesSetToNull, 'date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the redeeming customer. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the redemption. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets redemption + * + * @return string|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param string|null $redemption Unique redemption ID of the parent redemption. + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result Redemption result. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($result) && !in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Redemption status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets relatedRedemptions + * + * @return \OpenAPI\Client\Model\RedemptionRelatedRedemptions|null + */ + public function getRelatedRedemptions() + { + return $this->container['relatedRedemptions']; + } + + /** + * Sets relatedRedemptions + * + * @param \OpenAPI\Client\Model\RedemptionRelatedRedemptions|null $relatedRedemptions relatedRedemptions + * + * @return self + */ + public function setRelatedRedemptions($relatedRedemptions) + { + if (is_null($relatedRedemptions)) { + array_push($this->openAPINullablesSetToNull, 'relatedRedemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedRedemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedRedemptions'] = $relatedRedemptions; + + return $this; + } + + /** + * Gets failureCode + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param string|null $failureCode If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets failureMessage + * + * @return string|null + */ + public function getFailureMessage() + { + return $this->container['failureMessage']; + } + + /** + * Sets failureMessage + * + * @param string|null $failureMessage If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + * + * @return self + */ + public function setFailureMessage($failureMessage) + { + if (is_null($failureMessage)) { + array_push($this->openAPINullablesSetToNull, 'failureMessage'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureMessage', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureMessage'] = $failureMessage; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets channel + * + * @return \OpenAPI\Client\Model\RedemptionChannel|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \OpenAPI\Client\Model\RedemptionChannel|null $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Defines the related object. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\RedemptionVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\RedemptionVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + array_push($this->openAPINullablesSetToNull, 'voucher'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucher', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets promotionTier + * + * @return \OpenAPI\Client\Model\PromotionTier|null + */ + public function getPromotionTier() + { + return $this->container['promotionTier']; + } + + /** + * Sets promotionTier + * + * @param \OpenAPI\Client\Model\PromotionTier|null $promotionTier promotionTier + * + * @return self + */ + public function setPromotionTier($promotionTier) + { + if (is_null($promotionTier)) { + throw new \InvalidArgumentException('non-nullable promotionTier cannot be null'); + } + $this->container['promotionTier'] = $promotionTier; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\RedemptionRewardResult|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\RedemptionRewardResult|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + 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/RedemptionChannel.php b/src/Model/RedemptionChannel.php new file mode 100644 index 0000000..a7c5f96 --- /dev/null +++ b/src/Model/RedemptionChannel.php @@ -0,0 +1,493 @@ + + */ +class RedemptionChannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionChannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channelId' => 'string', + 'channelType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channelId' => null, + 'channelType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channelId' => true, + 'channelType' => true + ]; + + /** + * 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 = [ + 'channelId' => 'channel_id', + 'channelType' => 'channel_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channelId' => 'setChannelId', + 'channelType' => 'setChannelType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channelId' => 'getChannelId', + 'channelType' => 'getChannelType' + ]; + + /** + * 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 CHANNEL_TYPE_USER = 'USER'; + public const CHANNEL_TYPE_API = 'API'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelTypeAllowableValues() + { + return [ + self::CHANNEL_TYPE_USER, + self::CHANNEL_TYPE_API, + ]; + } + + /** + * 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('channelId', $data ?? [], null); + $this->setIfExists('channelType', $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->getChannelTypeAllowableValues(); + if (!is_null($this->container['channelType']) && !in_array($this->container['channelType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channelType', must be one of '%s'", + $this->container['channelType'], + 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 channelId + * + * @return string|null + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param string|null $channelId Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API. + * + * @return self + */ + public function setChannelId($channelId) + { + if (is_null($channelId)) { + array_push($this->openAPINullablesSetToNull, 'channelId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets channelType + * + * @return string|null + */ + public function getChannelType() + { + return $this->container['channelType']; + } + + /** + * Sets channelType + * + * @param string|null $channelType The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + * + * @return self + */ + public function setChannelType($channelType) + { + if (is_null($channelType)) { + array_push($this->openAPINullablesSetToNull, 'channelType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelTypeAllowableValues(); + if (!is_null($channelType) && !in_array($channelType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channelType', must be one of '%s'", + $channelType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channelType'] = $channelType; + + 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/RedemptionEntry.php b/src/Model/RedemptionEntry.php new file mode 100644 index 0000000..9af25aa --- /dev/null +++ b/src/Model/RedemptionEntry.php @@ -0,0 +1,1493 @@ + + */ +class RedemptionEntry implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntry'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'date' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => 'object', + 'amount' => 'int', + 'redemption' => 'string', + 'result' => 'string', + 'status' => 'string', + 'relatedRedemptions' => '\OpenAPI\Client\Model\RedemptionEntryRelatedRedemptions', + 'failureCode' => 'string', + 'failureMessage' => 'string', + 'order' => '\OpenAPI\Client\Model\RedemptionEntryOrder', + 'channel' => '\OpenAPI\Client\Model\RedemptionEntryChannel', + 'customer' => '\OpenAPI\Client\Model\RedemptionEntryCustomer', + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string', + 'voucher' => '\OpenAPI\Client\Model\RedemptionEntryVoucher', + 'promotionTier' => '\OpenAPI\Client\Model\RedemptionEntryPromotionTier', + 'reward' => '\OpenAPI\Client\Model\RedemptionRewardResult', + 'gift' => '\OpenAPI\Client\Model\RedemptionEntryGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionEntryLoyaltyCard', + 'reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'date' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'amount' => null, + 'redemption' => null, + 'result' => null, + 'status' => null, + 'relatedRedemptions' => null, + 'failureCode' => null, + 'failureMessage' => null, + 'order' => null, + 'channel' => null, + 'customer' => null, + 'relatedObjectType' => null, + 'relatedObjectId' => null, + 'voucher' => null, + 'promotionTier' => null, + 'reward' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'date' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => true, + 'amount' => true, + 'redemption' => true, + 'result' => true, + 'status' => true, + 'relatedRedemptions' => true, + 'failureCode' => true, + 'failureMessage' => true, + 'order' => true, + 'channel' => true, + 'customer' => true, + 'relatedObjectType' => true, + 'relatedObjectId' => true, + 'voucher' => true, + 'promotionTier' => true, + 'reward' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'reason' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'date' => 'date', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'amount' => 'amount', + 'redemption' => 'redemption', + 'result' => 'result', + 'status' => 'status', + 'relatedRedemptions' => 'related_redemptions', + 'failureCode' => 'failure_code', + 'failureMessage' => 'failure_message', + 'order' => 'order', + 'channel' => 'channel', + 'customer' => 'customer', + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id', + 'voucher' => 'voucher', + 'promotionTier' => 'promotion_tier', + 'reward' => 'reward', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'reason' => 'reason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'date' => 'setDate', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'amount' => 'setAmount', + 'redemption' => 'setRedemption', + 'result' => 'setResult', + 'status' => 'setStatus', + 'relatedRedemptions' => 'setRelatedRedemptions', + 'failureCode' => 'setFailureCode', + 'failureMessage' => 'setFailureMessage', + 'order' => 'setOrder', + 'channel' => 'setChannel', + 'customer' => 'setCustomer', + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId', + 'voucher' => 'setVoucher', + 'promotionTier' => 'setPromotionTier', + 'reward' => 'setReward', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'reason' => 'setReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'date' => 'getDate', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'amount' => 'getAmount', + 'redemption' => 'getRedemption', + 'result' => 'getResult', + 'status' => 'getStatus', + 'relatedRedemptions' => 'getRelatedRedemptions', + 'failureCode' => 'getFailureCode', + 'failureMessage' => 'getFailureMessage', + 'order' => 'getOrder', + 'channel' => 'getChannel', + 'customer' => 'getCustomer', + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId', + 'voucher' => 'getVoucher', + 'promotionTier' => 'getPromotionTier', + 'reward' => 'getReward', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'reason' => 'getReason' + ]; + + /** + * 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 OBJECT_REDEMPTION = 'redemption'; + public const OBJECT_REDEMPTION_ROLLBACK = 'redemption_rollback'; + public const RESULT_SUCCESS = 'SUCCESS'; + public const RESULT_FAILURE = 'FAILURE'; + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_ROLLED_BACK = 'ROLLED_BACK'; + public const RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_REDEMPTION = 'redemption'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REDEMPTION, + self::OBJECT_REDEMPTION_ROLLBACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + self::RESULT_FAILURE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + self::STATUS_ROLLED_BACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_REDEMPTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('relatedRedemptions', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('failureMessage', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('promotionTier', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('reason', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + array_push($this->openAPINullablesSetToNull, 'date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the redeeming customer. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets redemption + * + * @return string|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param string|null $redemption Unique redemption ID of the parent redemption. + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result Redemption result. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($result) && !in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets relatedRedemptions + * + * @return \OpenAPI\Client\Model\RedemptionEntryRelatedRedemptions|null + */ + public function getRelatedRedemptions() + { + return $this->container['relatedRedemptions']; + } + + /** + * Sets relatedRedemptions + * + * @param \OpenAPI\Client\Model\RedemptionEntryRelatedRedemptions|null $relatedRedemptions relatedRedemptions + * + * @return self + */ + public function setRelatedRedemptions($relatedRedemptions) + { + if (is_null($relatedRedemptions)) { + array_push($this->openAPINullablesSetToNull, 'relatedRedemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedRedemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedRedemptions'] = $relatedRedemptions; + + return $this; + } + + /** + * Gets failureCode + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param string|null $failureCode If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets failureMessage + * + * @return string|null + */ + public function getFailureMessage() + { + return $this->container['failureMessage']; + } + + /** + * Sets failureMessage + * + * @param string|null $failureMessage If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + * + * @return self + */ + public function setFailureMessage($failureMessage) + { + if (is_null($failureMessage)) { + array_push($this->openAPINullablesSetToNull, 'failureMessage'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureMessage', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureMessage'] = $failureMessage; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\RedemptionEntryOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\RedemptionEntryOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets channel + * + * @return \OpenAPI\Client\Model\RedemptionEntryChannel|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \OpenAPI\Client\Model\RedemptionEntryChannel|null $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\RedemptionEntryCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\RedemptionEntryCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Defines the related object. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId relatedObjectId + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\RedemptionEntryVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\RedemptionEntryVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + array_push($this->openAPINullablesSetToNull, 'voucher'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucher', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets promotionTier + * + * @return \OpenAPI\Client\Model\RedemptionEntryPromotionTier|null + */ + public function getPromotionTier() + { + return $this->container['promotionTier']; + } + + /** + * Sets promotionTier + * + * @param \OpenAPI\Client\Model\RedemptionEntryPromotionTier|null $promotionTier promotionTier + * + * @return self + */ + public function setPromotionTier($promotionTier) + { + if (is_null($promotionTier)) { + array_push($this->openAPINullablesSetToNull, 'promotionTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionTier'] = $promotionTier; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\RedemptionRewardResult|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\RedemptionRewardResult|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionEntryGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionEntryGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionEntryLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionEntryLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason System generated cause for the redemption being invalid in the context of the provided parameters. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + 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/RedemptionEntryChannel.php b/src/Model/RedemptionEntryChannel.php new file mode 100644 index 0000000..1b8701b --- /dev/null +++ b/src/Model/RedemptionEntryChannel.php @@ -0,0 +1,492 @@ + + */ +class RedemptionEntryChannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryChannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channelId' => 'string', + 'channelType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channelId' => null, + 'channelType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channelId' => true, + 'channelType' => true + ]; + + /** + * 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 = [ + 'channelId' => 'channel_id', + 'channelType' => 'channel_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channelId' => 'setChannelId', + 'channelType' => 'setChannelType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channelId' => 'getChannelId', + 'channelType' => 'getChannelType' + ]; + + /** + * 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 CHANNEL_TYPE_USER = 'USER'; + public const CHANNEL_TYPE_API = 'API'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelTypeAllowableValues() + { + return [ + self::CHANNEL_TYPE_USER, + self::CHANNEL_TYPE_API, + ]; + } + + /** + * 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('channelId', $data ?? [], null); + $this->setIfExists('channelType', $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->getChannelTypeAllowableValues(); + if (!is_null($this->container['channelType']) && !in_array($this->container['channelType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channelType', must be one of '%s'", + $this->container['channelType'], + 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 channelId + * + * @return string|null + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param string|null $channelId channelId + * + * @return self + */ + public function setChannelId($channelId) + { + if (is_null($channelId)) { + array_push($this->openAPINullablesSetToNull, 'channelId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets channelType + * + * @return string|null + */ + public function getChannelType() + { + return $this->container['channelType']; + } + + /** + * Sets channelType + * + * @param string|null $channelType The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + * + * @return self + */ + public function setChannelType($channelType) + { + if (is_null($channelType)) { + array_push($this->openAPINullablesSetToNull, 'channelType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelTypeAllowableValues(); + if (!is_null($channelType) && !in_array($channelType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channelType', must be one of '%s'", + $channelType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channelType'] = $channelType; + + 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/RedemptionEntryCustomer.php b/src/Model/RedemptionEntryCustomer.php new file mode 100644 index 0000000..4f25566 --- /dev/null +++ b/src/Model/RedemptionEntryCustomer.php @@ -0,0 +1,654 @@ + + */ +class RedemptionEntryCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'email' => 'string', + 'sourceId' => 'string', + 'metadata' => 'object', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'email' => null, + 'sourceId' => null, + 'metadata' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'email' => true, + 'sourceId' => true, + 'metadata' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'email' => 'email', + 'sourceId' => 'source_id', + 'metadata' => 'metadata', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'email' => 'setEmail', + 'sourceId' => 'setSourceId', + 'metadata' => 'setMetadata', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'email' => 'getEmail', + 'sourceId' => 'getSourceId', + 'metadata' => 'getMetadata', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of an existing customer. It is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionEntryGift.php b/src/Model/RedemptionEntryGift.php new file mode 100644 index 0000000..2db3421 --- /dev/null +++ b/src/Model/RedemptionEntryGift.php @@ -0,0 +1,417 @@ + + */ +class RedemptionEntryGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; + + /** + * 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('amount', $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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + 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/RedemptionEntryLoyaltyCard.php b/src/Model/RedemptionEntryLoyaltyCard.php new file mode 100644 index 0000000..52dbf0f --- /dev/null +++ b/src/Model/RedemptionEntryLoyaltyCard.php @@ -0,0 +1,417 @@ + + */ +class RedemptionEntryLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RedemptionEntryOrder.php b/src/Model/RedemptionEntryOrder.php new file mode 100644 index 0000000..1921612 --- /dev/null +++ b/src/Model/RedemptionEntryOrder.php @@ -0,0 +1,1348 @@ + + */ +class RedemptionEntryOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'itemsDiscountAmount' => 'int', + 'totalDiscountAmount' => 'int', + 'totalAmount' => 'int', + 'appliedDiscountAmount' => 'int', + 'itemsAppliedDiscountAmount' => 'int', + 'totalAppliedDiscountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderCalculatedItem[]', + 'metadata' => 'object', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'customerId' => 'string', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\RedemptionEntryOrderCustomer', + 'referrer' => '\OpenAPI\Client\Model\RedemptionEntryOrderReferrer', + 'redemptions' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'itemsDiscountAmount' => null, + 'totalDiscountAmount' => null, + 'totalAmount' => null, + 'appliedDiscountAmount' => null, + 'itemsAppliedDiscountAmount' => null, + 'totalAppliedDiscountAmount' => null, + 'items' => null, + 'metadata' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'customerId' => null, + 'referrerId' => null, + 'customer' => null, + 'referrer' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'itemsDiscountAmount' => true, + 'totalDiscountAmount' => true, + 'totalAmount' => true, + 'appliedDiscountAmount' => true, + 'itemsAppliedDiscountAmount' => true, + 'totalAppliedDiscountAmount' => true, + 'items' => true, + 'metadata' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'customerId' => true, + 'referrerId' => true, + 'customer' => true, + 'referrer' => true, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'itemsDiscountAmount' => 'items_discount_amount', + 'totalDiscountAmount' => 'total_discount_amount', + 'totalAmount' => 'total_amount', + 'appliedDiscountAmount' => 'applied_discount_amount', + 'itemsAppliedDiscountAmount' => 'items_applied_discount_amount', + 'totalAppliedDiscountAmount' => 'total_applied_discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'customerId' => 'customer_id', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'itemsDiscountAmount' => 'setItemsDiscountAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount', + 'totalAmount' => 'setTotalAmount', + 'appliedDiscountAmount' => 'setAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'setItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'setTotalAppliedDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'customerId' => 'setCustomerId', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'itemsDiscountAmount' => 'getItemsDiscountAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount', + 'totalAmount' => 'getTotalAmount', + 'appliedDiscountAmount' => 'getAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'getItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'getTotalAppliedDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'customerId' => 'getCustomerId', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + public const OBJECT_ORDER = 'order'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ORDER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('itemsDiscountAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountAmount', $data ?? [], null); + $this->setIfExists('itemsAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'order'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $data ?? [], null); + $this->setIfExists('redemptions', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets itemsDiscountAmount + * + * @return int|null + */ + public function getItemsDiscountAmount() + { + return $this->container['itemsDiscountAmount']; + } + + /** + * Sets itemsDiscountAmount + * + * @param int|null $itemsDiscountAmount Sum of all product-specific discounts applied to the order. + * + * @return self + */ + public function setItemsDiscountAmount($itemsDiscountAmount) + { + if (is_null($itemsDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsDiscountAmount'] = $itemsDiscountAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of all order-level AND all product-specific discounts applied to the order. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Order amount after undoing all the discounts through the rollback redemption. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets appliedDiscountAmount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['appliedDiscountAmount']; + } + + /** + * Sets appliedDiscountAmount + * + * @param int|null $appliedDiscountAmount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($appliedDiscountAmount) + { + if (is_null($appliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountAmount'] = $appliedDiscountAmount; + + return $this; + } + + /** + * Gets itemsAppliedDiscountAmount + * + * @return int|null + */ + public function getItemsAppliedDiscountAmount() + { + return $this->container['itemsAppliedDiscountAmount']; + } + + /** + * Sets itemsAppliedDiscountAmount + * + * @param int|null $itemsAppliedDiscountAmount Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + * + * @return self + */ + public function setItemsAppliedDiscountAmount($itemsAppliedDiscountAmount) + { + if (is_null($itemsAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsAppliedDiscountAmount'] = $itemsAppliedDiscountAmount; + + return $this; + } + + /** + * Gets totalAppliedDiscountAmount + * + * @return int|null + */ + public function getTotalAppliedDiscountAmount() + { + return $this->container['totalAppliedDiscountAmount']; + } + + /** + * Sets totalAppliedDiscountAmount + * + * @param int|null $totalAppliedDiscountAmount Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + * + * @return self + */ + public function setTotalAppliedDiscountAmount($totalAppliedDiscountAmount) + { + if (is_null($totalAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAppliedDiscountAmount'] = $totalAppliedDiscountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderCalculatedItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderCalculatedItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the order was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer making the purchase. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\RedemptionEntryOrderCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\RedemptionEntryOrderCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\RedemptionEntryOrderReferrer|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\RedemptionEntryOrderReferrer|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + array_push($this->openAPINullablesSetToNull, 'referrer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrer'] = $referrer; + + return $this; + } + + /** + * Gets redemptions + * + * @return object|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param object|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionEntryOrderCustomer.php b/src/Model/RedemptionEntryOrderCustomer.php new file mode 100644 index 0000000..0d774f7 --- /dev/null +++ b/src/Model/RedemptionEntryOrderCustomer.php @@ -0,0 +1,490 @@ + + */ +class RedemptionEntryOrderCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryOrderCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionEntryOrderReferrer.php b/src/Model/RedemptionEntryOrderReferrer.php new file mode 100644 index 0000000..4e791e7 --- /dev/null +++ b/src/Model/RedemptionEntryOrderReferrer.php @@ -0,0 +1,490 @@ + + */ +class RedemptionEntryOrderReferrer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryOrderReferrer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionEntryPromotionTier.php b/src/Model/RedemptionEntryPromotionTier.php new file mode 100644 index 0000000..0963860 --- /dev/null +++ b/src/Model/RedemptionEntryPromotionTier.php @@ -0,0 +1,1291 @@ + + */ +class RedemptionEntryPromotionTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryPromotionTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\RedemptionEntryPromotionTierAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\RedemptionEntryPromotionTierCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\RedemptionEntryPromotionTierSummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => true, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => true, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\RedemptionEntryPromotionTierAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\RedemptionEntryPromotionTierAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\RedemptionEntryPromotionTierCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\RedemptionEntryPromotionTierCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\RedemptionEntryPromotionTierSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\RedemptionEntryPromotionTierSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + array_push($this->openAPINullablesSetToNull, 'summary'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('summary', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/RedemptionEntryPromotionTierAction.php b/src/Model/RedemptionEntryPromotionTierAction.php new file mode 100644 index 0000000..c4df18b --- /dev/null +++ b/src/Model/RedemptionEntryPromotionTierAction.php @@ -0,0 +1,410 @@ + + */ +class RedemptionEntryPromotionTierAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryPromotionTierAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/RedemptionEntryPromotionTierCampaign.php b/src/Model/RedemptionEntryPromotionTierCampaign.php new file mode 100644 index 0000000..b64de12 --- /dev/null +++ b/src/Model/RedemptionEntryPromotionTierCampaign.php @@ -0,0 +1,765 @@ + + */ +class RedemptionEntryPromotionTierCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryPromotionTierCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/RedemptionEntryPromotionTierSummary.php b/src/Model/RedemptionEntryPromotionTierSummary.php new file mode 100644 index 0000000..d188c8a --- /dev/null +++ b/src/Model/RedemptionEntryPromotionTierSummary.php @@ -0,0 +1,458 @@ + + */ +class RedemptionEntryPromotionTierSummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryPromotionTierSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\RedemptionEntryPromotionTierSummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\RedemptionEntryPromotionTierSummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'orders' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\RedemptionEntryPromotionTierSummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionEntryPromotionTierSummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\RedemptionEntryPromotionTierSummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\RedemptionEntryPromotionTierSummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + 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/RedemptionEntryPromotionTierSummaryOrders.php b/src/Model/RedemptionEntryPromotionTierSummaryOrders.php new file mode 100644 index 0000000..54321d8 --- /dev/null +++ b/src/Model/RedemptionEntryPromotionTierSummaryOrders.php @@ -0,0 +1,458 @@ + + */ +class RedemptionEntryPromotionTierSummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryPromotionTierSummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/RedemptionEntryPromotionTierSummaryRedemptions.php b/src/Model/RedemptionEntryPromotionTierSummaryRedemptions.php new file mode 100644 index 0000000..c44ab59 --- /dev/null +++ b/src/Model/RedemptionEntryPromotionTierSummaryRedemptions.php @@ -0,0 +1,417 @@ + + */ +class RedemptionEntryPromotionTierSummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryPromotionTierSummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/RedemptionEntryRelatedRedemptions.php b/src/Model/RedemptionEntryRelatedRedemptions.php new file mode 100644 index 0000000..4b7c277 --- /dev/null +++ b/src/Model/RedemptionEntryRelatedRedemptions.php @@ -0,0 +1,458 @@ + + */ +class RedemptionEntryRelatedRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryRelatedRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rollbacks' => '\OpenAPI\Client\Model\RedemptionEntryRelatedRedemptionsRollbacksItem[]', + 'redemptions' => '\OpenAPI\Client\Model\RedemptionEntryRelatedRedemptionsRedemptionsItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rollbacks' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rollbacks' => true, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'rollbacks' => 'rollbacks', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rollbacks' => 'setRollbacks', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rollbacks' => 'getRollbacks', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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('rollbacks', $data ?? [], null); + $this->setIfExists('redemptions', $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 rollbacks + * + * @return \OpenAPI\Client\Model\RedemptionEntryRelatedRedemptionsRollbacksItem[]|null + */ + public function getRollbacks() + { + return $this->container['rollbacks']; + } + + /** + * Sets rollbacks + * + * @param \OpenAPI\Client\Model\RedemptionEntryRelatedRedemptionsRollbacksItem[]|null $rollbacks rollbacks + * + * @return self + */ + public function setRollbacks($rollbacks) + { + if (is_null($rollbacks)) { + array_push($this->openAPINullablesSetToNull, 'rollbacks'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbacks', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbacks'] = $rollbacks; + + return $this; + } + + /** + * Gets redemptions + * + * @return \OpenAPI\Client\Model\RedemptionEntryRelatedRedemptionsRedemptionsItem[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionEntryRelatedRedemptionsRedemptionsItem[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionEntryRelatedRedemptionsRedemptionsItem.php b/src/Model/RedemptionEntryRelatedRedemptionsRedemptionsItem.php new file mode 100644 index 0000000..ad7802d --- /dev/null +++ b/src/Model/RedemptionEntryRelatedRedemptionsRedemptionsItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionEntryRelatedRedemptionsRedemptionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryRelatedRedemptionsRedemptionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionEntryRelatedRedemptionsRollbacksItem.php b/src/Model/RedemptionEntryRelatedRedemptionsRollbacksItem.php new file mode 100644 index 0000000..0cd6952 --- /dev/null +++ b/src/Model/RedemptionEntryRelatedRedemptionsRollbacksItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionEntryRelatedRedemptionsRollbacksItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryRelatedRedemptionsRollbacksItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionEntryVoucher.php b/src/Model/RedemptionEntryVoucher.php new file mode 100644 index 0000000..6e6b3fd --- /dev/null +++ b/src/Model/RedemptionEntryVoucher.php @@ -0,0 +1,1634 @@ + + */ +class RedemptionEntryVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\RedemptionEntryVoucherGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionEntryVoucherLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\RedemptionEntryVoucherPublish', + 'redemption' => '\OpenAPI\Client\Model\RedemptionEntryVoucherRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'holder' => '\OpenAPI\Client\Model\SimpleCustomer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null, + 'holder' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => false, + 'holder' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'holder' => 'holder' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'holder' => 'setHolder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'holder' => 'getHolder' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('holder', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionEntryVoucherGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionEntryVoucherGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionEntryVoucherLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionEntryVoucherLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\RedemptionEntryVoucherPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\RedemptionEntryVoucherPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\RedemptionEntryVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\RedemptionEntryVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets holder + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getHolder() + { + return $this->container['holder']; + } + + /** + * Sets holder + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $holder holder + * + * @return self + */ + public function setHolder($holder) + { + if (is_null($holder)) { + throw new \InvalidArgumentException('non-nullable holder cannot be null'); + } + $this->container['holder'] = $holder; + + 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/RedemptionEntryVoucherGift.php b/src/Model/RedemptionEntryVoucherGift.php new file mode 100644 index 0000000..0bcdb1a --- /dev/null +++ b/src/Model/RedemptionEntryVoucherGift.php @@ -0,0 +1,533 @@ + + */ +class RedemptionEntryVoucherGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryVoucherGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/RedemptionEntryVoucherLoyaltyCard.php b/src/Model/RedemptionEntryVoucherLoyaltyCard.php new file mode 100644 index 0000000..802c5b6 --- /dev/null +++ b/src/Model/RedemptionEntryVoucherLoyaltyCard.php @@ -0,0 +1,540 @@ + + */ +class RedemptionEntryVoucherLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryVoucherLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/RedemptionEntryVoucherPublish.php b/src/Model/RedemptionEntryVoucherPublish.php new file mode 100644 index 0000000..7e2d723 --- /dev/null +++ b/src/Model/RedemptionEntryVoucherPublish.php @@ -0,0 +1,499 @@ + + */ +class RedemptionEntryVoucherPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryVoucherPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedemptionEntryVoucherRedemption.php b/src/Model/RedemptionEntryVoucherRedemption.php new file mode 100644 index 0000000..75a68d9 --- /dev/null +++ b/src/Model/RedemptionEntryVoucherRedemption.php @@ -0,0 +1,581 @@ + + */ +class RedemptionEntryVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionEntryVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedemptionGift.php b/src/Model/RedemptionGift.php new file mode 100644 index 0000000..adbc181 --- /dev/null +++ b/src/Model/RedemptionGift.php @@ -0,0 +1,418 @@ + + */ +class RedemptionGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; + + /** + * 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('amount', $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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + 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/RedemptionLoyaltyCard.php b/src/Model/RedemptionLoyaltyCard.php new file mode 100644 index 0000000..e3a616a --- /dev/null +++ b/src/Model/RedemptionLoyaltyCard.php @@ -0,0 +1,418 @@ + + */ +class RedemptionLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points subtracted from the loyalty card as a result of the redemption. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RedemptionRelatedRedemptions.php b/src/Model/RedemptionRelatedRedemptions.php new file mode 100644 index 0000000..ad23288 --- /dev/null +++ b/src/Model/RedemptionRelatedRedemptions.php @@ -0,0 +1,458 @@ + + */ +class RedemptionRelatedRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRelatedRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rollbacks' => '\OpenAPI\Client\Model\RedemptionRelatedRedemptionsRollbacksItem[]', + 'redemptions' => '\OpenAPI\Client\Model\RedemptionRelatedRedemptionsRedemptionsItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rollbacks' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rollbacks' => true, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'rollbacks' => 'rollbacks', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rollbacks' => 'setRollbacks', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rollbacks' => 'getRollbacks', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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('rollbacks', $data ?? [], null); + $this->setIfExists('redemptions', $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 rollbacks + * + * @return \OpenAPI\Client\Model\RedemptionRelatedRedemptionsRollbacksItem[]|null + */ + public function getRollbacks() + { + return $this->container['rollbacks']; + } + + /** + * Sets rollbacks + * + * @param \OpenAPI\Client\Model\RedemptionRelatedRedemptionsRollbacksItem[]|null $rollbacks rollbacks + * + * @return self + */ + public function setRollbacks($rollbacks) + { + if (is_null($rollbacks)) { + array_push($this->openAPINullablesSetToNull, 'rollbacks'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbacks', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbacks'] = $rollbacks; + + return $this; + } + + /** + * Gets redemptions + * + * @return \OpenAPI\Client\Model\RedemptionRelatedRedemptionsRedemptionsItem[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionRelatedRedemptionsRedemptionsItem[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionRelatedRedemptionsRedemptionsItem.php b/src/Model/RedemptionRelatedRedemptionsRedemptionsItem.php new file mode 100644 index 0000000..196c45e --- /dev/null +++ b/src/Model/RedemptionRelatedRedemptionsRedemptionsItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionRelatedRedemptionsRedemptionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRelatedRedemptionsRedemptionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionRelatedRedemptionsRollbacksItem.php b/src/Model/RedemptionRelatedRedemptionsRollbacksItem.php new file mode 100644 index 0000000..a0c96f6 --- /dev/null +++ b/src/Model/RedemptionRelatedRedemptionsRollbacksItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionRelatedRedemptionsRollbacksItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRelatedRedemptionsRollbacksItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique rollback redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionRewardResult.php b/src/Model/RedemptionRewardResult.php new file mode 100644 index 0000000..59c4c11 --- /dev/null +++ b/src/Model/RedemptionRewardResult.php @@ -0,0 +1,990 @@ + + */ +class RedemptionRewardResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRewardResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customer' => '\OpenAPI\Client\Model\SimpleCustomer', + 'assignmentId' => 'string', + 'voucher' => '\OpenAPI\Client\Model\Voucher', + 'product' => '\OpenAPI\Client\Model\Product', + 'sku' => '\OpenAPI\Client\Model\Sku', + 'loyaltyTierId' => 'string', + 'id' => 'string', + 'name' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'parameters' => '\OpenAPI\Client\Model\RedemptionRewardResultParameters', + 'metadata' => 'object', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customer' => null, + 'assignmentId' => null, + 'voucher' => null, + 'product' => null, + 'sku' => null, + 'loyaltyTierId' => null, + 'id' => null, + 'name' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'parameters' => null, + 'metadata' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'customer' => false, + 'assignmentId' => true, + 'voucher' => false, + 'product' => false, + 'sku' => false, + 'loyaltyTierId' => true, + 'id' => true, + 'name' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'parameters' => true, + 'metadata' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'customer' => 'customer', + 'assignmentId' => 'assignment_id', + 'voucher' => 'voucher', + 'product' => 'product', + 'sku' => 'sku', + 'loyaltyTierId' => 'loyalty_tier_id', + 'id' => 'id', + 'name' => 'name', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'parameters' => 'parameters', + 'metadata' => 'metadata', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customer' => 'setCustomer', + 'assignmentId' => 'setAssignmentId', + 'voucher' => 'setVoucher', + 'product' => 'setProduct', + 'sku' => 'setSku', + 'loyaltyTierId' => 'setLoyaltyTierId', + 'id' => 'setId', + 'name' => 'setName', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'parameters' => 'setParameters', + 'metadata' => 'setMetadata', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customer' => 'getCustomer', + 'assignmentId' => 'getAssignmentId', + 'voucher' => 'getVoucher', + 'product' => 'getProduct', + 'sku' => 'getSku', + 'loyaltyTierId' => 'getLoyaltyTierId', + 'id' => 'getId', + 'name' => 'getName', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'parameters' => 'getParameters', + 'metadata' => 'getMetadata', + 'type' => 'getType' + ]; + + /** + * 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 OBJECT_REWARD = 'reward'; + public const TYPE_CAMPAIGN = 'CAMPAIGN'; + public const TYPE_COIN = 'COIN'; + public const TYPE_MATERIAL = 'MATERIAL'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_CAMPAIGN, + self::TYPE_COIN, + self::TYPE_MATERIAL, + ]; + } + + /** + * 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('customer', $data ?? [], null); + $this->setIfExists('assignmentId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('loyaltyTierId', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('type', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 customer + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets assignmentId + * + * @return string|null + */ + public function getAssignmentId() + { + return $this->container['assignmentId']; + } + + /** + * Sets assignmentId + * + * @param string|null $assignmentId Unique reward assignment ID assigned by Voucherify. + * + * @return self + */ + public function setAssignmentId($assignmentId) + { + if (is_null($assignmentId)) { + array_push($this->openAPINullablesSetToNull, 'assignmentId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assignmentId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assignmentId'] = $assignmentId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\Voucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\Voucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\Product|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\Product|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + throw new \InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets sku + * + * @return \OpenAPI\Client\Model\Sku|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param \OpenAPI\Client\Model\Sku|null $sku sku + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + throw new \InvalidArgumentException('non-nullable sku cannot be null'); + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets loyaltyTierId + * + * @return string|null + */ + public function getLoyaltyTierId() + { + return $this->container['loyaltyTierId']; + } + + /** + * Sets loyaltyTierId + * + * @param string|null $loyaltyTierId Unique loyalty tier ID assigned by Voucherify. + * + * @return self + */ + public function setLoyaltyTierId($loyaltyTierId) + { + if (is_null($loyaltyTierId)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTierId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTierId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTierId'] = $loyaltyTierId; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the reward. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp in ISO 8601 format indicating when the reward was updated. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RedemptionRewardResultParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RedemptionRewardResultParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a reward. The metadata object stores all custom attributes assigned to the reward. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Reward type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + 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/RedemptionRewardResultParameters.php b/src/Model/RedemptionRewardResultParameters.php new file mode 100644 index 0000000..542af0b --- /dev/null +++ b/src/Model/RedemptionRewardResultParameters.php @@ -0,0 +1,500 @@ + + */ +class RedemptionRewardResultParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRewardResultParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'campaign' => '\OpenAPI\Client\Model\RedemptionRewardResultParametersCampaign', + 'product' => '\OpenAPI\Client\Model\RedemptionRewardResultParametersProduct', + 'coin' => '\OpenAPI\Client\Model\RedemptionRewardResultParametersCoin' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'campaign' => null, + 'product' => null, + 'coin' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'campaign' => true, + 'product' => true, + 'coin' => true + ]; + + /** + * 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 = [ + 'campaign' => 'campaign', + 'product' => 'product', + 'coin' => 'coin' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'campaign' => 'setCampaign', + 'product' => 'setProduct', + 'coin' => 'setCoin' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'campaign' => 'getCampaign', + 'product' => 'getProduct', + 'coin' => 'getCoin' + ]; + + /** + * 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('campaign', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('coin', $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 campaign + * + * @return \OpenAPI\Client\Model\RedemptionRewardResultParametersCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\RedemptionRewardResultParametersCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\RedemptionRewardResultParametersProduct|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\RedemptionRewardResultParametersProduct|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + array_push($this->openAPINullablesSetToNull, 'product'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets coin + * + * @return \OpenAPI\Client\Model\RedemptionRewardResultParametersCoin|null + */ + public function getCoin() + { + return $this->container['coin']; + } + + /** + * Sets coin + * + * @param \OpenAPI\Client\Model\RedemptionRewardResultParametersCoin|null $coin coin + * + * @return self + */ + public function setCoin($coin) + { + if (is_null($coin)) { + array_push($this->openAPINullablesSetToNull, 'coin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('coin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['coin'] = $coin; + + 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/RedemptionRewardResultParametersCampaign.php b/src/Model/RedemptionRewardResultParametersCampaign.php new file mode 100644 index 0000000..b59a6f2 --- /dev/null +++ b/src/Model/RedemptionRewardResultParametersCampaign.php @@ -0,0 +1,500 @@ + + */ +class RedemptionRewardResultParametersCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRewardResultParametersCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'balance' => 'int', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'balance' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'balance' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'balance' => 'balance', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'balance' => 'setBalance', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'balance' => 'getBalance', + 'type' => 'getType' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('type', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Campaign unique ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the campaign. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + 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/RedemptionRewardResultParametersCoin.php b/src/Model/RedemptionRewardResultParametersCoin.php new file mode 100644 index 0000000..706c30c --- /dev/null +++ b/src/Model/RedemptionRewardResultParametersCoin.php @@ -0,0 +1,459 @@ + + */ +class RedemptionRewardResultParametersCoin implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRewardResultParametersCoin'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exchangeRatio' => 'int', + 'pointsRatio' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exchangeRatio' => null, + 'pointsRatio' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'exchangeRatio' => true, + 'pointsRatio' => true + ]; + + /** + * 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 = [ + 'exchangeRatio' => 'exchange_ratio', + 'pointsRatio' => 'points_ratio' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exchangeRatio' => 'setExchangeRatio', + 'pointsRatio' => 'setPointsRatio' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exchangeRatio' => 'getExchangeRatio', + 'pointsRatio' => 'getPointsRatio' + ]; + + /** + * 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('exchangeRatio', $data ?? [], null); + $this->setIfExists('pointsRatio', $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 exchangeRatio + * + * @return int|null + */ + public function getExchangeRatio() + { + return $this->container['exchangeRatio']; + } + + /** + * Sets exchangeRatio + * + * @param int|null $exchangeRatio The cash equivalent of the points defined in the `points_ratio` property. + * + * @return self + */ + public function setExchangeRatio($exchangeRatio) + { + if (is_null($exchangeRatio)) { + array_push($this->openAPINullablesSetToNull, 'exchangeRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exchangeRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['exchangeRatio'] = $exchangeRatio; + + return $this; + } + + /** + * Gets pointsRatio + * + * @return int|null + */ + public function getPointsRatio() + { + return $this->container['pointsRatio']; + } + + /** + * Sets pointsRatio + * + * @param int|null $pointsRatio The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. + * + * @return self + */ + public function setPointsRatio($pointsRatio) + { + if (is_null($pointsRatio)) { + array_push($this->openAPINullablesSetToNull, 'pointsRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pointsRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pointsRatio'] = $pointsRatio; + + 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/RedemptionRewardResultParametersProduct.php b/src/Model/RedemptionRewardResultParametersProduct.php new file mode 100644 index 0000000..6c44004 --- /dev/null +++ b/src/Model/RedemptionRewardResultParametersProduct.php @@ -0,0 +1,459 @@ + + */ +class RedemptionRewardResultParametersProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRewardResultParametersProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'skuId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'skuId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'skuId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'skuId' => 'sku_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'skuId' => 'setSkuId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'skuId' => 'getSkuId' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('skuId', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets skuId + * + * @return string|null + */ + public function getSkuId() + { + return $this->container['skuId']; + } + + /** + * Sets skuId + * + * @param string|null $skuId Unique identifier of the SKU. It is assigned by Voucherify. + * + * @return self + */ + public function setSkuId($skuId) + { + if (is_null($skuId)) { + array_push($this->openAPINullablesSetToNull, 'skuId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skuId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skuId'] = $skuId; + + 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/RedemptionRollback.php b/src/Model/RedemptionRollback.php new file mode 100644 index 0000000..794cb74 --- /dev/null +++ b/src/Model/RedemptionRollback.php @@ -0,0 +1,1462 @@ + + */ +class RedemptionRollback implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRollback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'date' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => 'object', + 'amount' => 'int', + 'redemption' => 'string', + 'reason' => 'string', + 'result' => 'string', + 'status' => 'string', + 'relatedRedemptions' => '\OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptions', + 'failureCode' => 'string', + 'failureMessage' => 'string', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'channel' => '\OpenAPI\Client\Model\RedemptionRollbackChannel', + 'customer' => '\OpenAPI\Client\Model\SimpleCustomer', + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string', + 'voucher' => '\OpenAPI\Client\Model\Voucher', + 'promotionTier' => '\OpenAPI\Client\Model\PromotionTier', + 'reward' => '\OpenAPI\Client\Model\RedemptionRewardResult', + 'gift' => '\OpenAPI\Client\Model\RedemptionRollbackGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionRollbackLoyaltyCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'date' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'amount' => null, + 'redemption' => null, + 'reason' => null, + 'result' => null, + 'status' => null, + 'relatedRedemptions' => null, + 'failureCode' => null, + 'failureMessage' => null, + 'order' => null, + 'channel' => null, + 'customer' => null, + 'relatedObjectType' => null, + 'relatedObjectId' => null, + 'voucher' => null, + 'promotionTier' => null, + 'reward' => null, + 'gift' => null, + 'loyaltyCard' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'date' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => true, + 'amount' => true, + 'redemption' => true, + 'reason' => true, + 'result' => true, + 'status' => true, + 'relatedRedemptions' => true, + 'failureCode' => true, + 'failureMessage' => true, + 'order' => false, + 'channel' => true, + 'customer' => false, + 'relatedObjectType' => true, + 'relatedObjectId' => true, + 'voucher' => false, + 'promotionTier' => false, + 'reward' => false, + 'gift' => true, + 'loyaltyCard' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'date' => 'date', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'amount' => 'amount', + 'redemption' => 'redemption', + 'reason' => 'reason', + 'result' => 'result', + 'status' => 'status', + 'relatedRedemptions' => 'related_redemptions', + 'failureCode' => 'failure_code', + 'failureMessage' => 'failure_message', + 'order' => 'order', + 'channel' => 'channel', + 'customer' => 'customer', + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id', + 'voucher' => 'voucher', + 'promotionTier' => 'promotion_tier', + 'reward' => 'reward', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'date' => 'setDate', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'amount' => 'setAmount', + 'redemption' => 'setRedemption', + 'reason' => 'setReason', + 'result' => 'setResult', + 'status' => 'setStatus', + 'relatedRedemptions' => 'setRelatedRedemptions', + 'failureCode' => 'setFailureCode', + 'failureMessage' => 'setFailureMessage', + 'order' => 'setOrder', + 'channel' => 'setChannel', + 'customer' => 'setCustomer', + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId', + 'voucher' => 'setVoucher', + 'promotionTier' => 'setPromotionTier', + 'reward' => 'setReward', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'date' => 'getDate', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'amount' => 'getAmount', + 'redemption' => 'getRedemption', + 'reason' => 'getReason', + 'result' => 'getResult', + 'status' => 'getStatus', + 'relatedRedemptions' => 'getRelatedRedemptions', + 'failureCode' => 'getFailureCode', + 'failureMessage' => 'getFailureMessage', + 'order' => 'getOrder', + 'channel' => 'getChannel', + 'customer' => 'getCustomer', + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId', + 'voucher' => 'getVoucher', + 'promotionTier' => 'getPromotionTier', + 'reward' => 'getReward', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard' + ]; + + /** + * 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 OBJECT_REDEMPTION_ROLLBACK = 'redemption_rollback'; + public const RESULT_SUCCESS = 'SUCCESS'; + public const RESULT_FAILURE = 'FAILURE'; + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_REDEMPTION = 'redemption'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REDEMPTION_ROLLBACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + self::RESULT_FAILURE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_REDEMPTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'redemption_rollback'); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('relatedRedemptions', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('failureMessage', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('promotionTier', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the redemption rollback. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + array_push($this->openAPINullablesSetToNull, 'date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the redeeming customer. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the redemption. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets redemption + * + * @return string|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param string|null $redemption Unique redemption ID of the parent redemption. + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason System generated cause for the redemption being invalid in the context of the provided parameters. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result Redemption result. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($result) && !in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Redemption status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets relatedRedemptions + * + * @return \OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptions|null + */ + public function getRelatedRedemptions() + { + return $this->container['relatedRedemptions']; + } + + /** + * Sets relatedRedemptions + * + * @param \OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptions|null $relatedRedemptions relatedRedemptions + * + * @return self + */ + public function setRelatedRedemptions($relatedRedemptions) + { + if (is_null($relatedRedemptions)) { + array_push($this->openAPINullablesSetToNull, 'relatedRedemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedRedemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedRedemptions'] = $relatedRedemptions; + + return $this; + } + + /** + * Gets failureCode + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param string|null $failureCode If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets failureMessage + * + * @return string|null + */ + public function getFailureMessage() + { + return $this->container['failureMessage']; + } + + /** + * Sets failureMessage + * + * @param string|null $failureMessage If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + * + * @return self + */ + public function setFailureMessage($failureMessage) + { + if (is_null($failureMessage)) { + array_push($this->openAPINullablesSetToNull, 'failureMessage'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureMessage', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureMessage'] = $failureMessage; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets channel + * + * @return \OpenAPI\Client\Model\RedemptionRollbackChannel|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \OpenAPI\Client\Model\RedemptionRollbackChannel|null $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Defines the related object. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\Voucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\Voucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets promotionTier + * + * @return \OpenAPI\Client\Model\PromotionTier|null + */ + public function getPromotionTier() + { + return $this->container['promotionTier']; + } + + /** + * Sets promotionTier + * + * @param \OpenAPI\Client\Model\PromotionTier|null $promotionTier promotionTier + * + * @return self + */ + public function setPromotionTier($promotionTier) + { + if (is_null($promotionTier)) { + throw new \InvalidArgumentException('non-nullable promotionTier cannot be null'); + } + $this->container['promotionTier'] = $promotionTier; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\RedemptionRewardResult|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\RedemptionRewardResult|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionRollbackGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionRollbackGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionRollbackLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionRollbackLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + 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/RedemptionRollbackChannel.php b/src/Model/RedemptionRollbackChannel.php new file mode 100644 index 0000000..b74ede0 --- /dev/null +++ b/src/Model/RedemptionRollbackChannel.php @@ -0,0 +1,493 @@ + + */ +class RedemptionRollbackChannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRollbackChannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channelId' => 'string', + 'channelType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channelId' => null, + 'channelType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channelId' => true, + 'channelType' => true + ]; + + /** + * 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 = [ + 'channelId' => 'channel_id', + 'channelType' => 'channel_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channelId' => 'setChannelId', + 'channelType' => 'setChannelType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channelId' => 'getChannelId', + 'channelType' => 'getChannelType' + ]; + + /** + * 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 CHANNEL_TYPE_USER = 'USER'; + public const CHANNEL_TYPE_API = 'API'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelTypeAllowableValues() + { + return [ + self::CHANNEL_TYPE_USER, + self::CHANNEL_TYPE_API, + ]; + } + + /** + * 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('channelId', $data ?? [], null); + $this->setIfExists('channelType', $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->getChannelTypeAllowableValues(); + if (!is_null($this->container['channelType']) && !in_array($this->container['channelType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channelType', must be one of '%s'", + $this->container['channelType'], + 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 channelId + * + * @return string|null + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param string|null $channelId Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. + * + * @return self + */ + public function setChannelId($channelId) + { + if (is_null($channelId)) { + array_push($this->openAPINullablesSetToNull, 'channelId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets channelType + * + * @return string|null + */ + public function getChannelType() + { + return $this->container['channelType']; + } + + /** + * Sets channelType + * + * @param string|null $channelType The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + * + * @return self + */ + public function setChannelType($channelType) + { + if (is_null($channelType)) { + array_push($this->openAPINullablesSetToNull, 'channelType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelTypeAllowableValues(); + if (!is_null($channelType) && !in_array($channelType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channelType', must be one of '%s'", + $channelType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channelType'] = $channelType; + + 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/RedemptionRollbackGift.php b/src/Model/RedemptionRollbackGift.php new file mode 100644 index 0000000..2311c54 --- /dev/null +++ b/src/Model/RedemptionRollbackGift.php @@ -0,0 +1,418 @@ + + */ +class RedemptionRollbackGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRollbackGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; + + /** + * 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('amount', $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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + 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/RedemptionRollbackLoyaltyCard.php b/src/Model/RedemptionRollbackLoyaltyCard.php new file mode 100644 index 0000000..732c161 --- /dev/null +++ b/src/Model/RedemptionRollbackLoyaltyCard.php @@ -0,0 +1,418 @@ + + */ +class RedemptionRollbackLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRollbackLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RedemptionRollbackRelatedRedemptions.php b/src/Model/RedemptionRollbackRelatedRedemptions.php new file mode 100644 index 0000000..cfb4a98 --- /dev/null +++ b/src/Model/RedemptionRollbackRelatedRedemptions.php @@ -0,0 +1,458 @@ + + */ +class RedemptionRollbackRelatedRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRollbackRelatedRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rollbacks' => '\OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptionsRollbacksItem[]', + 'redemptions' => '\OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptionsRedemptionsItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rollbacks' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rollbacks' => true, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'rollbacks' => 'rollbacks', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rollbacks' => 'setRollbacks', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rollbacks' => 'getRollbacks', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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('rollbacks', $data ?? [], null); + $this->setIfExists('redemptions', $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 rollbacks + * + * @return \OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptionsRollbacksItem[]|null + */ + public function getRollbacks() + { + return $this->container['rollbacks']; + } + + /** + * Sets rollbacks + * + * @param \OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptionsRollbacksItem[]|null $rollbacks rollbacks + * + * @return self + */ + public function setRollbacks($rollbacks) + { + if (is_null($rollbacks)) { + array_push($this->openAPINullablesSetToNull, 'rollbacks'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbacks', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbacks'] = $rollbacks; + + return $this; + } + + /** + * Gets redemptions + * + * @return \OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptionsRedemptionsItem[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionRollbackRelatedRedemptionsRedemptionsItem[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionRollbackRelatedRedemptionsRedemptionsItem.php b/src/Model/RedemptionRollbackRelatedRedemptionsRedemptionsItem.php new file mode 100644 index 0000000..d841cbb --- /dev/null +++ b/src/Model/RedemptionRollbackRelatedRedemptionsRedemptionsItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionRollbackRelatedRedemptionsRedemptionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRollbackRelatedRedemptionsRedemptionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionRollbackRelatedRedemptionsRollbacksItem.php b/src/Model/RedemptionRollbackRelatedRedemptionsRollbacksItem.php new file mode 100644 index 0000000..e766996 --- /dev/null +++ b/src/Model/RedemptionRollbackRelatedRedemptionsRollbacksItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionRollbackRelatedRedemptionsRollbacksItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionRollbackRelatedRedemptionsRollbacksItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the redemption rollback. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionVoucher.php b/src/Model/RedemptionVoucher.php new file mode 100644 index 0000000..e138476 --- /dev/null +++ b/src/Model/RedemptionVoucher.php @@ -0,0 +1,1635 @@ + + */ +class RedemptionVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\RedemptionVoucherGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionVoucherLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\RedemptionVoucherPublish', + 'redemption' => '\OpenAPI\Client\Model\RedemptionVoucherRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'holder' => '\OpenAPI\Client\Model\SimpleCustomer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null, + 'holder' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => false, + 'holder' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'holder' => 'holder' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'holder' => 'setHolder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'holder' => 'getHolder' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('holder', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionVoucherGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionVoucherGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionVoucherLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionVoucherLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\RedemptionVoucherPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\RedemptionVoucherPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\RedemptionVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\RedemptionVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets holder + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getHolder() + { + return $this->container['holder']; + } + + /** + * Sets holder + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $holder holder + * + * @return self + */ + public function setHolder($holder) + { + if (is_null($holder)) { + throw new \InvalidArgumentException('non-nullable holder cannot be null'); + } + $this->container['holder'] = $holder; + + 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/RedemptionVoucherGift.php b/src/Model/RedemptionVoucherGift.php new file mode 100644 index 0000000..c2df09d --- /dev/null +++ b/src/Model/RedemptionVoucherGift.php @@ -0,0 +1,534 @@ + + */ +class RedemptionVoucherGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionVoucherGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/RedemptionVoucherLoyaltyCard.php b/src/Model/RedemptionVoucherLoyaltyCard.php new file mode 100644 index 0000000..d797a77 --- /dev/null +++ b/src/Model/RedemptionVoucherLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class RedemptionVoucherLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionVoucherLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/RedemptionVoucherPublish.php b/src/Model/RedemptionVoucherPublish.php new file mode 100644 index 0000000..05c2df6 --- /dev/null +++ b/src/Model/RedemptionVoucherPublish.php @@ -0,0 +1,500 @@ + + */ +class RedemptionVoucherPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionVoucherPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedemptionVoucherRedemption.php b/src/Model/RedemptionVoucherRedemption.php new file mode 100644 index 0000000..ca95ef0 --- /dev/null +++ b/src/Model/RedemptionVoucherRedemption.php @@ -0,0 +1,582 @@ + + */ +class RedemptionVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedemptionsGetResponseBody.php b/src/Model/RedemptionsGetResponseBody.php new file mode 100644 index 0000000..488a7c6 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBody.php @@ -0,0 +1,1493 @@ + + */ +class RedemptionsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'date' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => 'object', + 'amount' => 'int', + 'redemption' => 'string', + 'result' => 'string', + 'status' => 'string', + 'relatedRedemptions' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptions', + 'failureCode' => 'string', + 'failureMessage' => 'string', + 'order' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyOrder', + 'channel' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyChannel', + 'customer' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyCustomer', + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string', + 'voucher' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucher', + 'promotionTier' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTier', + 'reward' => '\OpenAPI\Client\Model\RedemptionRewardResult', + 'gift' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyLoyaltyCard', + 'reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'date' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'amount' => null, + 'redemption' => null, + 'result' => null, + 'status' => null, + 'relatedRedemptions' => null, + 'failureCode' => null, + 'failureMessage' => null, + 'order' => null, + 'channel' => null, + 'customer' => null, + 'relatedObjectType' => null, + 'relatedObjectId' => null, + 'voucher' => null, + 'promotionTier' => null, + 'reward' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'date' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => true, + 'amount' => true, + 'redemption' => true, + 'result' => true, + 'status' => true, + 'relatedRedemptions' => true, + 'failureCode' => true, + 'failureMessage' => true, + 'order' => true, + 'channel' => true, + 'customer' => true, + 'relatedObjectType' => true, + 'relatedObjectId' => true, + 'voucher' => true, + 'promotionTier' => true, + 'reward' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'reason' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'date' => 'date', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'amount' => 'amount', + 'redemption' => 'redemption', + 'result' => 'result', + 'status' => 'status', + 'relatedRedemptions' => 'related_redemptions', + 'failureCode' => 'failure_code', + 'failureMessage' => 'failure_message', + 'order' => 'order', + 'channel' => 'channel', + 'customer' => 'customer', + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id', + 'voucher' => 'voucher', + 'promotionTier' => 'promotion_tier', + 'reward' => 'reward', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'reason' => 'reason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'date' => 'setDate', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'amount' => 'setAmount', + 'redemption' => 'setRedemption', + 'result' => 'setResult', + 'status' => 'setStatus', + 'relatedRedemptions' => 'setRelatedRedemptions', + 'failureCode' => 'setFailureCode', + 'failureMessage' => 'setFailureMessage', + 'order' => 'setOrder', + 'channel' => 'setChannel', + 'customer' => 'setCustomer', + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId', + 'voucher' => 'setVoucher', + 'promotionTier' => 'setPromotionTier', + 'reward' => 'setReward', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'reason' => 'setReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'date' => 'getDate', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'amount' => 'getAmount', + 'redemption' => 'getRedemption', + 'result' => 'getResult', + 'status' => 'getStatus', + 'relatedRedemptions' => 'getRelatedRedemptions', + 'failureCode' => 'getFailureCode', + 'failureMessage' => 'getFailureMessage', + 'order' => 'getOrder', + 'channel' => 'getChannel', + 'customer' => 'getCustomer', + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId', + 'voucher' => 'getVoucher', + 'promotionTier' => 'getPromotionTier', + 'reward' => 'getReward', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'reason' => 'getReason' + ]; + + /** + * 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 OBJECT_REDEMPTION = 'redemption'; + public const OBJECT_REDEMPTION_ROLLBACK = 'redemption_rollback'; + public const RESULT_SUCCESS = 'SUCCESS'; + public const RESULT_FAILURE = 'FAILURE'; + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_ROLLED_BACK = 'ROLLED_BACK'; + public const RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_REDEMPTION = 'redemption'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REDEMPTION, + self::OBJECT_REDEMPTION_ROLLBACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + self::RESULT_FAILURE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + self::STATUS_ROLLED_BACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_REDEMPTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('relatedRedemptions', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('failureMessage', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('promotionTier', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('reason', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + array_push($this->openAPINullablesSetToNull, 'date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the redeeming customer. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets redemption + * + * @return string|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param string|null $redemption Unique redemption ID of the parent redemption. + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result Redemption result. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($result) && !in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets relatedRedemptions + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptions|null + */ + public function getRelatedRedemptions() + { + return $this->container['relatedRedemptions']; + } + + /** + * Sets relatedRedemptions + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptions|null $relatedRedemptions relatedRedemptions + * + * @return self + */ + public function setRelatedRedemptions($relatedRedemptions) + { + if (is_null($relatedRedemptions)) { + array_push($this->openAPINullablesSetToNull, 'relatedRedemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedRedemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedRedemptions'] = $relatedRedemptions; + + return $this; + } + + /** + * Gets failureCode + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param string|null $failureCode If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets failureMessage + * + * @return string|null + */ + public function getFailureMessage() + { + return $this->container['failureMessage']; + } + + /** + * Sets failureMessage + * + * @param string|null $failureMessage If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + * + * @return self + */ + public function setFailureMessage($failureMessage) + { + if (is_null($failureMessage)) { + array_push($this->openAPINullablesSetToNull, 'failureMessage'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureMessage', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureMessage'] = $failureMessage; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets channel + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyChannel|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyChannel|null $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Defines the related object. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId relatedObjectId + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + array_push($this->openAPINullablesSetToNull, 'voucher'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucher', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets promotionTier + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTier|null + */ + public function getPromotionTier() + { + return $this->container['promotionTier']; + } + + /** + * Sets promotionTier + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTier|null $promotionTier promotionTier + * + * @return self + */ + public function setPromotionTier($promotionTier) + { + if (is_null($promotionTier)) { + array_push($this->openAPINullablesSetToNull, 'promotionTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionTier'] = $promotionTier; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\RedemptionRewardResult|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\RedemptionRewardResult|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason System generated cause for the redemption being invalid in the context of the provided parameters. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + 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/RedemptionsGetResponseBodyChannel.php b/src/Model/RedemptionsGetResponseBodyChannel.php new file mode 100644 index 0000000..5dade53 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyChannel.php @@ -0,0 +1,492 @@ + + */ +class RedemptionsGetResponseBodyChannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyChannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channelId' => 'string', + 'channelType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channelId' => null, + 'channelType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channelId' => true, + 'channelType' => true + ]; + + /** + * 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 = [ + 'channelId' => 'channel_id', + 'channelType' => 'channel_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channelId' => 'setChannelId', + 'channelType' => 'setChannelType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channelId' => 'getChannelId', + 'channelType' => 'getChannelType' + ]; + + /** + * 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 CHANNEL_TYPE_USER = 'USER'; + public const CHANNEL_TYPE_API = 'API'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelTypeAllowableValues() + { + return [ + self::CHANNEL_TYPE_USER, + self::CHANNEL_TYPE_API, + ]; + } + + /** + * 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('channelId', $data ?? [], null); + $this->setIfExists('channelType', $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->getChannelTypeAllowableValues(); + if (!is_null($this->container['channelType']) && !in_array($this->container['channelType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channelType', must be one of '%s'", + $this->container['channelType'], + 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 channelId + * + * @return string|null + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param string|null $channelId channelId + * + * @return self + */ + public function setChannelId($channelId) + { + if (is_null($channelId)) { + array_push($this->openAPINullablesSetToNull, 'channelId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets channelType + * + * @return string|null + */ + public function getChannelType() + { + return $this->container['channelType']; + } + + /** + * Sets channelType + * + * @param string|null $channelType The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + * + * @return self + */ + public function setChannelType($channelType) + { + if (is_null($channelType)) { + array_push($this->openAPINullablesSetToNull, 'channelType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelTypeAllowableValues(); + if (!is_null($channelType) && !in_array($channelType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channelType', must be one of '%s'", + $channelType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channelType'] = $channelType; + + 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/RedemptionsGetResponseBodyCustomer.php b/src/Model/RedemptionsGetResponseBodyCustomer.php new file mode 100644 index 0000000..e908a6d --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyCustomer.php @@ -0,0 +1,654 @@ + + */ +class RedemptionsGetResponseBodyCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'email' => 'string', + 'sourceId' => 'string', + 'metadata' => 'object', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'email' => null, + 'sourceId' => null, + 'metadata' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'email' => true, + 'sourceId' => true, + 'metadata' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'email' => 'email', + 'sourceId' => 'source_id', + 'metadata' => 'metadata', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'email' => 'setEmail', + 'sourceId' => 'setSourceId', + 'metadata' => 'setMetadata', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'email' => 'getEmail', + 'sourceId' => 'getSourceId', + 'metadata' => 'getMetadata', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of an existing customer. It is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionsGetResponseBodyGift.php b/src/Model/RedemptionsGetResponseBodyGift.php new file mode 100644 index 0000000..dff1a38 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyGift.php @@ -0,0 +1,417 @@ + + */ +class RedemptionsGetResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; + + /** + * 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('amount', $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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + 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/RedemptionsGetResponseBodyLoyaltyCard.php b/src/Model/RedemptionsGetResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..7d8f663 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyLoyaltyCard.php @@ -0,0 +1,417 @@ + + */ +class RedemptionsGetResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RedemptionsGetResponseBodyOrder.php b/src/Model/RedemptionsGetResponseBodyOrder.php new file mode 100644 index 0000000..e55bd87 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyOrder.php @@ -0,0 +1,1348 @@ + + */ +class RedemptionsGetResponseBodyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'itemsDiscountAmount' => 'int', + 'totalDiscountAmount' => 'int', + 'totalAmount' => 'int', + 'appliedDiscountAmount' => 'int', + 'itemsAppliedDiscountAmount' => 'int', + 'totalAppliedDiscountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderCalculatedItem[]', + 'metadata' => 'object', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'customerId' => 'string', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyOrderCustomer', + 'referrer' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyOrderReferrer', + 'redemptions' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'itemsDiscountAmount' => null, + 'totalDiscountAmount' => null, + 'totalAmount' => null, + 'appliedDiscountAmount' => null, + 'itemsAppliedDiscountAmount' => null, + 'totalAppliedDiscountAmount' => null, + 'items' => null, + 'metadata' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'customerId' => null, + 'referrerId' => null, + 'customer' => null, + 'referrer' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'itemsDiscountAmount' => true, + 'totalDiscountAmount' => true, + 'totalAmount' => true, + 'appliedDiscountAmount' => true, + 'itemsAppliedDiscountAmount' => true, + 'totalAppliedDiscountAmount' => true, + 'items' => true, + 'metadata' => true, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'customerId' => true, + 'referrerId' => true, + 'customer' => true, + 'referrer' => true, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'itemsDiscountAmount' => 'items_discount_amount', + 'totalDiscountAmount' => 'total_discount_amount', + 'totalAmount' => 'total_amount', + 'appliedDiscountAmount' => 'applied_discount_amount', + 'itemsAppliedDiscountAmount' => 'items_applied_discount_amount', + 'totalAppliedDiscountAmount' => 'total_applied_discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'customerId' => 'customer_id', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'itemsDiscountAmount' => 'setItemsDiscountAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount', + 'totalAmount' => 'setTotalAmount', + 'appliedDiscountAmount' => 'setAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'setItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'setTotalAppliedDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'customerId' => 'setCustomerId', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'itemsDiscountAmount' => 'getItemsDiscountAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount', + 'totalAmount' => 'getTotalAmount', + 'appliedDiscountAmount' => 'getAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'getItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'getTotalAppliedDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'customerId' => 'getCustomerId', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + public const OBJECT_ORDER = 'order'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ORDER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('itemsDiscountAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountAmount', $data ?? [], null); + $this->setIfExists('itemsAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'order'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $data ?? [], null); + $this->setIfExists('redemptions', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets itemsDiscountAmount + * + * @return int|null + */ + public function getItemsDiscountAmount() + { + return $this->container['itemsDiscountAmount']; + } + + /** + * Sets itemsDiscountAmount + * + * @param int|null $itemsDiscountAmount Sum of all product-specific discounts applied to the order. + * + * @return self + */ + public function setItemsDiscountAmount($itemsDiscountAmount) + { + if (is_null($itemsDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsDiscountAmount'] = $itemsDiscountAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of all order-level AND all product-specific discounts applied to the order. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Order amount after undoing all the discounts through the rollback redemption. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets appliedDiscountAmount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['appliedDiscountAmount']; + } + + /** + * Sets appliedDiscountAmount + * + * @param int|null $appliedDiscountAmount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($appliedDiscountAmount) + { + if (is_null($appliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountAmount'] = $appliedDiscountAmount; + + return $this; + } + + /** + * Gets itemsAppliedDiscountAmount + * + * @return int|null + */ + public function getItemsAppliedDiscountAmount() + { + return $this->container['itemsAppliedDiscountAmount']; + } + + /** + * Sets itemsAppliedDiscountAmount + * + * @param int|null $itemsAppliedDiscountAmount Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + * + * @return self + */ + public function setItemsAppliedDiscountAmount($itemsAppliedDiscountAmount) + { + if (is_null($itemsAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsAppliedDiscountAmount'] = $itemsAppliedDiscountAmount; + + return $this; + } + + /** + * Gets totalAppliedDiscountAmount + * + * @return int|null + */ + public function getTotalAppliedDiscountAmount() + { + return $this->container['totalAppliedDiscountAmount']; + } + + /** + * Sets totalAppliedDiscountAmount + * + * @param int|null $totalAppliedDiscountAmount Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + * + * @return self + */ + public function setTotalAppliedDiscountAmount($totalAppliedDiscountAmount) + { + if (is_null($totalAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAppliedDiscountAmount'] = $totalAppliedDiscountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderCalculatedItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderCalculatedItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the order was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer making the purchase. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyOrderCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyOrderCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + array_push($this->openAPINullablesSetToNull, 'customer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyOrderReferrer|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyOrderReferrer|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + array_push($this->openAPINullablesSetToNull, 'referrer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrer', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrer'] = $referrer; + + return $this; + } + + /** + * Gets redemptions + * + * @return object|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param object|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionsGetResponseBodyOrderCustomer.php b/src/Model/RedemptionsGetResponseBodyOrderCustomer.php new file mode 100644 index 0000000..19bc705 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyOrderCustomer.php @@ -0,0 +1,490 @@ + + */ +class RedemptionsGetResponseBodyOrderCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyOrderCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionsGetResponseBodyOrderReferrer.php b/src/Model/RedemptionsGetResponseBodyOrderReferrer.php new file mode 100644 index 0000000..35eb7bd --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyOrderReferrer.php @@ -0,0 +1,490 @@ + + */ +class RedemptionsGetResponseBodyOrderReferrer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyOrderReferrer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionsGetResponseBodyPromotionTier.php b/src/Model/RedemptionsGetResponseBodyPromotionTier.php new file mode 100644 index 0000000..e881be7 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyPromotionTier.php @@ -0,0 +1,1291 @@ + + */ +class RedemptionsGetResponseBodyPromotionTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyPromotionTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => true, + 'metadata' => true, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => true, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => true, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + array_push($this->openAPINullablesSetToNull, 'action'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('action', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + array_push($this->openAPINullablesSetToNull, 'summary'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('summary', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/RedemptionsGetResponseBodyPromotionTierAction.php b/src/Model/RedemptionsGetResponseBodyPromotionTierAction.php new file mode 100644 index 0000000..9dea2e3 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyPromotionTierAction.php @@ -0,0 +1,410 @@ + + */ +class RedemptionsGetResponseBodyPromotionTierAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyPromotionTierAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/RedemptionsGetResponseBodyPromotionTierCampaign.php b/src/Model/RedemptionsGetResponseBodyPromotionTierCampaign.php new file mode 100644 index 0000000..f31b508 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyPromotionTierCampaign.php @@ -0,0 +1,765 @@ + + */ +class RedemptionsGetResponseBodyPromotionTierCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyPromotionTierCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/RedemptionsGetResponseBodyPromotionTierSummary.php b/src/Model/RedemptionsGetResponseBodyPromotionTierSummary.php new file mode 100644 index 0000000..4b67873 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyPromotionTierSummary.php @@ -0,0 +1,458 @@ + + */ +class RedemptionsGetResponseBodyPromotionTierSummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyPromotionTierSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'orders' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyPromotionTierSummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + array_push($this->openAPINullablesSetToNull, 'orders'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('orders', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['orders'] = $orders; + + 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/RedemptionsGetResponseBodyPromotionTierSummaryOrders.php b/src/Model/RedemptionsGetResponseBodyPromotionTierSummaryOrders.php new file mode 100644 index 0000000..8546fe6 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyPromotionTierSummaryOrders.php @@ -0,0 +1,458 @@ + + */ +class RedemptionsGetResponseBodyPromotionTierSummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyPromotionTierSummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.php b/src/Model/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.php new file mode 100644 index 0000000..17490f5 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.php @@ -0,0 +1,417 @@ + + */ +class RedemptionsGetResponseBodyPromotionTierSummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyPromotionTierSummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/RedemptionsGetResponseBodyRelatedRedemptions.php b/src/Model/RedemptionsGetResponseBodyRelatedRedemptions.php new file mode 100644 index 0000000..514caba --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyRelatedRedemptions.php @@ -0,0 +1,458 @@ + + */ +class RedemptionsGetResponseBodyRelatedRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyRelatedRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rollbacks' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem[]', + 'redemptions' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rollbacks' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rollbacks' => true, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'rollbacks' => 'rollbacks', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rollbacks' => 'setRollbacks', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rollbacks' => 'getRollbacks', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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('rollbacks', $data ?? [], null); + $this->setIfExists('redemptions', $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 rollbacks + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem[]|null + */ + public function getRollbacks() + { + return $this->container['rollbacks']; + } + + /** + * Sets rollbacks + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem[]|null $rollbacks rollbacks + * + * @return self + */ + public function setRollbacks($rollbacks) + { + if (is_null($rollbacks)) { + array_push($this->openAPINullablesSetToNull, 'rollbacks'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbacks', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbacks'] = $rollbacks; + + return $this; + } + + /** + * Gets redemptions + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.php b/src/Model/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.php new file mode 100644 index 0000000..03f6fee --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.php b/src/Model/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.php new file mode 100644 index 0000000..c74bb1f --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionsGetResponseBodyVoucher.php b/src/Model/RedemptionsGetResponseBodyVoucher.php new file mode 100644 index 0000000..207d0e1 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyVoucher.php @@ -0,0 +1,1634 @@ + + */ +class RedemptionsGetResponseBodyVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherPublish', + 'redemption' => '\OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'holder' => '\OpenAPI\Client\Model\SimpleCustomer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null, + 'holder' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => false, + 'holder' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'holder' => 'holder' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'holder' => 'setHolder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'holder' => 'getHolder' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('holder', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\RedemptionsGetResponseBodyVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets holder + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getHolder() + { + return $this->container['holder']; + } + + /** + * Sets holder + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $holder holder + * + * @return self + */ + public function setHolder($holder) + { + if (is_null($holder)) { + throw new \InvalidArgumentException('non-nullable holder cannot be null'); + } + $this->container['holder'] = $holder; + + 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/RedemptionsGetResponseBodyVoucherGift.php b/src/Model/RedemptionsGetResponseBodyVoucherGift.php new file mode 100644 index 0000000..8d420f2 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyVoucherGift.php @@ -0,0 +1,533 @@ + + */ +class RedemptionsGetResponseBodyVoucherGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyVoucherGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/RedemptionsGetResponseBodyVoucherLoyaltyCard.php b/src/Model/RedemptionsGetResponseBodyVoucherLoyaltyCard.php new file mode 100644 index 0000000..89ecab8 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyVoucherLoyaltyCard.php @@ -0,0 +1,540 @@ + + */ +class RedemptionsGetResponseBodyVoucherLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyVoucherLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/RedemptionsGetResponseBodyVoucherPublish.php b/src/Model/RedemptionsGetResponseBodyVoucherPublish.php new file mode 100644 index 0000000..b7d71c9 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyVoucherPublish.php @@ -0,0 +1,499 @@ + + */ +class RedemptionsGetResponseBodyVoucherPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyVoucherPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedemptionsGetResponseBodyVoucherRedemption.php b/src/Model/RedemptionsGetResponseBodyVoucherRedemption.php new file mode 100644 index 0000000..290bbc2 --- /dev/null +++ b/src/Model/RedemptionsGetResponseBodyVoucherRedemption.php @@ -0,0 +1,581 @@ + + */ +class RedemptionsGetResponseBodyVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsGetResponseBodyVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedemptionsListResponseBody.php b/src/Model/RedemptionsListResponseBody.php new file mode 100644 index 0000000..2898b33 --- /dev/null +++ b/src/Model/RedemptionsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class RedemptionsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'redemptions' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItem[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'redemptions' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'redemptions' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'redemptions' => 'redemptions', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'redemptions' => 'setRedemptions', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'redemptions' => 'getRedemptions', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'redemptions'); + $this->setIfExists('redemptions', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about redemptions in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of redemption objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets redemptions + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItem[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItem[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of redemptions. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/RedemptionsListResponseBodyRedemptionsItem.php b/src/Model/RedemptionsListResponseBodyRedemptionsItem.php new file mode 100644 index 0000000..93d1dca --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItem.php @@ -0,0 +1,1395 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'date' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => 'object', + 'amount' => 'int', + 'redemption' => 'string', + 'result' => 'string', + 'status' => 'string', + 'relatedRedemptions' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions', + 'failureCode' => 'string', + 'failureMessage' => 'string', + 'order' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrder', + 'channel' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemChannel', + 'customer' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemCustomer', + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string', + 'voucher' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucher', + 'promotionTier' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTier', + 'reward' => '\OpenAPI\Client\Model\RedemptionRewardResult', + 'gift' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemLoyaltyCard', + 'reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'date' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'amount' => null, + 'redemption' => null, + 'result' => null, + 'status' => null, + 'relatedRedemptions' => null, + 'failureCode' => null, + 'failureMessage' => null, + 'order' => null, + 'channel' => null, + 'customer' => null, + 'relatedObjectType' => null, + 'relatedObjectId' => null, + 'voucher' => null, + 'promotionTier' => null, + 'reward' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'object' => false, + 'date' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => false, + 'amount' => false, + 'redemption' => true, + 'result' => true, + 'status' => false, + 'relatedRedemptions' => false, + 'failureCode' => true, + 'failureMessage' => true, + 'order' => false, + 'channel' => false, + 'customer' => false, + 'relatedObjectType' => true, + 'relatedObjectId' => false, + 'voucher' => false, + 'promotionTier' => false, + 'reward' => false, + 'gift' => false, + 'loyaltyCard' => false, + 'reason' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'date' => 'date', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'amount' => 'amount', + 'redemption' => 'redemption', + 'result' => 'result', + 'status' => 'status', + 'relatedRedemptions' => 'related_redemptions', + 'failureCode' => 'failure_code', + 'failureMessage' => 'failure_message', + 'order' => 'order', + 'channel' => 'channel', + 'customer' => 'customer', + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id', + 'voucher' => 'voucher', + 'promotionTier' => 'promotion_tier', + 'reward' => 'reward', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'reason' => 'reason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'date' => 'setDate', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'amount' => 'setAmount', + 'redemption' => 'setRedemption', + 'result' => 'setResult', + 'status' => 'setStatus', + 'relatedRedemptions' => 'setRelatedRedemptions', + 'failureCode' => 'setFailureCode', + 'failureMessage' => 'setFailureMessage', + 'order' => 'setOrder', + 'channel' => 'setChannel', + 'customer' => 'setCustomer', + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId', + 'voucher' => 'setVoucher', + 'promotionTier' => 'setPromotionTier', + 'reward' => 'setReward', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'reason' => 'setReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'date' => 'getDate', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'amount' => 'getAmount', + 'redemption' => 'getRedemption', + 'result' => 'getResult', + 'status' => 'getStatus', + 'relatedRedemptions' => 'getRelatedRedemptions', + 'failureCode' => 'getFailureCode', + 'failureMessage' => 'getFailureMessage', + 'order' => 'getOrder', + 'channel' => 'getChannel', + 'customer' => 'getCustomer', + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId', + 'voucher' => 'getVoucher', + 'promotionTier' => 'getPromotionTier', + 'reward' => 'getReward', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'reason' => 'getReason' + ]; + + /** + * 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 OBJECT_REDEMPTION = 'redemption'; + public const OBJECT_REDEMPTION_ROLLBACK = 'redemption_rollback'; + public const RESULT_SUCCESS = 'SUCCESS'; + public const RESULT_FAILURE = 'FAILURE'; + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const STATUS_ROLLED_BACK = 'ROLLED_BACK'; + public const RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_REDEMPTION = 'redemption'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REDEMPTION, + self::OBJECT_REDEMPTION_ROLLBACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + self::RESULT_FAILURE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + self::STATUS_ROLLED_BACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_REDEMPTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('relatedRedemptions', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('failureMessage', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('promotionTier', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('reason', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + array_push($this->openAPINullablesSetToNull, 'date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the redeeming customer. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets redemption + * + * @return string|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param string|null $redemption Unique redemption ID of the parent redemption. + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result Redemption result. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($result) && !in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets relatedRedemptions + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions|null + */ + public function getRelatedRedemptions() + { + return $this->container['relatedRedemptions']; + } + + /** + * Sets relatedRedemptions + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions|null $relatedRedemptions relatedRedemptions + * + * @return self + */ + public function setRelatedRedemptions($relatedRedemptions) + { + if (is_null($relatedRedemptions)) { + throw new \InvalidArgumentException('non-nullable relatedRedemptions cannot be null'); + } + $this->container['relatedRedemptions'] = $relatedRedemptions; + + return $this; + } + + /** + * Gets failureCode + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param string|null $failureCode If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets failureMessage + * + * @return string|null + */ + public function getFailureMessage() + { + return $this->container['failureMessage']; + } + + /** + * Sets failureMessage + * + * @param string|null $failureMessage If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + * + * @return self + */ + public function setFailureMessage($failureMessage) + { + if (is_null($failureMessage)) { + array_push($this->openAPINullablesSetToNull, 'failureMessage'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureMessage', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureMessage'] = $failureMessage; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets channel + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemChannel|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemChannel|null $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Defines the related object. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId relatedObjectId + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + throw new \InvalidArgumentException('non-nullable relatedObjectId cannot be null'); + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets promotionTier + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTier|null + */ + public function getPromotionTier() + { + return $this->container['promotionTier']; + } + + /** + * Sets promotionTier + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTier|null $promotionTier promotionTier + * + * @return self + */ + public function setPromotionTier($promotionTier) + { + if (is_null($promotionTier)) { + throw new \InvalidArgumentException('non-nullable promotionTier cannot be null'); + } + $this->container['promotionTier'] = $promotionTier; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\RedemptionRewardResult|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\RedemptionRewardResult|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason System generated cause for the redemption being invalid in the context of the provided parameters. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + 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/RedemptionsListResponseBodyRedemptionsItemChannel.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemChannel.php new file mode 100644 index 0000000..9374db6 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemChannel.php @@ -0,0 +1,485 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemChannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemChannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channelId' => 'string', + 'channelType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channelId' => null, + 'channelType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channelId' => false, + 'channelType' => true + ]; + + /** + * 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 = [ + 'channelId' => 'channel_id', + 'channelType' => 'channel_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channelId' => 'setChannelId', + 'channelType' => 'setChannelType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channelId' => 'getChannelId', + 'channelType' => 'getChannelType' + ]; + + /** + * 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 CHANNEL_TYPE_USER = 'USER'; + public const CHANNEL_TYPE_API = 'API'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelTypeAllowableValues() + { + return [ + self::CHANNEL_TYPE_USER, + self::CHANNEL_TYPE_API, + ]; + } + + /** + * 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('channelId', $data ?? [], null); + $this->setIfExists('channelType', $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->getChannelTypeAllowableValues(); + if (!is_null($this->container['channelType']) && !in_array($this->container['channelType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channelType', must be one of '%s'", + $this->container['channelType'], + 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 channelId + * + * @return string|null + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param string|null $channelId channelId + * + * @return self + */ + public function setChannelId($channelId) + { + if (is_null($channelId)) { + throw new \InvalidArgumentException('non-nullable channelId cannot be null'); + } + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets channelType + * + * @return string|null + */ + public function getChannelType() + { + return $this->container['channelType']; + } + + /** + * Sets channelType + * + * @param string|null $channelType The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + * + * @return self + */ + public function setChannelType($channelType) + { + if (is_null($channelType)) { + array_push($this->openAPINullablesSetToNull, 'channelType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelTypeAllowableValues(); + if (!is_null($channelType) && !in_array($channelType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channelType', must be one of '%s'", + $channelType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channelType'] = $channelType; + + 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/RedemptionsListResponseBodyRedemptionsItemCustomer.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemCustomer.php new file mode 100644 index 0000000..74288a0 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemCustomer.php @@ -0,0 +1,647 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'email' => 'string', + 'sourceId' => 'string', + 'metadata' => 'object', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'email' => null, + 'sourceId' => null, + 'metadata' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'email' => true, + 'sourceId' => true, + 'metadata' => false, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'email' => 'email', + 'sourceId' => 'source_id', + 'metadata' => 'metadata', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'email' => 'setEmail', + 'sourceId' => 'setSourceId', + 'metadata' => 'setMetadata', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'email' => 'getEmail', + 'sourceId' => 'getSourceId', + 'metadata' => 'getMetadata', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of an existing customer. It is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionsListResponseBodyRedemptionsItemGift.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemGift.php new file mode 100644 index 0000000..a372bbd --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemGift.php @@ -0,0 +1,410 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => 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 = [ + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; + + /** + * 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('amount', $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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + 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/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.php new file mode 100644 index 0000000..94d67e4 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.php @@ -0,0 +1,410 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + throw new \InvalidArgumentException('non-nullable points cannot be null'); + } + $this->container['points'] = $points; + + 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/RedemptionsListResponseBodyRedemptionsItemOrder.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemOrder.php new file mode 100644 index 0000000..b902bf3 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemOrder.php @@ -0,0 +1,1320 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'status' => 'string', + 'amount' => 'int', + 'initialAmount' => 'int', + 'discountAmount' => 'int', + 'itemsDiscountAmount' => 'int', + 'totalDiscountAmount' => 'int', + 'totalAmount' => 'int', + 'appliedDiscountAmount' => 'int', + 'itemsAppliedDiscountAmount' => 'int', + 'totalAppliedDiscountAmount' => 'int', + 'items' => '\OpenAPI\Client\Model\OrderCalculatedItem[]', + 'metadata' => 'object', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'customerId' => 'string', + 'referrerId' => 'string', + 'customer' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrderCustomer', + 'referrer' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrderReferrer', + 'redemptions' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'status' => null, + 'amount' => null, + 'initialAmount' => null, + 'discountAmount' => null, + 'itemsDiscountAmount' => null, + 'totalDiscountAmount' => null, + 'totalAmount' => null, + 'appliedDiscountAmount' => null, + 'itemsAppliedDiscountAmount' => null, + 'totalAppliedDiscountAmount' => null, + 'items' => null, + 'metadata' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'customerId' => null, + 'referrerId' => null, + 'customer' => null, + 'referrer' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'status' => true, + 'amount' => true, + 'initialAmount' => true, + 'discountAmount' => true, + 'itemsDiscountAmount' => true, + 'totalDiscountAmount' => true, + 'totalAmount' => true, + 'appliedDiscountAmount' => true, + 'itemsAppliedDiscountAmount' => true, + 'totalAppliedDiscountAmount' => true, + 'items' => true, + 'metadata' => false, + 'object' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'customerId' => true, + 'referrerId' => true, + 'customer' => false, + 'referrer' => false, + 'redemptions' => 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'status' => 'status', + 'amount' => 'amount', + 'initialAmount' => 'initial_amount', + 'discountAmount' => 'discount_amount', + 'itemsDiscountAmount' => 'items_discount_amount', + 'totalDiscountAmount' => 'total_discount_amount', + 'totalAmount' => 'total_amount', + 'appliedDiscountAmount' => 'applied_discount_amount', + 'itemsAppliedDiscountAmount' => 'items_applied_discount_amount', + 'totalAppliedDiscountAmount' => 'total_applied_discount_amount', + 'items' => 'items', + 'metadata' => 'metadata', + 'object' => 'object', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'customerId' => 'customer_id', + 'referrerId' => 'referrer_id', + 'customer' => 'customer', + 'referrer' => 'referrer', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'status' => 'setStatus', + 'amount' => 'setAmount', + 'initialAmount' => 'setInitialAmount', + 'discountAmount' => 'setDiscountAmount', + 'itemsDiscountAmount' => 'setItemsDiscountAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount', + 'totalAmount' => 'setTotalAmount', + 'appliedDiscountAmount' => 'setAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'setItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'setTotalAppliedDiscountAmount', + 'items' => 'setItems', + 'metadata' => 'setMetadata', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'customerId' => 'setCustomerId', + 'referrerId' => 'setReferrerId', + 'customer' => 'setCustomer', + 'referrer' => 'setReferrer', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'status' => 'getStatus', + 'amount' => 'getAmount', + 'initialAmount' => 'getInitialAmount', + 'discountAmount' => 'getDiscountAmount', + 'itemsDiscountAmount' => 'getItemsDiscountAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount', + 'totalAmount' => 'getTotalAmount', + 'appliedDiscountAmount' => 'getAppliedDiscountAmount', + 'itemsAppliedDiscountAmount' => 'getItemsAppliedDiscountAmount', + 'totalAppliedDiscountAmount' => 'getTotalAppliedDiscountAmount', + 'items' => 'getItems', + 'metadata' => 'getMetadata', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'customerId' => 'getCustomerId', + 'referrerId' => 'getReferrerId', + 'customer' => 'getCustomer', + 'referrer' => 'getReferrer', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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 STATUS_CREATED = 'CREATED'; + public const STATUS_PAID = 'PAID'; + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_FULFILLED = 'FULFILLED'; + public const OBJECT_ORDER = 'order'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CREATED, + self::STATUS_PAID, + self::STATUS_CANCELED, + self::STATUS_FULFILLED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_ORDER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('initialAmount', $data ?? [], null); + $this->setIfExists('discountAmount', $data ?? [], null); + $this->setIfExists('itemsDiscountAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAmount', $data ?? [], null); + $this->setIfExists('appliedDiscountAmount', $data ?? [], null); + $this->setIfExists('itemsAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('totalAppliedDiscountAmount', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'order'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('referrer', $data ?? [], null); + $this->setIfExists('redemptions', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Unique source ID of an existing order that will be linked to the redemption of this request. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The order status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets initialAmount + * + * @return int|null + */ + public function getInitialAmount() + { + return $this->container['initialAmount']; + } + + /** + * Sets initialAmount + * + * @param int|null $initialAmount A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. + * + * @return self + */ + public function setInitialAmount($initialAmount) + { + if (is_null($initialAmount)) { + array_push($this->openAPINullablesSetToNull, 'initialAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['initialAmount'] = $initialAmount; + + return $this; + } + + /** + * Gets discountAmount + * + * @return int|null + */ + public function getDiscountAmount() + { + return $this->container['discountAmount']; + } + + /** + * Sets discountAmount + * + * @param int|null $discountAmount Sum of all order-level discounts applied to the order. + * + * @return self + */ + public function setDiscountAmount($discountAmount) + { + if (is_null($discountAmount)) { + array_push($this->openAPINullablesSetToNull, 'discountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('discountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['discountAmount'] = $discountAmount; + + return $this; + } + + /** + * Gets itemsDiscountAmount + * + * @return int|null + */ + public function getItemsDiscountAmount() + { + return $this->container['itemsDiscountAmount']; + } + + /** + * Sets itemsDiscountAmount + * + * @param int|null $itemsDiscountAmount Sum of all product-specific discounts applied to the order. + * + * @return self + */ + public function setItemsDiscountAmount($itemsDiscountAmount) + { + if (is_null($itemsDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsDiscountAmount'] = $itemsDiscountAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of all order-level AND all product-specific discounts applied to the order. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + return $this; + } + + /** + * Gets totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Order amount after undoing all the discounts through the rollback redemption. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets appliedDiscountAmount + * + * @return int|null + */ + public function getAppliedDiscountAmount() + { + return $this->container['appliedDiscountAmount']; + } + + /** + * Sets appliedDiscountAmount + * + * @param int|null $appliedDiscountAmount This field shows the order-level discount applied. + * + * @return self + */ + public function setAppliedDiscountAmount($appliedDiscountAmount) + { + if (is_null($appliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'appliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('appliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['appliedDiscountAmount'] = $appliedDiscountAmount; + + return $this; + } + + /** + * Gets itemsAppliedDiscountAmount + * + * @return int|null + */ + public function getItemsAppliedDiscountAmount() + { + return $this->container['itemsAppliedDiscountAmount']; + } + + /** + * Sets itemsAppliedDiscountAmount + * + * @param int|null $itemsAppliedDiscountAmount Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` + * + * @return self + */ + public function setItemsAppliedDiscountAmount($itemsAppliedDiscountAmount) + { + if (is_null($itemsAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'itemsAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('itemsAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['itemsAppliedDiscountAmount'] = $itemsAppliedDiscountAmount; + + return $this; + } + + /** + * Gets totalAppliedDiscountAmount + * + * @return int|null + */ + public function getTotalAppliedDiscountAmount() + { + return $this->container['totalAppliedDiscountAmount']; + } + + /** + * Sets totalAppliedDiscountAmount + * + * @param int|null $totalAppliedDiscountAmount Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` + * + * @return self + */ + public function setTotalAppliedDiscountAmount($totalAppliedDiscountAmount) + { + if (is_null($totalAppliedDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAppliedDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAppliedDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAppliedDiscountAmount'] = $totalAppliedDiscountAmount; + + return $this; + } + + /** + * Gets items + * + * @return \OpenAPI\Client\Model\OrderCalculatedItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \OpenAPI\Client\Model\OrderCalculatedItem[]|null $items Array of items applied to the order. + * + * @return self + */ + public function setItems($items) + { + if (is_null($items)) { + array_push($this->openAPINullablesSetToNull, 'items'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('items', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the order was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the customer making the purchase. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique referrer ID. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrderCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrderCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets referrer + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrderReferrer|null + */ + public function getReferrer() + { + return $this->container['referrer']; + } + + /** + * Sets referrer + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemOrderReferrer|null $referrer referrer + * + * @return self + */ + public function setReferrer($referrer) + { + if (is_null($referrer)) { + throw new \InvalidArgumentException('non-nullable referrer cannot be null'); + } + $this->container['referrer'] = $referrer; + + return $this; + } + + /** + * Gets redemptions + * + * @return object|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param object|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + throw new \InvalidArgumentException('non-nullable redemptions cannot be null'); + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.php new file mode 100644 index 0000000..340f380 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.php @@ -0,0 +1,490 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemOrderCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemOrderCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.php new file mode 100644 index 0000000..b659663 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.php @@ -0,0 +1,490 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemOrderReferrer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemOrderReferrer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RedemptionsListResponseBodyRedemptionsItemPromotionTier.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTier.php new file mode 100644 index 0000000..267e2ed --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTier.php @@ -0,0 +1,1263 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemPromotionTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemPromotionTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'name' => 'string', + 'banner' => 'string', + 'action' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierAction', + 'metadata' => 'object', + 'hierarchy' => 'int', + 'promotionId' => 'string', + 'campaign' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign', + 'campaignId' => 'string', + 'active' => 'bool', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'summary' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary', + 'object' => 'string', + 'validationRuleAssignments' => '\OpenAPI\Client\Model\ValidationRuleAssignmentsList', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'name' => null, + 'banner' => null, + 'action' => null, + 'metadata' => null, + 'hierarchy' => null, + 'promotionId' => null, + 'campaign' => null, + 'campaignId' => null, + 'active' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'summary' => null, + 'object' => null, + 'validationRuleAssignments' => null, + 'categoryId' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'name' => true, + 'banner' => true, + 'action' => false, + 'metadata' => false, + 'hierarchy' => true, + 'promotionId' => true, + 'campaign' => false, + 'campaignId' => true, + 'active' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'summary' => false, + 'object' => true, + 'validationRuleAssignments' => false, + 'categoryId' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'name' => 'name', + 'banner' => 'banner', + 'action' => 'action', + 'metadata' => 'metadata', + 'hierarchy' => 'hierarchy', + 'promotionId' => 'promotion_id', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'active' => 'active', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'summary' => 'summary', + 'object' => 'object', + 'validationRuleAssignments' => 'validation_rule_assignments', + 'categoryId' => 'category_id', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'name' => 'setName', + 'banner' => 'setBanner', + 'action' => 'setAction', + 'metadata' => 'setMetadata', + 'hierarchy' => 'setHierarchy', + 'promotionId' => 'setPromotionId', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'active' => 'setActive', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'summary' => 'setSummary', + 'object' => 'setObject', + 'validationRuleAssignments' => 'setValidationRuleAssignments', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'name' => 'getName', + 'banner' => 'getBanner', + 'action' => 'getAction', + 'metadata' => 'getMetadata', + 'hierarchy' => 'getHierarchy', + 'promotionId' => 'getPromotionId', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'active' => 'getActive', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'summary' => 'getSummary', + 'object' => 'getObject', + 'validationRuleAssignments' => 'getValidationRuleAssignments', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('banner', $data ?? [], null); + $this->setIfExists('action', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('hierarchy', $data ?? [], null); + $this->setIfExists('promotionId', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'promotion_tier'); + $this->setIfExists('validationRuleAssignments', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique promotion tier ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the promotion tier. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Text to be displayed to your customers on your website. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + return $this; + } + + /** + * Gets action + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierAction|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierAction|null $action action + * + * @return self + */ + public function setAction($action) + { + if (is_null($action)) { + throw new \InvalidArgumentException('non-nullable action cannot be null'); + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets hierarchy + * + * @return int|null + */ + public function getHierarchy() + { + return $this->container['hierarchy']; + } + + /** + * Sets hierarchy + * + * @param int|null $hierarchy The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. + * + * @return self + */ + public function setHierarchy($hierarchy) + { + if (is_null($hierarchy)) { + array_push($this->openAPINullablesSetToNull, 'hierarchy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hierarchy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hierarchy'] = $hierarchy; + + return $this; + } + + /** + * Gets promotionId + * + * @return string|null + */ + public function getPromotionId() + { + return $this->container['promotionId']; + } + + /** + * Sets promotionId + * + * @param string|null $promotionId Promotion unique ID. + * + * @return self + */ + public function setPromotionId($promotionId) + { + if (is_null($promotionId)) { + array_push($this->openAPINullablesSetToNull, 'promotionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('promotionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['promotionId'] = $promotionId; + + return $this; + } + + /** + * Gets campaign + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + throw new \InvalidArgumentException('non-nullable campaign cannot be null'); + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Promotion tier's parent campaign's unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets summary + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + throw new \InvalidArgumentException('non-nullable summary cannot be null'); + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the promotion tier. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets validationRuleAssignments + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null + */ + public function getValidationRuleAssignments() + { + return $this->container['validationRuleAssignments']; + } + + /** + * Sets validationRuleAssignments + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignmentsList|null $validationRuleAssignments validationRuleAssignments + * + * @return self + */ + public function setValidationRuleAssignments($validationRuleAssignments) + { + if (is_null($validationRuleAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRuleAssignments cannot be null'); + } + $this->container['validationRuleAssignments'] = $validationRuleAssignments; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Promotion tier category ID. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.php new file mode 100644 index 0000000..735009f --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.php @@ -0,0 +1,410 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemPromotionTierAction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemPromotionTierAction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => 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 = [ + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount' + ]; + + /** + * 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('discount', $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 discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.php new file mode 100644 index 0000000..55d13f2 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.php @@ -0,0 +1,765 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'categoryId' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'categoryId' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'categoryId' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'categoryId' => 'category_id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'categoryId' => 'setCategoryId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'categoryId' => 'getCategoryId', + 'object' => 'getObject' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'campaign'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID that this campaign belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the campaign object. This object stores information about the campaign. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.php new file mode 100644 index 0000000..77ba162 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.php @@ -0,0 +1,444 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions', + 'orders' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'orders' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => false, + 'orders' => 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 = [ + 'redemptions' => 'redemptions', + 'orders' => 'orders' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'orders' => 'setOrders' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'orders' => 'getOrders' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('orders', $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 redemptions + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + throw new \InvalidArgumentException('non-nullable redemptions cannot be null'); + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets orders + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders|null + */ + public function getOrders() + { + return $this->container['orders']; + } + + /** + * Sets orders + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders|null $orders orders + * + * @return self + */ + public function setOrders($orders) + { + if (is_null($orders)) { + throw new \InvalidArgumentException('non-nullable orders cannot be null'); + } + $this->container['orders'] = $orders; + + 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/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.php new file mode 100644 index 0000000..970d0af --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.php @@ -0,0 +1,458 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalAmount' => 'int', + 'totalDiscountAmount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalAmount' => null, + 'totalDiscountAmount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalAmount' => true, + 'totalDiscountAmount' => true + ]; + + /** + * 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 = [ + 'totalAmount' => 'total_amount', + 'totalDiscountAmount' => 'total_discount_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalAmount' => 'setTotalAmount', + 'totalDiscountAmount' => 'setTotalDiscountAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalAmount' => 'getTotalAmount', + 'totalDiscountAmount' => 'getTotalDiscountAmount' + ]; + + /** + * 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('totalAmount', $data ?? [], null); + $this->setIfExists('totalDiscountAmount', $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 totalAmount + * + * @return int|null + */ + public function getTotalAmount() + { + return $this->container['totalAmount']; + } + + /** + * Sets totalAmount + * + * @param int|null $totalAmount Sum of order totals. + * + * @return self + */ + public function setTotalAmount($totalAmount) + { + if (is_null($totalAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalAmount'] = $totalAmount; + + return $this; + } + + /** + * Gets totalDiscountAmount + * + * @return int|null + */ + public function getTotalDiscountAmount() + { + return $this->container['totalDiscountAmount']; + } + + /** + * Sets totalDiscountAmount + * + * @param int|null $totalDiscountAmount Sum of total discount applied using the promotion tier. + * + * @return self + */ + public function setTotalDiscountAmount($totalDiscountAmount) + { + if (is_null($totalDiscountAmount)) { + array_push($this->openAPINullablesSetToNull, 'totalDiscountAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalDiscountAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalDiscountAmount'] = $totalDiscountAmount; + + 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/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.php new file mode 100644 index 0000000..f5e5b85 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.php @@ -0,0 +1,417 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalRedeemed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalRedeemed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalRedeemed' => true + ]; + + /** + * 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 = [ + 'totalRedeemed' => 'total_redeemed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalRedeemed' => 'setTotalRedeemed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalRedeemed' => 'getTotalRedeemed' + ]; + + /** + * 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('totalRedeemed', $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 totalRedeemed + * + * @return int|null + */ + public function getTotalRedeemed() + { + return $this->container['totalRedeemed']; + } + + /** + * Sets totalRedeemed + * + * @param int|null $totalRedeemed Number of times the promotion tier was redeemed. + * + * @return self + */ + public function setTotalRedeemed($totalRedeemed) + { + if (is_null($totalRedeemed)) { + array_push($this->openAPINullablesSetToNull, 'totalRedeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('totalRedeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['totalRedeemed'] = $totalRedeemed; + + 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/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.php new file mode 100644 index 0000000..4ab45d3 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.php @@ -0,0 +1,451 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rollbacks' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem[]', + 'redemptions' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rollbacks' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rollbacks' => false, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'rollbacks' => 'rollbacks', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rollbacks' => 'setRollbacks', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rollbacks' => 'getRollbacks', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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('rollbacks', $data ?? [], null); + $this->setIfExists('redemptions', $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 rollbacks + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem[]|null + */ + public function getRollbacks() + { + return $this->container['rollbacks']; + } + + /** + * Sets rollbacks + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem[]|null $rollbacks rollbacks + * + * @return self + */ + public function setRollbacks($rollbacks) + { + if (is_null($rollbacks)) { + throw new \InvalidArgumentException('non-nullable rollbacks cannot be null'); + } + $this->container['rollbacks'] = $rollbacks; + + return $this; + } + + /** + * Gets redemptions + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.php new file mode 100644 index 0000000..a5465e2 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.php new file mode 100644 index 0000000..0c85b98 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionsListResponseBodyRedemptionsItemVoucher.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucher.php new file mode 100644 index 0000000..97998fe --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucher.php @@ -0,0 +1,1599 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherPublish', + 'redemption' => '\OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList', + 'holder' => '\OpenAPI\Client\Model\SimpleCustomer' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null, + 'holder' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => false, + 'loyaltyCard' => false, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => false, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => false, + 'redemption' => false, + 'categories' => true, + 'validationRulesAssignments' => false, + 'holder' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments', + 'holder' => 'holder' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments', + 'holder' => 'setHolder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments', + 'holder' => 'getHolder' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $data ?? [], null); + $this->setIfExists('holder', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + throw new \InvalidArgumentException('non-nullable publish cannot be null'); + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\RedemptionsListResponseBodyRedemptionsItemVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + throw new \InvalidArgumentException('non-nullable redemption cannot be null'); + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + return $this; + } + + /** + * Gets holder + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getHolder() + { + return $this->container['holder']; + } + + /** + * Sets holder + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $holder holder + * + * @return self + */ + public function setHolder($holder) + { + if (is_null($holder)) { + throw new \InvalidArgumentException('non-nullable holder cannot be null'); + } + $this->container['holder'] = $holder; + + 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/RedemptionsListResponseBodyRedemptionsItemVoucherGift.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherGift.php new file mode 100644 index 0000000..2f1a0b7 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherGift.php @@ -0,0 +1,533 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemVoucherGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemVoucherGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.php new file mode 100644 index 0000000..99131bf --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.php @@ -0,0 +1,540 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.php new file mode 100644 index 0000000..4449456 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.php @@ -0,0 +1,499 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemVoucherPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemVoucherPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.php b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.php new file mode 100644 index 0000000..5c2bbc3 --- /dev/null +++ b/src/Model/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.php @@ -0,0 +1,581 @@ + + */ +class RedemptionsListResponseBodyRedemptionsItemVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsListResponseBodyRedemptionsItemVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/RedemptionsRedeemRequestBody.php b/src/Model/RedemptionsRedeemRequestBody.php new file mode 100644 index 0000000..5a4d16d --- /dev/null +++ b/src/Model/RedemptionsRedeemRequestBody.php @@ -0,0 +1,643 @@ + + */ +class RedemptionsRedeemRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRedeemRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'options' => '\OpenAPI\Client\Model\RedemptionsRedeemRequestBodyOptions', + 'redeemables' => '\OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItem[]', + 'order' => '\OpenAPI\Client\Model\Order', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'session' => '\OpenAPI\Client\Model\Session', + 'trackingId' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'options' => null, + 'redeemables' => null, + 'order' => null, + 'customer' => null, + 'session' => null, + 'trackingId' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'options' => true, + 'redeemables' => true, + 'order' => false, + 'customer' => false, + 'session' => false, + 'trackingId' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'options' => 'options', + 'redeemables' => 'redeemables', + 'order' => 'order', + 'customer' => 'customer', + 'session' => 'session', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'options' => 'setOptions', + 'redeemables' => 'setRedeemables', + 'order' => 'setOrder', + 'customer' => 'setCustomer', + 'session' => 'setSession', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'options' => 'getOptions', + 'redeemables' => 'getRedeemables', + 'order' => 'getOrder', + 'customer' => 'getCustomer', + 'session' => 'getSession', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('options', $data ?? [], null); + $this->setIfExists('redeemables', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('session', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $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 options + * + * @return \OpenAPI\Client\Model\RedemptionsRedeemRequestBodyOptions|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBodyOptions|null $options options + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + array_push($this->openAPINullablesSetToNull, 'options'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('options', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets redeemables + * + * @return \OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItem[]|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItem[]|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + array_push($this->openAPINullablesSetToNull, 'redeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemables'] = $redeemables; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets session + * + * @return \OpenAPI\Client\Model\Session|null + */ + public function getSession() + { + return $this->container['session']; + } + + /** + * Sets session + * + * @param \OpenAPI\Client\Model\Session|null $session session + * + * @return self + */ + public function setSession($session) + { + if (is_null($session)) { + throw new \InvalidArgumentException('non-nullable session cannot be null'); + } + $this->container['session'] = $session; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Is correspondent to Customer's source_id + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/RedemptionsRedeemRequestBodyOptions.php b/src/Model/RedemptionsRedeemRequestBodyOptions.php new file mode 100644 index 0000000..b2ab771 --- /dev/null +++ b/src/Model/RedemptionsRedeemRequestBodyOptions.php @@ -0,0 +1,446 @@ + + */ +class RedemptionsRedeemRequestBodyOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRedeemRequestBodyOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'expand' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'expand' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expand' => true + ]; + + /** + * 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 = [ + 'expand' => 'expand' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'expand' => 'setExpand' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'expand' => 'getExpand' + ]; + + /** + * 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 EXPAND_ORDER = 'order'; + public const EXPAND_REDEMPTION = 'redemption'; + public const EXPAND_REDEEMABLE = 'redeemable'; + public const EXPAND_CATEGORY = 'category'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExpandAllowableValues() + { + return [ + self::EXPAND_ORDER, + self::EXPAND_REDEMPTION, + self::EXPAND_REDEEMABLE, + self::EXPAND_CATEGORY, + ]; + } + + /** + * 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('expand', $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 expand + * + * @return string[]|null + */ + public function getExpand() + { + return $this->container['expand']; + } + + /** + * Sets expand + * + * @param string[]|null $expand Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. | + * + * @return self + */ + public function setExpand($expand) + { + if (is_null($expand)) { + array_push($this->openAPINullablesSetToNull, 'expand'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expand', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExpandAllowableValues(); + if (!is_null($expand) && array_diff($expand, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'expand', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['expand'] = $expand; + + 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/RedemptionsRedeemRequestBodyRedeemablesItem.php b/src/Model/RedemptionsRedeemRequestBodyRedeemablesItem.php new file mode 100644 index 0000000..4b57ee6 --- /dev/null +++ b/src/Model/RedemptionsRedeemRequestBodyRedeemablesItem.php @@ -0,0 +1,562 @@ + + */ +class RedemptionsRedeemRequestBodyRedeemablesItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRedeemRequestBodyRedeemablesItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'id' => 'string', + 'gift' => '\OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItemGift', + 'reward' => '\OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItemReward' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'id' => null, + 'gift' => null, + 'reward' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => false, + 'id' => false, + 'gift' => true, + 'reward' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'id' => 'id', + 'gift' => 'gift', + 'reward' => 'reward' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'id' => 'setId', + 'gift' => 'setGift', + 'reward' => 'setReward' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'id' => 'getId', + 'gift' => 'getGift', + 'reward' => 'getReward' + ]; + + /** + * 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 OBJECT_VOUCHER = 'voucher'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + public const OBJECT_PROMOTION_STACK = 'promotion_stack'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + self::OBJECT_PROMOTION_TIER, + self::OBJECT_PROMOTION_STACK, + ]; + } + + /** + * 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('object', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('reward', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItemGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItemGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItemReward|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBodyRedeemablesItemReward|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + array_push($this->openAPINullablesSetToNull, 'reward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reward'] = $reward; + + 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/RedemptionsRedeemRequestBodyRedeemablesItemGift.php b/src/Model/RedemptionsRedeemRequestBodyRedeemablesItemGift.php new file mode 100644 index 0000000..3443685 --- /dev/null +++ b/src/Model/RedemptionsRedeemRequestBodyRedeemablesItemGift.php @@ -0,0 +1,418 @@ + + */ +class RedemptionsRedeemRequestBodyRedeemablesItemGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRedeemRequestBodyRedeemablesItemGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'credits' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'credits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'credits' => true + ]; + + /** + * 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 = [ + 'credits' => 'credits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'credits' => 'setCredits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'credits' => 'getCredits' + ]; + + /** + * 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('credits', $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 credits + * + * @return int|null + */ + public function getCredits() + { + return $this->container['credits']; + } + + /** + * Sets credits + * + * @param int|null $credits The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setCredits($credits) + { + if (is_null($credits)) { + array_push($this->openAPINullablesSetToNull, 'credits'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('credits', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['credits'] = $credits; + + 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/RedemptionsRedeemRequestBodyRedeemablesItemReward.php b/src/Model/RedemptionsRedeemRequestBodyRedeemablesItemReward.php new file mode 100644 index 0000000..a01106f --- /dev/null +++ b/src/Model/RedemptionsRedeemRequestBodyRedeemablesItemReward.php @@ -0,0 +1,459 @@ + + */ +class RedemptionsRedeemRequestBodyRedeemablesItemReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRedeemRequestBodyRedeemablesItemReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'points' => 'getPoints' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('points', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RedemptionsRedeemResponseBody.php b/src/Model/RedemptionsRedeemResponseBody.php new file mode 100644 index 0000000..d29b481 --- /dev/null +++ b/src/Model/RedemptionsRedeemResponseBody.php @@ -0,0 +1,568 @@ + + */ +class RedemptionsRedeemResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRedeemResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redemptions' => '\OpenAPI\Client\Model\Redemption[]', + 'parentRedemption' => '\OpenAPI\Client\Model\Redemption', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'inapplicableRedeemables' => '\OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]', + 'skippedRedeemables' => '\OpenAPI\Client\Model\ValidationsRedeemableSkipped[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redemptions' => null, + 'parentRedemption' => null, + 'order' => null, + 'inapplicableRedeemables' => null, + 'skippedRedeemables' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redemptions' => true, + 'parentRedemption' => false, + 'order' => false, + 'inapplicableRedeemables' => true, + 'skippedRedeemables' => true + ]; + + /** + * 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 = [ + 'redemptions' => 'redemptions', + 'parentRedemption' => 'parent_redemption', + 'order' => 'order', + 'inapplicableRedeemables' => 'inapplicable_redeemables', + 'skippedRedeemables' => 'skipped_redeemables' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redemptions' => 'setRedemptions', + 'parentRedemption' => 'setParentRedemption', + 'order' => 'setOrder', + 'inapplicableRedeemables' => 'setInapplicableRedeemables', + 'skippedRedeemables' => 'setSkippedRedeemables' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redemptions' => 'getRedemptions', + 'parentRedemption' => 'getParentRedemption', + 'order' => 'getOrder', + 'inapplicableRedeemables' => 'getInapplicableRedeemables', + 'skippedRedeemables' => 'getSkippedRedeemables' + ]; + + /** + * 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('redemptions', $data ?? [], null); + $this->setIfExists('parentRedemption', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('inapplicableRedeemables', $data ?? [], null); + $this->setIfExists('skippedRedeemables', $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 redemptions + * + * @return \OpenAPI\Client\Model\Redemption[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\Redemption[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + return $this; + } + + /** + * Gets parentRedemption + * + * @return \OpenAPI\Client\Model\Redemption|null + */ + public function getParentRedemption() + { + return $this->container['parentRedemption']; + } + + /** + * Sets parentRedemption + * + * @param \OpenAPI\Client\Model\Redemption|null $parentRedemption parentRedemption + * + * @return self + */ + public function setParentRedemption($parentRedemption) + { + if (is_null($parentRedemption)) { + throw new \InvalidArgumentException('non-nullable parentRedemption cannot be null'); + } + $this->container['parentRedemption'] = $parentRedemption; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets inapplicableRedeemables + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]|null + */ + public function getInapplicableRedeemables() + { + return $this->container['inapplicableRedeemables']; + } + + /** + * Sets inapplicableRedeemables + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]|null $inapplicableRedeemables Lists validation results of each inapplicable redeemable. + * + * @return self + */ + public function setInapplicableRedeemables($inapplicableRedeemables) + { + if (is_null($inapplicableRedeemables)) { + array_push($this->openAPINullablesSetToNull, 'inapplicableRedeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inapplicableRedeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['inapplicableRedeemables'] = $inapplicableRedeemables; + + return $this; + } + + /** + * Gets skippedRedeemables + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableSkipped[]|null + */ + public function getSkippedRedeemables() + { + return $this->container['skippedRedeemables']; + } + + /** + * Sets skippedRedeemables + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableSkipped[]|null $skippedRedeemables Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`. + * + * @return self + */ + public function setSkippedRedeemables($skippedRedeemables) + { + if (is_null($skippedRedeemables)) { + array_push($this->openAPINullablesSetToNull, 'skippedRedeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skippedRedeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skippedRedeemables'] = $skippedRedeemables; + + 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/RedemptionsRollbackCreateRequestBody.php b/src/Model/RedemptionsRollbackCreateRequestBody.php new file mode 100644 index 0000000..711e3bd --- /dev/null +++ b/src/Model/RedemptionsRollbackCreateRequestBody.php @@ -0,0 +1,568 @@ + + */ +class RedemptionsRollbackCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbackCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reason' => 'string', + 'trackingId' => 'string', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'order' => '\OpenAPI\Client\Model\Order', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reason' => null, + 'trackingId' => null, + 'customer' => null, + 'order' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reason' => true, + 'trackingId' => true, + 'customer' => false, + 'order' => false, + 'metadata' => true + ]; + + /** + * 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 = [ + 'reason' => 'reason', + 'trackingId' => 'tracking_id', + 'customer' => 'customer', + 'order' => 'order', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reason' => 'setReason', + 'trackingId' => 'setTrackingId', + 'customer' => 'setCustomer', + 'order' => 'setOrder', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reason' => 'getReason', + 'trackingId' => 'getTrackingId', + 'customer' => 'getCustomer', + 'order' => 'getOrder', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('reason', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('metadata', $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 reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason Reason for the rollback. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Customer's `source_id`. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can send in the request body to update **redemption** metadata. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/RedemptionsRollbackCreateResponseBody.php b/src/Model/RedemptionsRollbackCreateResponseBody.php new file mode 100644 index 0000000..9fd2981 --- /dev/null +++ b/src/Model/RedemptionsRollbackCreateResponseBody.php @@ -0,0 +1,1462 @@ + + */ +class RedemptionsRollbackCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbackCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'date' => '\DateTime', + 'customerId' => 'string', + 'trackingId' => 'string', + 'metadata' => 'object', + 'amount' => 'int', + 'redemption' => 'string', + 'reason' => 'string', + 'result' => 'string', + 'status' => 'string', + 'relatedRedemptions' => '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptions', + 'failureCode' => 'string', + 'failureMessage' => 'string', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'channel' => '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyChannel', + 'customer' => '\OpenAPI\Client\Model\SimpleCustomer', + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string', + 'voucher' => '\OpenAPI\Client\Model\Voucher', + 'promotionTier' => '\OpenAPI\Client\Model\PromotionTier', + 'reward' => '\OpenAPI\Client\Model\RedemptionRewardResult', + 'gift' => '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyLoyaltyCard' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'date' => 'date-time', + 'customerId' => null, + 'trackingId' => null, + 'metadata' => null, + 'amount' => null, + 'redemption' => null, + 'reason' => null, + 'result' => null, + 'status' => null, + 'relatedRedemptions' => null, + 'failureCode' => null, + 'failureMessage' => null, + 'order' => null, + 'channel' => null, + 'customer' => null, + 'relatedObjectType' => null, + 'relatedObjectId' => null, + 'voucher' => null, + 'promotionTier' => null, + 'reward' => null, + 'gift' => null, + 'loyaltyCard' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'date' => true, + 'customerId' => true, + 'trackingId' => true, + 'metadata' => true, + 'amount' => true, + 'redemption' => true, + 'reason' => true, + 'result' => true, + 'status' => true, + 'relatedRedemptions' => true, + 'failureCode' => true, + 'failureMessage' => true, + 'order' => false, + 'channel' => true, + 'customer' => false, + 'relatedObjectType' => true, + 'relatedObjectId' => true, + 'voucher' => false, + 'promotionTier' => false, + 'reward' => false, + 'gift' => true, + 'loyaltyCard' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'date' => 'date', + 'customerId' => 'customer_id', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata', + 'amount' => 'amount', + 'redemption' => 'redemption', + 'reason' => 'reason', + 'result' => 'result', + 'status' => 'status', + 'relatedRedemptions' => 'related_redemptions', + 'failureCode' => 'failure_code', + 'failureMessage' => 'failure_message', + 'order' => 'order', + 'channel' => 'channel', + 'customer' => 'customer', + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id', + 'voucher' => 'voucher', + 'promotionTier' => 'promotion_tier', + 'reward' => 'reward', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'date' => 'setDate', + 'customerId' => 'setCustomerId', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata', + 'amount' => 'setAmount', + 'redemption' => 'setRedemption', + 'reason' => 'setReason', + 'result' => 'setResult', + 'status' => 'setStatus', + 'relatedRedemptions' => 'setRelatedRedemptions', + 'failureCode' => 'setFailureCode', + 'failureMessage' => 'setFailureMessage', + 'order' => 'setOrder', + 'channel' => 'setChannel', + 'customer' => 'setCustomer', + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId', + 'voucher' => 'setVoucher', + 'promotionTier' => 'setPromotionTier', + 'reward' => 'setReward', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'date' => 'getDate', + 'customerId' => 'getCustomerId', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata', + 'amount' => 'getAmount', + 'redemption' => 'getRedemption', + 'reason' => 'getReason', + 'result' => 'getResult', + 'status' => 'getStatus', + 'relatedRedemptions' => 'getRelatedRedemptions', + 'failureCode' => 'getFailureCode', + 'failureMessage' => 'getFailureMessage', + 'order' => 'getOrder', + 'channel' => 'getChannel', + 'customer' => 'getCustomer', + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId', + 'voucher' => 'getVoucher', + 'promotionTier' => 'getPromotionTier', + 'reward' => 'getReward', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard' + ]; + + /** + * 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 OBJECT_REDEMPTION_ROLLBACK = 'redemption_rollback'; + public const RESULT_SUCCESS = 'SUCCESS'; + public const RESULT_FAILURE = 'FAILURE'; + public const STATUS_SUCCEEDED = 'SUCCEEDED'; + public const STATUS_FAILED = 'FAILED'; + public const RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_REDEMPTION = 'redemption'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REDEMPTION_ROLLBACK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getResultAllowableValues() + { + return [ + self::RESULT_SUCCESS, + self::RESULT_FAILURE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SUCCEEDED, + self::STATUS_FAILED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_REDEMPTION, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'redemption_rollback'); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('customerId', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('relatedRedemptions', $data ?? [], null); + $this->setIfExists('failureCode', $data ?? [], null); + $this->setIfExists('failureMessage', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('voucher', $data ?? [], null); + $this->setIfExists('promotionTier', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'result', must be one of '%s'", + $this->container['result'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the redemption rollback. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + array_push($this->openAPINullablesSetToNull, 'date'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('date', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets customerId + * + * @return string|null + */ + public function getCustomerId() + { + return $this->container['customerId']; + } + + /** + * Sets customerId + * + * @param string|null $customerId Unique customer ID of the redeeming customer. + * + * @return self + */ + public function setCustomerId($customerId) + { + if (is_null($customerId)) { + array_push($this->openAPINullablesSetToNull, 'customerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customerId'] = $customerId; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the redemption. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets redemption + * + * @return string|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param string|null $redemption Unique redemption ID of the parent redemption. + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason System generated cause for the redemption being invalid in the context of the provided parameters. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets result + * + * @return string|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param string|null $result Redemption result. + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getResultAllowableValues(); + if (!is_null($result) && !in_array($result, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'result', must be one of '%s'", + $result, + implode("', '", $allowedValues) + ) + ); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Redemption status. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets relatedRedemptions + * + * @return \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptions|null + */ + public function getRelatedRedemptions() + { + return $this->container['relatedRedemptions']; + } + + /** + * Sets relatedRedemptions + * + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptions|null $relatedRedemptions relatedRedemptions + * + * @return self + */ + public function setRelatedRedemptions($relatedRedemptions) + { + if (is_null($relatedRedemptions)) { + array_push($this->openAPINullablesSetToNull, 'relatedRedemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedRedemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedRedemptions'] = $relatedRedemptions; + + return $this; + } + + /** + * Gets failureCode + * + * @return string|null + */ + public function getFailureCode() + { + return $this->container['failureCode']; + } + + /** + * Sets failureCode + * + * @param string|null $failureCode If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. + * + * @return self + */ + public function setFailureCode($failureCode) + { + if (is_null($failureCode)) { + array_push($this->openAPINullablesSetToNull, 'failureCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureCode'] = $failureCode; + + return $this; + } + + /** + * Gets failureMessage + * + * @return string|null + */ + public function getFailureMessage() + { + return $this->container['failureMessage']; + } + + /** + * Sets failureMessage + * + * @param string|null $failureMessage If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. + * + * @return self + */ + public function setFailureMessage($failureMessage) + { + if (is_null($failureMessage)) { + array_push($this->openAPINullablesSetToNull, 'failureMessage'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('failureMessage', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['failureMessage'] = $failureMessage; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets channel + * + * @return \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyChannel|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyChannel|null $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\SimpleCustomer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\SimpleCustomer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Defines the related object. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets voucher + * + * @return \OpenAPI\Client\Model\Voucher|null + */ + public function getVoucher() + { + return $this->container['voucher']; + } + + /** + * Sets voucher + * + * @param \OpenAPI\Client\Model\Voucher|null $voucher voucher + * + * @return self + */ + public function setVoucher($voucher) + { + if (is_null($voucher)) { + throw new \InvalidArgumentException('non-nullable voucher cannot be null'); + } + $this->container['voucher'] = $voucher; + + return $this; + } + + /** + * Gets promotionTier + * + * @return \OpenAPI\Client\Model\PromotionTier|null + */ + public function getPromotionTier() + { + return $this->container['promotionTier']; + } + + /** + * Sets promotionTier + * + * @param \OpenAPI\Client\Model\PromotionTier|null $promotionTier promotionTier + * + * @return self + */ + public function setPromotionTier($promotionTier) + { + if (is_null($promotionTier)) { + throw new \InvalidArgumentException('non-nullable promotionTier cannot be null'); + } + $this->container['promotionTier'] = $promotionTier; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\RedemptionRewardResult|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\RedemptionRewardResult|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + throw new \InvalidArgumentException('non-nullable reward cannot be null'); + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + 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/RedemptionsRollbackCreateResponseBodyChannel.php b/src/Model/RedemptionsRollbackCreateResponseBodyChannel.php new file mode 100644 index 0000000..2284af3 --- /dev/null +++ b/src/Model/RedemptionsRollbackCreateResponseBodyChannel.php @@ -0,0 +1,493 @@ + + */ +class RedemptionsRollbackCreateResponseBodyChannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbackCreateResponseBodyChannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'channelId' => 'string', + 'channelType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'channelId' => null, + 'channelType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'channelId' => true, + 'channelType' => true + ]; + + /** + * 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 = [ + 'channelId' => 'channel_id', + 'channelType' => 'channel_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'channelId' => 'setChannelId', + 'channelType' => 'setChannelType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'channelId' => 'getChannelId', + 'channelType' => 'getChannelType' + ]; + + /** + * 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 CHANNEL_TYPE_USER = 'USER'; + public const CHANNEL_TYPE_API = 'API'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelTypeAllowableValues() + { + return [ + self::CHANNEL_TYPE_USER, + self::CHANNEL_TYPE_API, + ]; + } + + /** + * 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('channelId', $data ?? [], null); + $this->setIfExists('channelType', $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->getChannelTypeAllowableValues(); + if (!is_null($this->container['channelType']) && !in_array($this->container['channelType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channelType', must be one of '%s'", + $this->container['channelType'], + 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 channelId + * + * @return string|null + */ + public function getChannelId() + { + return $this->container['channelId']; + } + + /** + * Sets channelId + * + * @param string|null $channelId Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. + * + * @return self + */ + public function setChannelId($channelId) + { + if (is_null($channelId)) { + array_push($this->openAPINullablesSetToNull, 'channelId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channelId'] = $channelId; + + return $this; + } + + /** + * Gets channelType + * + * @return string|null + */ + public function getChannelType() + { + return $this->container['channelType']; + } + + /** + * Sets channelType + * + * @param string|null $channelType The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. + * + * @return self + */ + public function setChannelType($channelType) + { + if (is_null($channelType)) { + array_push($this->openAPINullablesSetToNull, 'channelType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channelType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getChannelTypeAllowableValues(); + if (!is_null($channelType) && !in_array($channelType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channelType', must be one of '%s'", + $channelType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channelType'] = $channelType; + + 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/RedemptionsRollbackCreateResponseBodyGift.php b/src/Model/RedemptionsRollbackCreateResponseBodyGift.php new file mode 100644 index 0000000..9b0e125 --- /dev/null +++ b/src/Model/RedemptionsRollbackCreateResponseBodyGift.php @@ -0,0 +1,418 @@ + + */ +class RedemptionsRollbackCreateResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbackCreateResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount' + ]; + + /** + * 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('amount', $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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + 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/RedemptionsRollbackCreateResponseBodyLoyaltyCard.php b/src/Model/RedemptionsRollbackCreateResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..ea78197 --- /dev/null +++ b/src/Model/RedemptionsRollbackCreateResponseBodyLoyaltyCard.php @@ -0,0 +1,418 @@ + + */ +class RedemptionsRollbackCreateResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbackCreateResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.php b/src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.php new file mode 100644 index 0000000..9e9733a --- /dev/null +++ b/src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.php @@ -0,0 +1,458 @@ + + */ +class RedemptionsRollbackCreateResponseBodyRelatedRedemptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbackCreateResponseBodyRelatedRedemptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rollbacks' => '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem[]', + 'redemptions' => '\OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rollbacks' => null, + 'redemptions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rollbacks' => true, + 'redemptions' => true + ]; + + /** + * 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 = [ + 'rollbacks' => 'rollbacks', + 'redemptions' => 'redemptions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rollbacks' => 'setRollbacks', + 'redemptions' => 'setRedemptions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rollbacks' => 'getRollbacks', + 'redemptions' => 'getRedemptions' + ]; + + /** + * 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('rollbacks', $data ?? [], null); + $this->setIfExists('redemptions', $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 rollbacks + * + * @return \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem[]|null + */ + public function getRollbacks() + { + return $this->container['rollbacks']; + } + + /** + * Sets rollbacks + * + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem[]|null $rollbacks rollbacks + * + * @return self + */ + public function setRollbacks($rollbacks) + { + if (is_null($rollbacks)) { + array_push($this->openAPINullablesSetToNull, 'rollbacks'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbacks', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbacks'] = $rollbacks; + + return $this; + } + + /** + * Gets redemptions + * + * @return \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem[]|null + */ + public function getRedemptions() + { + return $this->container['redemptions']; + } + + /** + * Sets redemptions + * + * @param \OpenAPI\Client\Model\RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem[]|null $redemptions redemptions + * + * @return self + */ + public function setRedemptions($redemptions) + { + if (is_null($redemptions)) { + array_push($this->openAPINullablesSetToNull, 'redemptions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemptions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemptions'] = $redemptions; + + 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/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.php b/src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.php new file mode 100644 index 0000000..1e2a49d --- /dev/null +++ b/src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.php b/src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.php new file mode 100644 index 0000000..034e8d5 --- /dev/null +++ b/src/Model/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.php @@ -0,0 +1,444 @@ + + */ +class RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'date' => 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 = [ + 'id' => 'id', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'date' => 'getDate' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('date', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of the redemption rollback. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/RedemptionsRollbacksCreateRequestBody.php b/src/Model/RedemptionsRollbacksCreateRequestBody.php new file mode 100644 index 0000000..eaad85b --- /dev/null +++ b/src/Model/RedemptionsRollbacksCreateRequestBody.php @@ -0,0 +1,568 @@ + + */ +class RedemptionsRollbacksCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbacksCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reason' => 'string', + 'trackingId' => 'string', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'order' => '\OpenAPI\Client\Model\Order', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reason' => null, + 'trackingId' => null, + 'customer' => null, + 'order' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reason' => true, + 'trackingId' => true, + 'customer' => false, + 'order' => false, + 'metadata' => true + ]; + + /** + * 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 = [ + 'reason' => 'reason', + 'trackingId' => 'tracking_id', + 'customer' => 'customer', + 'order' => 'order', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reason' => 'setReason', + 'trackingId' => 'setTrackingId', + 'customer' => 'setCustomer', + 'order' => 'setOrder', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reason' => 'getReason', + 'trackingId' => 'getTrackingId', + 'customer' => 'getCustomer', + 'order' => 'getOrder', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('reason', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('metadata', $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 reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason Reason for the rollback. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Customer's `source_id`. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can send in the request body to update **redemption** metadata. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/RedemptionsRollbacksCreateResponseBody.php b/src/Model/RedemptionsRollbacksCreateResponseBody.php new file mode 100644 index 0000000..51f3be7 --- /dev/null +++ b/src/Model/RedemptionsRollbacksCreateResponseBody.php @@ -0,0 +1,486 @@ + + */ +class RedemptionsRollbacksCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RedemptionsRollbacksCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rollbacks' => '\OpenAPI\Client\Model\RedemptionRollback[]', + 'parentRollback' => '\OpenAPI\Client\Model\RedemptionRollback', + 'order' => '\OpenAPI\Client\Model\OrderCalculated' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rollbacks' => null, + 'parentRollback' => null, + 'order' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'rollbacks' => true, + 'parentRollback' => false, + 'order' => 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 = [ + 'rollbacks' => 'rollbacks', + 'parentRollback' => 'parent_rollback', + 'order' => 'order' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rollbacks' => 'setRollbacks', + 'parentRollback' => 'setParentRollback', + 'order' => 'setOrder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rollbacks' => 'getRollbacks', + 'parentRollback' => 'getParentRollback', + 'order' => 'getOrder' + ]; + + /** + * 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('rollbacks', $data ?? [], null); + $this->setIfExists('parentRollback', $data ?? [], null); + $this->setIfExists('order', $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 rollbacks + * + * @return \OpenAPI\Client\Model\RedemptionRollback[]|null + */ + public function getRollbacks() + { + return $this->container['rollbacks']; + } + + /** + * Sets rollbacks + * + * @param \OpenAPI\Client\Model\RedemptionRollback[]|null $rollbacks Contains the rollback redemption objects of the particular incentives. + * + * @return self + */ + public function setRollbacks($rollbacks) + { + if (is_null($rollbacks)) { + array_push($this->openAPINullablesSetToNull, 'rollbacks'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollbacks', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollbacks'] = $rollbacks; + + return $this; + } + + /** + * Gets parentRollback + * + * @return \OpenAPI\Client\Model\RedemptionRollback|null + */ + public function getParentRollback() + { + return $this->container['parentRollback']; + } + + /** + * Sets parentRollback + * + * @param \OpenAPI\Client\Model\RedemptionRollback|null $parentRollback parentRollback + * + * @return self + */ + public function setParentRollback($parentRollback) + { + if (is_null($parentRollback)) { + throw new \InvalidArgumentException('non-nullable parentRollback cannot be null'); + } + $this->container['parentRollback'] = $parentRollback; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + 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/ReferralProgram.php b/src/Model/ReferralProgram.php new file mode 100644 index 0000000..0b56727 --- /dev/null +++ b/src/Model/ReferralProgram.php @@ -0,0 +1,534 @@ + + */ +class ReferralProgram implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReferralProgram'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conversionEventType' => 'string', + 'customEvent' => '\OpenAPI\Client\Model\ReferralProgramCustomEvent', + 'refereeReward' => '\OpenAPI\Client\Model\ReferralProgramRefereeReward' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conversionEventType' => null, + 'customEvent' => null, + 'refereeReward' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conversionEventType' => true, + 'customEvent' => true, + 'refereeReward' => true + ]; + + /** + * 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 = [ + 'conversionEventType' => 'conversion_event_type', + 'customEvent' => 'custom_event', + 'refereeReward' => 'referee_reward' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conversionEventType' => 'setConversionEventType', + 'customEvent' => 'setCustomEvent', + 'refereeReward' => 'setRefereeReward' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conversionEventType' => 'getConversionEventType', + 'customEvent' => 'getCustomEvent', + 'refereeReward' => 'getRefereeReward' + ]; + + /** + * 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 CONVERSION_EVENT_TYPE_REDEMPTION = 'redemption'; + public const CONVERSION_EVENT_TYPE_CUSTOM_EVENT = 'custom_event'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getConversionEventTypeAllowableValues() + { + return [ + self::CONVERSION_EVENT_TYPE_REDEMPTION, + self::CONVERSION_EVENT_TYPE_CUSTOM_EVENT, + ]; + } + + /** + * 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('conversionEventType', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('refereeReward', $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->getConversionEventTypeAllowableValues(); + if (!is_null($this->container['conversionEventType']) && !in_array($this->container['conversionEventType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'conversionEventType', must be one of '%s'", + $this->container['conversionEventType'], + 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 conversionEventType + * + * @return string|null + */ + public function getConversionEventType() + { + return $this->container['conversionEventType']; + } + + /** + * Sets conversionEventType + * + * @param string|null $conversionEventType Define how a referral is triggered. + * + * @return self + */ + public function setConversionEventType($conversionEventType) + { + if (is_null($conversionEventType)) { + array_push($this->openAPINullablesSetToNull, 'conversionEventType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conversionEventType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getConversionEventTypeAllowableValues(); + if (!is_null($conversionEventType) && !in_array($conversionEventType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'conversionEventType', must be one of '%s'", + $conversionEventType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['conversionEventType'] = $conversionEventType; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\ReferralProgramCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\ReferralProgramCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets refereeReward + * + * @return \OpenAPI\Client\Model\ReferralProgramRefereeReward|null + */ + public function getRefereeReward() + { + return $this->container['refereeReward']; + } + + /** + * Sets refereeReward + * + * @param \OpenAPI\Client\Model\ReferralProgramRefereeReward|null $refereeReward refereeReward + * + * @return self + */ + public function setRefereeReward($refereeReward) + { + if (is_null($refereeReward)) { + array_push($this->openAPINullablesSetToNull, 'refereeReward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('refereeReward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['refereeReward'] = $refereeReward; + + 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/ReferralProgramCustomEvent.php b/src/Model/ReferralProgramCustomEvent.php new file mode 100644 index 0000000..58f827a --- /dev/null +++ b/src/Model/ReferralProgramCustomEvent.php @@ -0,0 +1,459 @@ + + */ +class ReferralProgramCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReferralProgramCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique custom event ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Custom event name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/ReferralProgramRefereeReward.php b/src/Model/ReferralProgramRefereeReward.php new file mode 100644 index 0000000..3868c9d --- /dev/null +++ b/src/Model/ReferralProgramRefereeReward.php @@ -0,0 +1,538 @@ + + */ +class ReferralProgramRefereeReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReferralProgramRefereeReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'relatedObjectParent' => '\OpenAPI\Client\Model\ReferralProgramRefereeRewardRelatedObjectParent', + 'type' => 'string', + 'amount' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'relatedObjectParent' => null, + 'type' => null, + 'amount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'relatedObjectParent' => true, + 'type' => true, + 'amount' => true + ]; + + /** + * 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 = [ + 'relatedObjectParent' => 'related_object_parent', + 'type' => 'type', + 'amount' => 'amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'relatedObjectParent' => 'setRelatedObjectParent', + 'type' => 'setType', + 'amount' => 'setAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'relatedObjectParent' => 'getRelatedObjectParent', + 'type' => 'getType', + 'amount' => 'getAmount' + ]; + + /** + * 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 TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_LUCKY_DRAW_CODE = 'LUCKY_DRAW_CODE'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + self::TYPE_GIFT_VOUCHER, + self::TYPE_LUCKY_DRAW_CODE, + ]; + } + + /** + * 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('relatedObjectParent', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('amount', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 relatedObjectParent + * + * @return \OpenAPI\Client\Model\ReferralProgramRefereeRewardRelatedObjectParent|null + */ + public function getRelatedObjectParent() + { + return $this->container['relatedObjectParent']; + } + + /** + * Sets relatedObjectParent + * + * @param \OpenAPI\Client\Model\ReferralProgramRefereeRewardRelatedObjectParent|null $relatedObjectParent relatedObjectParent + * + * @return self + */ + public function setRelatedObjectParent($relatedObjectParent) + { + if (is_null($relatedObjectParent)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectParent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectParent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectParent'] = $relatedObjectParent; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of reward. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets amount + * + * @return string|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param string|null $amount Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + 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/ReferralProgramRefereeRewardRelatedObjectParent.php b/src/Model/ReferralProgramRefereeRewardRelatedObjectParent.php new file mode 100644 index 0000000..1bd39be --- /dev/null +++ b/src/Model/ReferralProgramRefereeRewardRelatedObjectParent.php @@ -0,0 +1,532 @@ + + */ +class ReferralProgramRefereeRewardRelatedObjectParent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReferralProgramRefereeRewardRelatedObjectParent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CAMPAIGN = 'CAMPAIGN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'CAMPAIGN'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique ID of the reward source. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Name of the reward source. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Type of resource represented by the source of the reward. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/Referrer.php b/src/Model/Referrer.php new file mode 100644 index 0000000..7f3b5aa --- /dev/null +++ b/src/Model/Referrer.php @@ -0,0 +1,786 @@ + + */ +class Referrer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Referrer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'description' => 'string', + 'email' => 'string', + 'phone' => 'string', + 'birthday' => '\DateTime', + 'birthdate' => '\DateTime', + 'address' => '\OpenAPI\Client\Model\ReferrerAddress', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'description' => null, + 'email' => null, + 'phone' => null, + 'birthday' => 'date', + 'birthdate' => 'date', + 'address' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'description' => true, + 'email' => true, + 'phone' => true, + 'birthday' => true, + 'birthdate' => true, + 'address' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'description' => 'description', + 'email' => 'email', + 'phone' => 'phone', + 'birthday' => 'birthday', + 'birthdate' => 'birthdate', + 'address' => 'address', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'description' => 'setDescription', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'birthday' => 'setBirthday', + 'birthdate' => 'setBirthdate', + 'address' => 'setAddress', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'description' => 'getDescription', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'birthday' => 'getBirthday', + 'birthdate' => 'getBirthdate', + 'address' => 'getAddress', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('birthday', $data ?? [], null); + $this->setIfExists('birthdate', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('metadata', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The ID of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a customer object. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. + * + * @return self + */ + public function setPhone($phone) + { + if (is_null($phone)) { + array_push($this->openAPINullablesSetToNull, 'phone'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('phone', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets birthday + * + * @return \DateTime|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param \DateTime|null $birthday `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. + * + * @return self + */ + public function setBirthday($birthday) + { + if (is_null($birthday)) { + array_push($this->openAPINullablesSetToNull, 'birthday'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthday', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets birthdate + * + * @return \DateTime|null + */ + public function getBirthdate() + { + return $this->container['birthdate']; + } + + /** + * Sets birthdate + * + * @param \DateTime|null $birthdate Customer's birthdate; format YYYY-MM-DD. + * + * @return self + */ + public function setBirthdate($birthdate) + { + if (is_null($birthdate)) { + array_push($this->openAPINullablesSetToNull, 'birthdate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('birthdate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['birthdate'] = $birthdate; + + return $this; + } + + /** + * Gets address + * + * @return \OpenAPI\Client\Model\ReferrerAddress|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \OpenAPI\Client\Model\ReferrerAddress|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + array_push($this->openAPINullablesSetToNull, 'address'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('address', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ReferrerAddress.php b/src/Model/ReferrerAddress.php new file mode 100644 index 0000000..407656e --- /dev/null +++ b/src/Model/ReferrerAddress.php @@ -0,0 +1,623 @@ + + */ +class ReferrerAddress implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReferrerAddress'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'city' => 'string', + 'state' => 'string', + 'line1' => 'string', + 'line2' => 'string', + 'country' => 'string', + 'postalCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'city' => null, + 'state' => null, + 'line1' => null, + 'line2' => null, + 'country' => null, + 'postalCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'city' => true, + 'state' => true, + 'line1' => true, + 'line2' => true, + 'country' => true, + 'postalCode' => true + ]; + + /** + * 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 = [ + 'city' => 'city', + 'state' => 'state', + 'line1' => 'line_1', + 'line2' => 'line_2', + 'country' => 'country', + 'postalCode' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'city' => 'setCity', + 'state' => 'setState', + 'line1' => 'setLine1', + 'line2' => 'setLine2', + 'country' => 'setCountry', + 'postalCode' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'city' => 'getCity', + 'state' => 'getState', + 'line1' => 'getLine1', + 'line2' => 'getLine2', + 'country' => 'getCountry', + 'postalCode' => 'getPostalCode' + ]; + + /** + * 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('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('line1', $data ?? [], null); + $this->setIfExists('line2', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('postalCode', $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 city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + array_push($this->openAPINullablesSetToNull, 'city'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('city', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets line1 + * + * @return string|null + */ + public function getLine1() + { + return $this->container['line1']; + } + + /** + * Sets line1 + * + * @param string|null $line1 First line of address. + * + * @return self + */ + public function setLine1($line1) + { + if (is_null($line1)) { + array_push($this->openAPINullablesSetToNull, 'line1'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line1', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line1'] = $line1; + + return $this; + } + + /** + * Gets line2 + * + * @return string|null + */ + public function getLine2() + { + return $this->container['line2']; + } + + /** + * Sets line2 + * + * @param string|null $line2 Second line of address. + * + * @return self + */ + public function setLine2($line2) + { + if (is_null($line2)) { + array_push($this->openAPINullablesSetToNull, 'line2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('line2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['line2'] = $line2; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country. + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + array_push($this->openAPINullablesSetToNull, 'country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets postalCode + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postalCode']; + } + + /** + * Sets postalCode + * + * @param string|null $postalCode Postal code. + * + * @return self + */ + public function setPostalCode($postalCode) + { + if (is_null($postalCode)) { + array_push($this->openAPINullablesSetToNull, 'postalCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('postalCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['postalCode'] = $postalCode; + + 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/ReferrerId.php b/src/Model/ReferrerId.php new file mode 100644 index 0000000..5801a80 --- /dev/null +++ b/src/Model/ReferrerId.php @@ -0,0 +1,490 @@ + + */ +class ReferrerId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReferrerId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier of an existing customer. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/Reward.php b/src/Model/Reward.php new file mode 100644 index 0000000..603337b --- /dev/null +++ b/src/Model/Reward.php @@ -0,0 +1,884 @@ + + */ +class Reward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Reward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'stock' => 'int', + 'redeemed' => 'int', + 'attributes' => '\OpenAPI\Client\Model\RewardAttributes', + 'metadata' => 'object', + 'type' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardType', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'stock' => null, + 'redeemed' => null, + 'attributes' => null, + 'metadata' => null, + 'type' => null, + 'parameters' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'stock' => true, + 'redeemed' => true, + 'attributes' => true, + 'metadata' => true, + 'type' => true, + 'parameters' => false, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'stock' => 'stock', + 'redeemed' => 'redeemed', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'type' => 'type', + 'parameters' => 'parameters', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'stock' => 'setStock', + 'redeemed' => 'setRedeemed', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'type' => 'setType', + 'parameters' => 'setParameters', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'stock' => 'getStock', + 'redeemed' => 'getRedeemed', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'type' => 'getType', + 'parameters' => 'getParameters', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_CAMPAIGN = 'CAMPAIGN'; + public const TYPE_COIN = 'COIN'; + public const TYPE_MATERIAL = 'MATERIAL'; + public const OBJECT_REWARD = 'reward'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_CAMPAIGN, + self::TYPE_COIN, + self::TYPE_MATERIAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('stock', $data ?? [], null); + $this->setIfExists('redeemed', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Reward name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets stock + * + * @return int|null + */ + public function getStock() + { + return $this->container['stock']; + } + + /** + * Sets stock + * + * @param int|null $stock Configurable for **material rewards**. The number of units of the product that you want to share as reward. + * + * @return self + */ + public function setStock($stock) + { + if (is_null($stock)) { + array_push($this->openAPINullablesSetToNull, 'stock'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stock', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['stock'] = $stock; + + return $this; + } + + /** + * Gets redeemed + * + * @return int|null + */ + public function getRedeemed() + { + return $this->container['redeemed']; + } + + /** + * Sets redeemed + * + * @param int|null $redeemed Defines the number of already invoked (successful) reward redemptions. + * + * @return self + */ + public function setRedeemed($redeemed) + { + if (is_null($redeemed)) { + array_push($this->openAPINullablesSetToNull, 'redeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemed'] = $redeemed; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\RewardAttributes|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\RewardAttributes|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Reward type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardType|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardType|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object The type of the object represented by the JSON. This object stores information about the reward. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RewardAssignment.php b/src/Model/RewardAssignment.php new file mode 100644 index 0000000..0401e05 --- /dev/null +++ b/src/Model/RewardAssignment.php @@ -0,0 +1,768 @@ + + */ +class RewardAssignment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardAssignment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardAssignmentParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'rewardId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'rewardId' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'rewardId' => 'reward_id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward_assignment'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'campaign'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward assignment ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId() + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Associated reward ID. + * + * @return self + */ + public function setRewardId($rewardId) + { + if (is_null($rewardId)) { + array_push($this->openAPINullablesSetToNull, 'rewardId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewardId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the reward assignment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Related object ID to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Related object type to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardAssignmentParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardAssignmentParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/RewardAssignmentParameters.php b/src/Model/RewardAssignmentParameters.php new file mode 100644 index 0000000..bdf9246 --- /dev/null +++ b/src/Model/RewardAssignmentParameters.php @@ -0,0 +1,418 @@ + + */ +class RewardAssignmentParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardAssignmentParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\RewardAssignmentParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\RewardAssignmentParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\RewardAssignmentParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/RewardAssignmentParametersLoyalty.php b/src/Model/RewardAssignmentParametersLoyalty.php new file mode 100644 index 0000000..4271c9f --- /dev/null +++ b/src/Model/RewardAssignmentParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class RewardAssignmentParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardAssignmentParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of points required to redeem the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RewardAttributes.php b/src/Model/RewardAttributes.php new file mode 100644 index 0000000..93bf746 --- /dev/null +++ b/src/Model/RewardAttributes.php @@ -0,0 +1,459 @@ + + */ +class RewardAttributes implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardAttributes'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'imageUrl' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'imageUrl' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'imageUrl' => true, + 'description' => true + ]; + + /** + * 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 = [ + 'imageUrl' => 'image_url', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'imageUrl' => 'setImageUrl', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'imageUrl' => 'getImageUrl', + 'description' => 'getDescription' + ]; + + /** + * 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('imageUrl', $data ?? [], null); + $this->setIfExists('description', $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 imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a material reward. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + 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/RewardType.php b/src/Model/RewardType.php new file mode 100644 index 0000000..dc4d52b --- /dev/null +++ b/src/Model/RewardType.php @@ -0,0 +1,499 @@ + + */ +class RewardType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'campaign' => '\OpenAPI\Client\Model\RewardTypeCampaign', + 'coin' => '\OpenAPI\Client\Model\RewardTypeCoin', + 'product' => '\OpenAPI\Client\Model\RewardTypeProduct' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'campaign' => null, + 'coin' => null, + 'product' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'campaign' => true, + 'coin' => true, + 'product' => true + ]; + + /** + * 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 = [ + 'campaign' => 'campaign', + 'coin' => 'coin', + 'product' => 'product' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'campaign' => 'setCampaign', + 'coin' => 'setCoin', + 'product' => 'setProduct' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'campaign' => 'getCampaign', + 'coin' => 'getCoin', + 'product' => 'getProduct' + ]; + + /** + * 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('campaign', $data ?? [], null); + $this->setIfExists('coin', $data ?? [], null); + $this->setIfExists('product', $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 campaign + * + * @return \OpenAPI\Client\Model\RewardTypeCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\RewardTypeCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets coin + * + * @return \OpenAPI\Client\Model\RewardTypeCoin|null + */ + public function getCoin() + { + return $this->container['coin']; + } + + /** + * Sets coin + * + * @param \OpenAPI\Client\Model\RewardTypeCoin|null $coin coin + * + * @return self + */ + public function setCoin($coin) + { + if (is_null($coin)) { + array_push($this->openAPINullablesSetToNull, 'coin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('coin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['coin'] = $coin; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\RewardTypeProduct|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\RewardTypeProduct|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + array_push($this->openAPINullablesSetToNull, 'product'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product'] = $product; + + 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/RewardTypeCampaign.php b/src/Model/RewardTypeCampaign.php new file mode 100644 index 0000000..6716a7c --- /dev/null +++ b/src/Model/RewardTypeCampaign.php @@ -0,0 +1,536 @@ + + */ +class RewardTypeCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardTypeCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'balance' => 'int', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'balance' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'balance' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'balance' => 'balance', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'balance' => 'setBalance', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'balance' => 'getBalance', + 'type' => 'getType' + ]; + + /** + * 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 TYPE_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; + public const TYPE_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; + public const TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_DISCOUNT_COUPONS, + self::TYPE_GIFT_VOUCHERS, + self::TYPE_LOYALTY_PROGRAM, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('type', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique campaign ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance The number of points to be added to a loyalty card or the amount to be added to the current balance on the gift card. For gift cards, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Campaign type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + 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/RewardTypeCoin.php b/src/Model/RewardTypeCoin.php new file mode 100644 index 0000000..7e7474c --- /dev/null +++ b/src/Model/RewardTypeCoin.php @@ -0,0 +1,459 @@ + + */ +class RewardTypeCoin implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardTypeCoin'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exchangeRatio' => 'float', + 'pointsRatio' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exchangeRatio' => null, + 'pointsRatio' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'exchangeRatio' => true, + 'pointsRatio' => true + ]; + + /** + * 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 = [ + 'exchangeRatio' => 'exchange_ratio', + 'pointsRatio' => 'points_ratio' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exchangeRatio' => 'setExchangeRatio', + 'pointsRatio' => 'setPointsRatio' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exchangeRatio' => 'getExchangeRatio', + 'pointsRatio' => 'getPointsRatio' + ]; + + /** + * 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('exchangeRatio', $data ?? [], null); + $this->setIfExists('pointsRatio', $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 exchangeRatio + * + * @return float|null + */ + public function getExchangeRatio() + { + return $this->container['exchangeRatio']; + } + + /** + * Sets exchangeRatio + * + * @param float|null $exchangeRatio The cash equivalent of the points defined in the points_ratio property. + * + * @return self + */ + public function setExchangeRatio($exchangeRatio) + { + if (is_null($exchangeRatio)) { + array_push($this->openAPINullablesSetToNull, 'exchangeRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exchangeRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['exchangeRatio'] = $exchangeRatio; + + return $this; + } + + /** + * Gets pointsRatio + * + * @return int|null + */ + public function getPointsRatio() + { + return $this->container['pointsRatio']; + } + + /** + * Sets pointsRatio + * + * @param int|null $pointsRatio The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. + * + * @return self + */ + public function setPointsRatio($pointsRatio) + { + if (is_null($pointsRatio)) { + array_push($this->openAPINullablesSetToNull, 'pointsRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pointsRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pointsRatio'] = $pointsRatio; + + 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/RewardTypeProduct.php b/src/Model/RewardTypeProduct.php new file mode 100644 index 0000000..720b226 --- /dev/null +++ b/src/Model/RewardTypeProduct.php @@ -0,0 +1,459 @@ + + */ +class RewardTypeProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardTypeProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'skuId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'skuId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'skuId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'skuId' => 'sku_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'skuId' => 'setSkuId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'skuId' => 'getSkuId' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('skuId', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets skuId + * + * @return string|null + */ + public function getSkuId() + { + return $this->container['skuId']; + } + + /** + * Sets skuId + * + * @param string|null $skuId Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. + * + * @return self + */ + public function setSkuId($skuId) + { + if (is_null($skuId)) { + array_push($this->openAPINullablesSetToNull, 'skuId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skuId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skuId'] = $skuId; + + 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/RewardsAssignmentsCreateRequestBody.php b/src/Model/RewardsAssignmentsCreateRequestBody.php new file mode 100644 index 0000000..5707039 --- /dev/null +++ b/src/Model/RewardsAssignmentsCreateRequestBody.php @@ -0,0 +1,499 @@ + + */ +class RewardsAssignmentsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'campaign' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBodyParameters', + 'validationRules' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'campaign' => null, + 'parameters' => null, + 'validationRules' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'campaign' => true, + 'parameters' => true, + 'validationRules' => true + ]; + + /** + * 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 = [ + 'campaign' => 'campaign', + 'parameters' => 'parameters', + 'validationRules' => 'validation_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'campaign' => 'setCampaign', + 'parameters' => 'setParameters', + 'validationRules' => 'setValidationRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'campaign' => 'getCampaign', + 'parameters' => 'getParameters', + 'validationRules' => 'getValidationRules' + ]; + + /** + * 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('campaign', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('validationRules', $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 campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign The campaign ID of the campaign to which the reward is to be assigned. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets validationRules + * + * @return string[]|null + */ + public function getValidationRules() + { + return $this->container['validationRules']; + } + + /** + * Sets validationRules + * + * @param string[]|null $validationRules validationRules + * + * @return self + */ + public function setValidationRules($validationRules) + { + if (is_null($validationRules)) { + array_push($this->openAPINullablesSetToNull, 'validationRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRules'] = $validationRules; + + 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/RewardsAssignmentsCreateRequestBodyParameters.php b/src/Model/RewardsAssignmentsCreateRequestBodyParameters.php new file mode 100644 index 0000000..8892e2f --- /dev/null +++ b/src/Model/RewardsAssignmentsCreateRequestBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsCreateRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsCreateRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateRequestBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/RewardsAssignmentsCreateRequestBodyParametersLoyalty.php b/src/Model/RewardsAssignmentsCreateRequestBodyParametersLoyalty.php new file mode 100644 index 0000000..9363ef3 --- /dev/null +++ b/src/Model/RewardsAssignmentsCreateRequestBodyParametersLoyalty.php @@ -0,0 +1,427 @@ + + */ +class RewardsAssignmentsCreateRequestBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsCreateRequestBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 = []; + + if (!is_null($this->container['points']) && ($this->container['points'] < 1)) { + $invalidProperties[] = "invalid value for 'points', must be bigger than or equal to 1."; + } + + 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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. Must be positive integer. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($points) && ($points < 1)) { + throw new \InvalidArgumentException('invalid value for $points when calling RewardsAssignmentsCreateRequestBodyParametersLoyalty., must be bigger than or equal to 1.'); + } + + $this->container['points'] = $points; + + 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/RewardsAssignmentsCreateResponseBody.php b/src/Model/RewardsAssignmentsCreateResponseBody.php new file mode 100644 index 0000000..8774ee9 --- /dev/null +++ b/src/Model/RewardsAssignmentsCreateResponseBody.php @@ -0,0 +1,769 @@ + + */ +class RewardsAssignmentsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'rewardId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'rewardId' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'rewardId' => 'reward_id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward_assignment'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'campaign'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward assignment ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId() + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Associated reward ID. + * + * @return self + */ + public function setRewardId($rewardId) + { + if (is_null($rewardId)) { + array_push($this->openAPINullablesSetToNull, 'rewardId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewardId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the reward assignment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Related object ID to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Related object type to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/RewardsAssignmentsCreateResponseBodyParameters.php b/src/Model/RewardsAssignmentsCreateResponseBodyParameters.php new file mode 100644 index 0000000..41d8a52 --- /dev/null +++ b/src/Model/RewardsAssignmentsCreateResponseBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsCreateResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsCreateResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsCreateResponseBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/RewardsAssignmentsCreateResponseBodyParametersLoyalty.php b/src/Model/RewardsAssignmentsCreateResponseBodyParametersLoyalty.php new file mode 100644 index 0000000..8ace2d7 --- /dev/null +++ b/src/Model/RewardsAssignmentsCreateResponseBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsCreateResponseBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsCreateResponseBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of points required to redeem the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RewardsAssignmentsGetResponseBody.php b/src/Model/RewardsAssignmentsGetResponseBody.php new file mode 100644 index 0000000..4a0a4f0 --- /dev/null +++ b/src/Model/RewardsAssignmentsGetResponseBody.php @@ -0,0 +1,769 @@ + + */ +class RewardsAssignmentsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'rewardId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'rewardId' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'rewardId' => 'reward_id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward_assignment'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'campaign'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward assignment ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId() + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Associated reward ID. + * + * @return self + */ + public function setRewardId($rewardId) + { + if (is_null($rewardId)) { + array_push($this->openAPINullablesSetToNull, 'rewardId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewardId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the reward assignment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Related object ID to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Related object type to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsGetResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsGetResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/RewardsAssignmentsGetResponseBodyParameters.php b/src/Model/RewardsAssignmentsGetResponseBodyParameters.php new file mode 100644 index 0000000..e4950b1 --- /dev/null +++ b/src/Model/RewardsAssignmentsGetResponseBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsGetResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsGetResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\RewardsAssignmentsGetResponseBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsGetResponseBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsGetResponseBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/RewardsAssignmentsGetResponseBodyParametersLoyalty.php b/src/Model/RewardsAssignmentsGetResponseBodyParametersLoyalty.php new file mode 100644 index 0000000..9b3fd7e --- /dev/null +++ b/src/Model/RewardsAssignmentsGetResponseBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsGetResponseBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsGetResponseBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of points required to redeem the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RewardsAssignmentsListResponseBody.php b/src/Model/RewardsAssignmentsListResponseBody.php new file mode 100644 index 0000000..2ee0b8c --- /dev/null +++ b/src/Model/RewardsAssignmentsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class RewardsAssignmentsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\RewardAssignment[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about reward assignments in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of reward assignments. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\RewardAssignment[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\RewardAssignment[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of reward assignments. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/RewardsAssignmentsUpdateRequestBody.php b/src/Model/RewardsAssignmentsUpdateRequestBody.php new file mode 100644 index 0000000..9ac4170 --- /dev/null +++ b/src/Model/RewardsAssignmentsUpdateRequestBody.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'parameters' => '\OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'parameters' => true + ]; + + /** + * 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 = [ + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'parameters' => 'getParameters' + ]; + + /** + * 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('parameters', $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 parameters + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/RewardsAssignmentsUpdateRequestBodyParameters.php b/src/Model/RewardsAssignmentsUpdateRequestBodyParameters.php new file mode 100644 index 0000000..8d03974 --- /dev/null +++ b/src/Model/RewardsAssignmentsUpdateRequestBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsUpdateRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsUpdateRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateRequestBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.php b/src/Model/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.php new file mode 100644 index 0000000..a38cd7d --- /dev/null +++ b/src/Model/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsUpdateRequestBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsUpdateRequestBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Defines how many points are required to obtain the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RewardsAssignmentsUpdateResponseBody.php b/src/Model/RewardsAssignmentsUpdateResponseBody.php new file mode 100644 index 0000000..3426e33 --- /dev/null +++ b/src/Model/RewardsAssignmentsUpdateResponseBody.php @@ -0,0 +1,769 @@ + + */ +class RewardsAssignmentsUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'rewardId' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBodyParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'rewardId' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'rewardId' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'parameters' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'rewardId' => 'reward_id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'rewardId' => 'setRewardId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'rewardId' => 'getRewardId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'parameters' => 'getParameters' + ]; + + /** + * 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 OBJECT_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD_ASSIGNMENT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_CAMPAIGN, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('rewardId', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward_assignment'); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], 'campaign'); + $this->setIfExists('parameters', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward assignment ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rewardId + * + * @return string|null + */ + public function getRewardId() + { + return $this->container['rewardId']; + } + + /** + * Sets rewardId + * + * @param string|null $rewardId Associated reward ID. + * + * @return self + */ + public function setRewardId($rewardId) + { + if (is_null($rewardId)) { + array_push($this->openAPINullablesSetToNull, 'rewardId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rewardId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rewardId'] = $rewardId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the reward assignment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Related object ID to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Related object type to which the reward was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + 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/RewardsAssignmentsUpdateResponseBodyParameters.php b/src/Model/RewardsAssignmentsUpdateResponseBodyParameters.php new file mode 100644 index 0000000..b959b4e --- /dev/null +++ b/src/Model/RewardsAssignmentsUpdateResponseBodyParameters.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsUpdateResponseBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsUpdateResponseBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'loyalty' => '\OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBodyParametersLoyalty' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'loyalty' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'loyalty' => true + ]; + + /** + * 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 = [ + 'loyalty' => 'loyalty' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'loyalty' => 'setLoyalty' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'loyalty' => 'getLoyalty' + ]; + + /** + * 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('loyalty', $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 loyalty + * + * @return \OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBodyParametersLoyalty|null + */ + public function getLoyalty() + { + return $this->container['loyalty']; + } + + /** + * Sets loyalty + * + * @param \OpenAPI\Client\Model\RewardsAssignmentsUpdateResponseBodyParametersLoyalty|null $loyalty loyalty + * + * @return self + */ + public function setLoyalty($loyalty) + { + if (is_null($loyalty)) { + array_push($this->openAPINullablesSetToNull, 'loyalty'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyalty', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyalty'] = $loyalty; + + 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/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.php b/src/Model/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.php new file mode 100644 index 0000000..836c569 --- /dev/null +++ b/src/Model/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.php @@ -0,0 +1,418 @@ + + */ +class RewardsAssignmentsUpdateResponseBodyParametersLoyalty implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsAssignmentsUpdateResponseBodyParametersLoyalty'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of points required to redeem the reward. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/RewardsCreateRequestBody.php b/src/Model/RewardsCreateRequestBody.php new file mode 100644 index 0000000..0e2a344 --- /dev/null +++ b/src/Model/RewardsCreateRequestBody.php @@ -0,0 +1,581 @@ + + */ +class RewardsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardsCreateRequestBodyParameters', + 'metadata' => 'object', + 'stock' => 'int', + 'attributes' => '\OpenAPI\Client\Model\RewardsCreateRequestBodyAttributes' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'parameters' => null, + 'metadata' => null, + 'stock' => null, + 'attributes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'parameters' => true, + 'metadata' => true, + 'stock' => true, + 'attributes' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'parameters' => 'parameters', + 'metadata' => 'metadata', + 'stock' => 'stock', + 'attributes' => 'attributes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'parameters' => 'setParameters', + 'metadata' => 'setMetadata', + 'stock' => 'setStock', + 'attributes' => 'setAttributes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'parameters' => 'getParameters', + 'metadata' => 'getMetadata', + 'stock' => 'getStock', + 'attributes' => 'getAttributes' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('stock', $data ?? [], null); + $this->setIfExists('attributes', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Reward name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardsCreateRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets stock + * + * @return int|null + */ + public function getStock() + { + return $this->container['stock']; + } + + /** + * Sets stock + * + * @param int|null $stock The number of units of the product that you want to share as a reward. + * + * @return self + */ + public function setStock($stock) + { + if (is_null($stock)) { + array_push($this->openAPINullablesSetToNull, 'stock'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stock', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['stock'] = $stock; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\RewardsCreateRequestBodyAttributes|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBodyAttributes|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + 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/RewardsCreateRequestBodyAttributes.php b/src/Model/RewardsCreateRequestBodyAttributes.php new file mode 100644 index 0000000..0a04ba4 --- /dev/null +++ b/src/Model/RewardsCreateRequestBodyAttributes.php @@ -0,0 +1,459 @@ + + */ +class RewardsCreateRequestBodyAttributes implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsCreateRequestBodyAttributes'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'imageUrl' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'imageUrl' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'imageUrl' => true, + 'description' => true + ]; + + /** + * 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 = [ + 'imageUrl' => 'image_url', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'imageUrl' => 'setImageUrl', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'imageUrl' => 'getImageUrl', + 'description' => 'getDescription' + ]; + + /** + * 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('imageUrl', $data ?? [], null); + $this->setIfExists('description', $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 imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl HTTPS URL pointing to a .png or .jpg file. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description of a material reward. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + 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/RewardsCreateRequestBodyParameters.php b/src/Model/RewardsCreateRequestBodyParameters.php new file mode 100644 index 0000000..a2fd51c --- /dev/null +++ b/src/Model/RewardsCreateRequestBodyParameters.php @@ -0,0 +1,499 @@ + + */ +class RewardsCreateRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsCreateRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'campaign' => '\OpenAPI\Client\Model\RewardsCreateRequestBodyParametersCampaign', + 'product' => '\OpenAPI\Client\Model\RewardsCreateRequestBodyParametersProduct', + 'coin' => '\OpenAPI\Client\Model\RewardsCreateRequestBodyParametersCoin' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'campaign' => null, + 'product' => null, + 'coin' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'campaign' => true, + 'product' => true, + 'coin' => true + ]; + + /** + * 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 = [ + 'campaign' => 'campaign', + 'product' => 'product', + 'coin' => 'coin' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'campaign' => 'setCampaign', + 'product' => 'setProduct', + 'coin' => 'setCoin' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'campaign' => 'getCampaign', + 'product' => 'getProduct', + 'coin' => 'getCoin' + ]; + + /** + * 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('campaign', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('coin', $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 campaign + * + * @return \OpenAPI\Client\Model\RewardsCreateRequestBodyParametersCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBodyParametersCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\RewardsCreateRequestBodyParametersProduct|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBodyParametersProduct|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + array_push($this->openAPINullablesSetToNull, 'product'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets coin + * + * @return \OpenAPI\Client\Model\RewardsCreateRequestBodyParametersCoin|null + */ + public function getCoin() + { + return $this->container['coin']; + } + + /** + * Sets coin + * + * @param \OpenAPI\Client\Model\RewardsCreateRequestBodyParametersCoin|null $coin coin + * + * @return self + */ + public function setCoin($coin) + { + if (is_null($coin)) { + array_push($this->openAPINullablesSetToNull, 'coin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('coin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['coin'] = $coin; + + 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/RewardsCreateRequestBodyParametersCampaign.php b/src/Model/RewardsCreateRequestBodyParametersCampaign.php new file mode 100644 index 0000000..9fa386a --- /dev/null +++ b/src/Model/RewardsCreateRequestBodyParametersCampaign.php @@ -0,0 +1,458 @@ + + */ +class RewardsCreateRequestBodyParametersCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsCreateRequestBodyParametersCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'balance' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'balance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'balance' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'balance' => 'balance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'balance' => 'setBalance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'balance' => 'getBalance' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('balance', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance The incremental points to be added to the current balance on the loyalty card. and The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + 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/RewardsCreateRequestBodyParametersCoin.php b/src/Model/RewardsCreateRequestBodyParametersCoin.php new file mode 100644 index 0000000..730133c --- /dev/null +++ b/src/Model/RewardsCreateRequestBodyParametersCoin.php @@ -0,0 +1,459 @@ + + */ +class RewardsCreateRequestBodyParametersCoin implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsCreateRequestBodyParametersCoin'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exchangeRatio' => 'string', + 'pointsRatio' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exchangeRatio' => null, + 'pointsRatio' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'exchangeRatio' => true, + 'pointsRatio' => true + ]; + + /** + * 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 = [ + 'exchangeRatio' => 'exchange_ratio', + 'pointsRatio' => 'points_ratio' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exchangeRatio' => 'setExchangeRatio', + 'pointsRatio' => 'setPointsRatio' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exchangeRatio' => 'getExchangeRatio', + 'pointsRatio' => 'getPointsRatio' + ]; + + /** + * 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('exchangeRatio', $data ?? [], null); + $this->setIfExists('pointsRatio', $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 exchangeRatio + * + * @return string|null + */ + public function getExchangeRatio() + { + return $this->container['exchangeRatio']; + } + + /** + * Sets exchangeRatio + * + * @param string|null $exchangeRatio The cash equivalent of the points defined in the `points_ratio` property. + * + * @return self + */ + public function setExchangeRatio($exchangeRatio) + { + if (is_null($exchangeRatio)) { + array_push($this->openAPINullablesSetToNull, 'exchangeRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exchangeRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['exchangeRatio'] = $exchangeRatio; + + return $this; + } + + /** + * Gets pointsRatio + * + * @return string|null + */ + public function getPointsRatio() + { + return $this->container['pointsRatio']; + } + + /** + * Sets pointsRatio + * + * @param string|null $pointsRatio The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. + * + * @return self + */ + public function setPointsRatio($pointsRatio) + { + if (is_null($pointsRatio)) { + array_push($this->openAPINullablesSetToNull, 'pointsRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pointsRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pointsRatio'] = $pointsRatio; + + 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/RewardsCreateRequestBodyParametersProduct.php b/src/Model/RewardsCreateRequestBodyParametersProduct.php new file mode 100644 index 0000000..449cba7 --- /dev/null +++ b/src/Model/RewardsCreateRequestBodyParametersProduct.php @@ -0,0 +1,459 @@ + + */ +class RewardsCreateRequestBodyParametersProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsCreateRequestBodyParametersProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'skuId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'skuId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'skuId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'skuId' => 'sku_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'skuId' => 'setSkuId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'skuId' => 'getSkuId' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('skuId', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID, assigned by Voucherify, given as a reward. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets skuId + * + * @return string|null + */ + public function getSkuId() + { + return $this->container['skuId']; + } + + /** + * Sets skuId + * + * @param string|null $skuId Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. + * + * @return self + */ + public function setSkuId($skuId) + { + if (is_null($skuId)) { + array_push($this->openAPINullablesSetToNull, 'skuId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skuId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skuId'] = $skuId; + + 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/RewardsCreateResponseBody.php b/src/Model/RewardsCreateResponseBody.php new file mode 100644 index 0000000..7f1d907 --- /dev/null +++ b/src/Model/RewardsCreateResponseBody.php @@ -0,0 +1,885 @@ + + */ +class RewardsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'stock' => 'int', + 'redeemed' => 'int', + 'attributes' => '\OpenAPI\Client\Model\RewardsCreateResponseBodyAttributes', + 'metadata' => 'object', + 'type' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardType', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'stock' => null, + 'redeemed' => null, + 'attributes' => null, + 'metadata' => null, + 'type' => null, + 'parameters' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'stock' => true, + 'redeemed' => true, + 'attributes' => true, + 'metadata' => true, + 'type' => true, + 'parameters' => false, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'stock' => 'stock', + 'redeemed' => 'redeemed', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'type' => 'type', + 'parameters' => 'parameters', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'stock' => 'setStock', + 'redeemed' => 'setRedeemed', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'type' => 'setType', + 'parameters' => 'setParameters', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'stock' => 'getStock', + 'redeemed' => 'getRedeemed', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'type' => 'getType', + 'parameters' => 'getParameters', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_CAMPAIGN = 'CAMPAIGN'; + public const TYPE_COIN = 'COIN'; + public const TYPE_MATERIAL = 'MATERIAL'; + public const OBJECT_REWARD = 'reward'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_CAMPAIGN, + self::TYPE_COIN, + self::TYPE_MATERIAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('stock', $data ?? [], null); + $this->setIfExists('redeemed', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Reward name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets stock + * + * @return int|null + */ + public function getStock() + { + return $this->container['stock']; + } + + /** + * Sets stock + * + * @param int|null $stock Configurable for **material rewards**. The number of units of the product that you want to share as reward. + * + * @return self + */ + public function setStock($stock) + { + if (is_null($stock)) { + array_push($this->openAPINullablesSetToNull, 'stock'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stock', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['stock'] = $stock; + + return $this; + } + + /** + * Gets redeemed + * + * @return int|null + */ + public function getRedeemed() + { + return $this->container['redeemed']; + } + + /** + * Sets redeemed + * + * @param int|null $redeemed Defines the number of already invoked (successful) reward redemptions. + * + * @return self + */ + public function setRedeemed($redeemed) + { + if (is_null($redeemed)) { + array_push($this->openAPINullablesSetToNull, 'redeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemed'] = $redeemed; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\RewardsCreateResponseBodyAttributes|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\RewardsCreateResponseBodyAttributes|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Reward type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardType|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardType|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object The type of the object represented by the JSON. This object stores information about the reward. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RewardsCreateResponseBodyAttributes.php b/src/Model/RewardsCreateResponseBodyAttributes.php new file mode 100644 index 0000000..11bf3e9 --- /dev/null +++ b/src/Model/RewardsCreateResponseBodyAttributes.php @@ -0,0 +1,459 @@ + + */ +class RewardsCreateResponseBodyAttributes implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsCreateResponseBodyAttributes'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'imageUrl' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'imageUrl' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'imageUrl' => true, + 'description' => true + ]; + + /** + * 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 = [ + 'imageUrl' => 'image_url', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'imageUrl' => 'setImageUrl', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'imageUrl' => 'getImageUrl', + 'description' => 'getDescription' + ]; + + /** + * 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('imageUrl', $data ?? [], null); + $this->setIfExists('description', $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 imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a material reward. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + 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/RewardsListResponseBody.php b/src/Model/RewardsListResponseBody.php new file mode 100644 index 0000000..8fc7631 --- /dev/null +++ b/src/Model/RewardsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class RewardsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\Reward[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of transaction objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\Reward[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\Reward[]|null $data A dictionary that contains an array of rewards. Each entry in the array is a separate transaction object. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Returns how many rewards in the project meet the limits defined by the query parameter definitions. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/RewardsUpdateRequestBody.php b/src/Model/RewardsUpdateRequestBody.php new file mode 100644 index 0000000..6901b21 --- /dev/null +++ b/src/Model/RewardsUpdateRequestBody.php @@ -0,0 +1,581 @@ + + */ +class RewardsUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardsUpdateRequestBodyParameters', + 'metadata' => 'object', + 'stock' => 'int', + 'attributes' => '\OpenAPI\Client\Model\RewardsUpdateRequestBodyAttributes' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'parameters' => null, + 'metadata' => null, + 'stock' => null, + 'attributes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'parameters' => true, + 'metadata' => true, + 'stock' => true, + 'attributes' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'parameters' => 'parameters', + 'metadata' => 'metadata', + 'stock' => 'stock', + 'attributes' => 'attributes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'parameters' => 'setParameters', + 'metadata' => 'setMetadata', + 'stock' => 'setStock', + 'attributes' => 'setAttributes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'parameters' => 'getParameters', + 'metadata' => 'getMetadata', + 'stock' => 'getStock', + 'attributes' => 'getAttributes' + ]; + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('stock', $data ?? [], null); + $this->setIfExists('attributes', $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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Reward name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardsUpdateRequestBodyParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBodyParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + array_push($this->openAPINullablesSetToNull, 'parameters'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parameters', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets stock + * + * @return int|null + */ + public function getStock() + { + return $this->container['stock']; + } + + /** + * Sets stock + * + * @param int|null $stock The number of units of the product that you want to share as a reward. + * + * @return self + */ + public function setStock($stock) + { + if (is_null($stock)) { + array_push($this->openAPINullablesSetToNull, 'stock'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stock', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['stock'] = $stock; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\RewardsUpdateRequestBodyAttributes|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBodyAttributes|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + 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/RewardsUpdateRequestBodyAttributes.php b/src/Model/RewardsUpdateRequestBodyAttributes.php new file mode 100644 index 0000000..e0f8e76 --- /dev/null +++ b/src/Model/RewardsUpdateRequestBodyAttributes.php @@ -0,0 +1,459 @@ + + */ +class RewardsUpdateRequestBodyAttributes implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsUpdateRequestBodyAttributes'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'imageUrl' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'imageUrl' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'imageUrl' => true, + 'description' => true + ]; + + /** + * 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 = [ + 'imageUrl' => 'image_url', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'imageUrl' => 'setImageUrl', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'imageUrl' => 'getImageUrl', + 'description' => 'getDescription' + ]; + + /** + * 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('imageUrl', $data ?? [], null); + $this->setIfExists('description', $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 imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl HTTPS URL pointing to a .png or .jpg file. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Description of a material reward. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + 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/RewardsUpdateRequestBodyParameters.php b/src/Model/RewardsUpdateRequestBodyParameters.php new file mode 100644 index 0000000..0be4030 --- /dev/null +++ b/src/Model/RewardsUpdateRequestBodyParameters.php @@ -0,0 +1,499 @@ + + */ +class RewardsUpdateRequestBodyParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsUpdateRequestBodyParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'campaign' => '\OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersCampaign', + 'product' => '\OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersProduct', + 'coin' => '\OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersCoin' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'campaign' => null, + 'product' => null, + 'coin' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'campaign' => true, + 'product' => true, + 'coin' => true + ]; + + /** + * 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 = [ + 'campaign' => 'campaign', + 'product' => 'product', + 'coin' => 'coin' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'campaign' => 'setCampaign', + 'product' => 'setProduct', + 'coin' => 'setCoin' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'campaign' => 'getCampaign', + 'product' => 'getProduct', + 'coin' => 'getCoin' + ]; + + /** + * 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('campaign', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('coin', $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 campaign + * + * @return \OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersCampaign|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersCampaign|null $campaign campaign + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersProduct|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersProduct|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + array_push($this->openAPINullablesSetToNull, 'product'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets coin + * + * @return \OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersCoin|null + */ + public function getCoin() + { + return $this->container['coin']; + } + + /** + * Sets coin + * + * @param \OpenAPI\Client\Model\RewardsUpdateRequestBodyParametersCoin|null $coin coin + * + * @return self + */ + public function setCoin($coin) + { + if (is_null($coin)) { + array_push($this->openAPINullablesSetToNull, 'coin'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('coin', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['coin'] = $coin; + + 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/RewardsUpdateRequestBodyParametersCampaign.php b/src/Model/RewardsUpdateRequestBodyParametersCampaign.php new file mode 100644 index 0000000..36f7236 --- /dev/null +++ b/src/Model/RewardsUpdateRequestBodyParametersCampaign.php @@ -0,0 +1,458 @@ + + */ +class RewardsUpdateRequestBodyParametersCampaign implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsUpdateRequestBodyParametersCampaign'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'balance' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'balance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'balance' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'balance' => 'balance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'balance' => 'setBalance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'balance' => 'getBalance' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('balance', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance The incremental points to be added to the current balance on the loyalty card. and The incremental amount to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + 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/RewardsUpdateRequestBodyParametersCoin.php b/src/Model/RewardsUpdateRequestBodyParametersCoin.php new file mode 100644 index 0000000..5f9492e --- /dev/null +++ b/src/Model/RewardsUpdateRequestBodyParametersCoin.php @@ -0,0 +1,459 @@ + + */ +class RewardsUpdateRequestBodyParametersCoin implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsUpdateRequestBodyParametersCoin'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'exchangeRatio' => 'string', + 'pointsRatio' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'exchangeRatio' => null, + 'pointsRatio' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'exchangeRatio' => true, + 'pointsRatio' => true + ]; + + /** + * 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 = [ + 'exchangeRatio' => 'exchange_ratio', + 'pointsRatio' => 'points_ratio' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'exchangeRatio' => 'setExchangeRatio', + 'pointsRatio' => 'setPointsRatio' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'exchangeRatio' => 'getExchangeRatio', + 'pointsRatio' => 'getPointsRatio' + ]; + + /** + * 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('exchangeRatio', $data ?? [], null); + $this->setIfExists('pointsRatio', $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 exchangeRatio + * + * @return string|null + */ + public function getExchangeRatio() + { + return $this->container['exchangeRatio']; + } + + /** + * Sets exchangeRatio + * + * @param string|null $exchangeRatio The cash equivalent of the points defined in the `points_ratio` property. + * + * @return self + */ + public function setExchangeRatio($exchangeRatio) + { + if (is_null($exchangeRatio)) { + array_push($this->openAPINullablesSetToNull, 'exchangeRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exchangeRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['exchangeRatio'] = $exchangeRatio; + + return $this; + } + + /** + * Gets pointsRatio + * + * @return string|null + */ + public function getPointsRatio() + { + return $this->container['pointsRatio']; + } + + /** + * Sets pointsRatio + * + * @param string|null $pointsRatio The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. + * + * @return self + */ + public function setPointsRatio($pointsRatio) + { + if (is_null($pointsRatio)) { + array_push($this->openAPINullablesSetToNull, 'pointsRatio'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('pointsRatio', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['pointsRatio'] = $pointsRatio; + + 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/RewardsUpdateRequestBodyParametersProduct.php b/src/Model/RewardsUpdateRequestBodyParametersProduct.php new file mode 100644 index 0000000..a0c2c2e --- /dev/null +++ b/src/Model/RewardsUpdateRequestBodyParametersProduct.php @@ -0,0 +1,459 @@ + + */ +class RewardsUpdateRequestBodyParametersProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsUpdateRequestBodyParametersProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'skuId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'skuId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'skuId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'skuId' => 'sku_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'skuId' => 'setSkuId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'skuId' => 'getSkuId' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('skuId', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID, assigned by Voucherify, given as a reward. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets skuId + * + * @return string|null + */ + public function getSkuId() + { + return $this->container['skuId']; + } + + /** + * Sets skuId + * + * @param string|null $skuId Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. + * + * @return self + */ + public function setSkuId($skuId) + { + if (is_null($skuId)) { + array_push($this->openAPINullablesSetToNull, 'skuId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skuId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skuId'] = $skuId; + + 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/RewardsUpdateResponseBody.php b/src/Model/RewardsUpdateResponseBody.php new file mode 100644 index 0000000..7dc8130 --- /dev/null +++ b/src/Model/RewardsUpdateResponseBody.php @@ -0,0 +1,885 @@ + + */ +class RewardsUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'stock' => 'int', + 'redeemed' => 'int', + 'attributes' => '\OpenAPI\Client\Model\RewardsUpdateResponseBodyAttributes', + 'metadata' => 'object', + 'type' => 'string', + 'parameters' => '\OpenAPI\Client\Model\RewardType', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'stock' => null, + 'redeemed' => null, + 'attributes' => null, + 'metadata' => null, + 'type' => null, + 'parameters' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'stock' => true, + 'redeemed' => true, + 'attributes' => true, + 'metadata' => true, + 'type' => true, + 'parameters' => false, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => 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 = [ + 'id' => 'id', + 'name' => 'name', + 'stock' => 'stock', + 'redeemed' => 'redeemed', + 'attributes' => 'attributes', + 'metadata' => 'metadata', + 'type' => 'type', + 'parameters' => 'parameters', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'stock' => 'setStock', + 'redeemed' => 'setRedeemed', + 'attributes' => 'setAttributes', + 'metadata' => 'setMetadata', + 'type' => 'setType', + 'parameters' => 'setParameters', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'stock' => 'getStock', + 'redeemed' => 'getRedeemed', + 'attributes' => 'getAttributes', + 'metadata' => 'getMetadata', + 'type' => 'getType', + 'parameters' => 'getParameters', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_CAMPAIGN = 'CAMPAIGN'; + public const TYPE_COIN = 'COIN'; + public const TYPE_MATERIAL = 'MATERIAL'; + public const OBJECT_REWARD = 'reward'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_CAMPAIGN, + self::TYPE_COIN, + self::TYPE_MATERIAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_REWARD, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('stock', $data ?? [], null); + $this->setIfExists('redeemed', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'reward'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['object'] === null) { + $invalidProperties[] = "'object' can't be null"; + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Reward name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets stock + * + * @return int|null + */ + public function getStock() + { + return $this->container['stock']; + } + + /** + * Sets stock + * + * @param int|null $stock Configurable for **material rewards**. The number of units of the product that you want to share as reward. + * + * @return self + */ + public function setStock($stock) + { + if (is_null($stock)) { + array_push($this->openAPINullablesSetToNull, 'stock'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stock', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['stock'] = $stock; + + return $this; + } + + /** + * Gets redeemed + * + * @return int|null + */ + public function getRedeemed() + { + return $this->container['redeemed']; + } + + /** + * Sets redeemed + * + * @param int|null $redeemed Defines the number of already invoked (successful) reward redemptions. + * + * @return self + */ + public function setRedeemed($redeemed) + { + if (is_null($redeemed)) { + array_push($this->openAPINullablesSetToNull, 'redeemed'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemed', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemed'] = $redeemed; + + return $this; + } + + /** + * Gets attributes + * + * @return \OpenAPI\Client\Model\RewardsUpdateResponseBodyAttributes|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \OpenAPI\Client\Model\RewardsUpdateResponseBodyAttributes|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Reward type. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\RewardType|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\RewardType|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string $object The type of the object represented by the JSON. This object stores information about the reward. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/RewardsUpdateResponseBodyAttributes.php b/src/Model/RewardsUpdateResponseBodyAttributes.php new file mode 100644 index 0000000..e6aac98 --- /dev/null +++ b/src/Model/RewardsUpdateResponseBodyAttributes.php @@ -0,0 +1,459 @@ + + */ +class RewardsUpdateResponseBodyAttributes implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'RewardsUpdateResponseBodyAttributes'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'imageUrl' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'imageUrl' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'imageUrl' => true, + 'description' => true + ]; + + /** + * 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 = [ + 'imageUrl' => 'image_url', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'imageUrl' => 'setImageUrl', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'imageUrl' => 'getImageUrl', + 'description' => 'getDescription' + ]; + + /** + * 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('imageUrl', $data ?? [], null); + $this->setIfExists('description', $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 imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description An arbitrary string that you can attach to a material reward. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + array_push($this->openAPINullablesSetToNull, 'description'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('description', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['description'] = $description; + + 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/SegmentsCreateRequestBody.php b/src/Model/SegmentsCreateRequestBody.php new file mode 100644 index 0000000..073f2b4 --- /dev/null +++ b/src/Model/SegmentsCreateRequestBody.php @@ -0,0 +1,574 @@ + + */ +class SegmentsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SegmentsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'type' => 'string', + 'customers' => 'string[]', + 'filter' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'type' => null, + 'customers' => null, + 'filter' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'type' => true, + 'customers' => true, + 'filter' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'type' => 'type', + 'customers' => 'customers', + 'filter' => 'filter' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'type' => 'setType', + 'customers' => 'setCustomers', + 'filter' => 'setFilter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'type' => 'getType', + 'customers' => 'getCustomers', + 'filter' => 'getFilter' + ]; + + /** + * 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 TYPE__STATIC = 'static'; + public const TYPE_AUTO_UPDATE = 'auto-update'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE__STATIC, + self::TYPE_AUTO_UPDATE, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('customers', $data ?? [], null); + $this->setIfExists('filter', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Segment name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets customers + * + * @return string[]|null + */ + public function getCustomers() + { + return $this->container['customers']; + } + + /** + * Sets customers + * + * @param string[]|null $customers Array of customer IDs. + * + * @return self + */ + public function setCustomers($customers) + { + if (is_null($customers)) { + array_push($this->openAPINullablesSetToNull, 'customers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customers'] = $customers; + + return $this; + } + + /** + * Gets filter + * + * @return object|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param object|null $filter Defines a set of criteria for an `auto-update` segment type. + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + array_push($this->openAPINullablesSetToNull, 'filter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filter'] = $filter; + + 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/SegmentsCreateResponseBody.php b/src/Model/SegmentsCreateResponseBody.php new file mode 100644 index 0000000..23b5f6e --- /dev/null +++ b/src/Model/SegmentsCreateResponseBody.php @@ -0,0 +1,764 @@ + + */ +class SegmentsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SegmentsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'createdAt' => '\DateTime', + 'type' => 'string', + 'filter' => 'object', + 'initialSyncStatus' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'createdAt' => 'date-time', + 'type' => null, + 'filter' => null, + 'initialSyncStatus' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'createdAt' => true, + 'type' => true, + 'filter' => true, + 'initialSyncStatus' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'createdAt' => 'created_at', + 'type' => 'type', + 'filter' => 'filter', + 'initialSyncStatus' => 'initial_sync_status', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'createdAt' => 'setCreatedAt', + 'type' => 'setType', + 'filter' => 'setFilter', + 'initialSyncStatus' => 'setInitialSyncStatus', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'createdAt' => 'getCreatedAt', + 'type' => 'getType', + 'filter' => 'getFilter', + 'initialSyncStatus' => 'getInitialSyncStatus', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_AUTO_UPDATE = 'auto-update'; + public const TYPE__STATIC = 'static'; + public const INITIAL_SYNC_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const INITIAL_SYNC_STATUS_DONE = 'DONE'; + public const OBJECT_SEGMENT = 'segment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInitialSyncStatusAllowableValues() + { + return [ + self::INITIAL_SYNC_STATUS_IN_PROGRESS, + self::INITIAL_SYNC_STATUS_DONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SEGMENT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('initialSyncStatus', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'segment'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getInitialSyncStatusAllowableValues(); + if (!is_null($this->container['initialSyncStatus']) && !in_array($this->container['initialSyncStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'initialSyncStatus', must be one of '%s'", + $this->container['initialSyncStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique segment ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Segment name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets filter + * + * @return object|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param object|null $filter Defines a set of criteria for an `auto-update` segment type. + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + array_push($this->openAPINullablesSetToNull, 'filter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filter'] = $filter; + + return $this; + } + + /** + * Gets initialSyncStatus + * + * @return string|null + */ + public function getInitialSyncStatus() + { + return $this->container['initialSyncStatus']; + } + + /** + * Sets initialSyncStatus + * + * @param string|null $initialSyncStatus initialSyncStatus + * + * @return self + */ + public function setInitialSyncStatus($initialSyncStatus) + { + if (is_null($initialSyncStatus)) { + array_push($this->openAPINullablesSetToNull, 'initialSyncStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialSyncStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInitialSyncStatusAllowableValues(); + if (!is_null($initialSyncStatus) && !in_array($initialSyncStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'initialSyncStatus', must be one of '%s'", + $initialSyncStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['initialSyncStatus'] = $initialSyncStatus; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the customer segment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/SegmentsGetResponseBody.php b/src/Model/SegmentsGetResponseBody.php new file mode 100644 index 0000000..b53bf67 --- /dev/null +++ b/src/Model/SegmentsGetResponseBody.php @@ -0,0 +1,764 @@ + + */ +class SegmentsGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SegmentsGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'createdAt' => '\DateTime', + 'type' => 'string', + 'filter' => 'object', + 'initialSyncStatus' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'createdAt' => 'date-time', + 'type' => null, + 'filter' => null, + 'initialSyncStatus' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'createdAt' => true, + 'type' => true, + 'filter' => true, + 'initialSyncStatus' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'createdAt' => 'created_at', + 'type' => 'type', + 'filter' => 'filter', + 'initialSyncStatus' => 'initial_sync_status', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'createdAt' => 'setCreatedAt', + 'type' => 'setType', + 'filter' => 'setFilter', + 'initialSyncStatus' => 'setInitialSyncStatus', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'createdAt' => 'getCreatedAt', + 'type' => 'getType', + 'filter' => 'getFilter', + 'initialSyncStatus' => 'getInitialSyncStatus', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_AUTO_UPDATE = 'auto-update'; + public const TYPE__STATIC = 'static'; + public const INITIAL_SYNC_STATUS_IN_PROGRESS = 'IN_PROGRESS'; + public const INITIAL_SYNC_STATUS_DONE = 'DONE'; + public const OBJECT_SEGMENT = 'segment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AUTO_UPDATE, + self::TYPE__STATIC, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInitialSyncStatusAllowableValues() + { + return [ + self::INITIAL_SYNC_STATUS_IN_PROGRESS, + self::INITIAL_SYNC_STATUS_DONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SEGMENT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('filter', $data ?? [], null); + $this->setIfExists('initialSyncStatus', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'segment'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getInitialSyncStatusAllowableValues(); + if (!is_null($this->container['initialSyncStatus']) && !in_array($this->container['initialSyncStatus'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'initialSyncStatus', must be one of '%s'", + $this->container['initialSyncStatus'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique segment ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Segment name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets filter + * + * @return object|null + */ + public function getFilter() + { + return $this->container['filter']; + } + + /** + * Sets filter + * + * @param object|null $filter Defines a set of criteria for an `auto-update` segment type. + * + * @return self + */ + public function setFilter($filter) + { + if (is_null($filter)) { + array_push($this->openAPINullablesSetToNull, 'filter'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('filter', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['filter'] = $filter; + + return $this; + } + + /** + * Gets initialSyncStatus + * + * @return string|null + */ + public function getInitialSyncStatus() + { + return $this->container['initialSyncStatus']; + } + + /** + * Sets initialSyncStatus + * + * @param string|null $initialSyncStatus initialSyncStatus + * + * @return self + */ + public function setInitialSyncStatus($initialSyncStatus) + { + if (is_null($initialSyncStatus)) { + array_push($this->openAPINullablesSetToNull, 'initialSyncStatus'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('initialSyncStatus', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getInitialSyncStatusAllowableValues(); + if (!is_null($initialSyncStatus) && !in_array($initialSyncStatus, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'initialSyncStatus', must be one of '%s'", + $initialSyncStatus, + implode("', '", $allowedValues) + ) + ); + } + $this->container['initialSyncStatus'] = $initialSyncStatus; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the customer segment. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/Session.php b/src/Model/Session.php new file mode 100644 index 0000000..4278b67 --- /dev/null +++ b/src/Model/Session.php @@ -0,0 +1,616 @@ + + */ +class Session implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Session'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => 'string', + 'type' => 'string', + 'ttl' => 'float', + 'ttlUnit' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + 'type' => null, + 'ttl' => null, + 'ttlUnit' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key' => true, + 'type' => true, + 'ttl' => true, + 'ttlUnit' => true + ]; + + /** + * 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 = [ + 'key' => 'key', + 'type' => 'type', + 'ttl' => 'ttl', + 'ttlUnit' => 'ttl_unit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'type' => 'setType', + 'ttl' => 'setTtl', + 'ttlUnit' => 'setTtlUnit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'type' => 'getType', + 'ttl' => 'getTtl', + 'ttlUnit' => 'getTtlUnit' + ]; + + /** + * 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 TYPE_LOCK = 'LOCK'; + public const TTL_UNIT_DAYS = 'DAYS'; + public const TTL_UNIT_HOURS = 'HOURS'; + public const TTL_UNIT_MICROSECONDS = 'MICROSECONDS'; + public const TTL_UNIT_MILLISECONDS = 'MILLISECONDS'; + public const TTL_UNIT_MINUTES = 'MINUTES'; + public const TTL_UNIT_NANOSECONDS = 'NANOSECONDS'; + public const TTL_UNIT_SECONDS = 'SECONDS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOCK, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTtlUnitAllowableValues() + { + return [ + self::TTL_UNIT_DAYS, + self::TTL_UNIT_HOURS, + self::TTL_UNIT_MICROSECONDS, + self::TTL_UNIT_MILLISECONDS, + self::TTL_UNIT_MINUTES, + self::TTL_UNIT_NANOSECONDS, + self::TTL_UNIT_SECONDS, + ]; + } + + /** + * 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('key', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'LOCK'); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('ttlUnit', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTtlUnitAllowableValues(); + if (!is_null($this->container['ttlUnit']) && !in_array($this->container['ttlUnit'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'ttlUnit', must be one of '%s'", + $this->container['ttlUnit'], + 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 key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated. + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + array_push($this->openAPINullablesSetToNull, 'key'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('key', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type This parameter is required to establish a new session. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets ttl + * + * @return float|null + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param float|null $ttl Value for the period of time that the session is active. Units for this parameter are defined by the session.ttl_unit parameter. + * + * @return self + */ + public function setTtl($ttl) + { + if (is_null($ttl)) { + array_push($this->openAPINullablesSetToNull, 'ttl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ttl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ttl'] = $ttl; + + return $this; + } + + /** + * Gets ttlUnit + * + * @return string|null + */ + public function getTtlUnit() + { + return $this->container['ttlUnit']; + } + + /** + * Sets ttlUnit + * + * @param string|null $ttlUnit Defines the type of unit in which the session time is counted. + * + * @return self + */ + public function setTtlUnit($ttlUnit) + { + if (is_null($ttlUnit)) { + array_push($this->openAPINullablesSetToNull, 'ttlUnit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ttlUnit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTtlUnitAllowableValues(); + if (!is_null($ttlUnit) && !in_array($ttlUnit, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'ttlUnit', must be one of '%s'", + $ttlUnit, + implode("', '", $allowedValues) + ) + ); + } + $this->container['ttlUnit'] = $ttlUnit; + + 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/SimpleCustomer.php b/src/Model/SimpleCustomer.php new file mode 100644 index 0000000..866f371 --- /dev/null +++ b/src/Model/SimpleCustomer.php @@ -0,0 +1,655 @@ + + */ +class SimpleCustomer implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleCustomer'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'email' => 'string', + 'sourceId' => 'string', + 'metadata' => 'object', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'email' => null, + 'sourceId' => null, + 'metadata' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'email' => true, + 'sourceId' => true, + 'metadata' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'email' => 'email', + 'sourceId' => 'source_id', + 'metadata' => 'metadata', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'email' => 'setEmail', + 'sourceId' => 'setSourceId', + 'metadata' => 'setMetadata', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'email' => 'getEmail', + 'sourceId' => 'getSourceId', + 'metadata' => 'getMetadata', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_CUSTOMER = 'customer'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_CUSTOMER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique identifier of an existing customer. It is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that are attached to the customer. It stores all custom attributes assigned to the customer. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/SimpleCustomerRequiredObjectType.php b/src/Model/SimpleCustomerRequiredObjectType.php new file mode 100644 index 0000000..665d9ae --- /dev/null +++ b/src/Model/SimpleCustomerRequiredObjectType.php @@ -0,0 +1,623 @@ + + */ +class SimpleCustomerRequiredObjectType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleCustomerRequiredObjectType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string', + 'email' => 'string', + 'metadata' => 'object', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null, + 'email' => null, + 'metadata' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true, + 'email' => true, + 'metadata' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name', + 'email' => 'email', + 'metadata' => 'metadata', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName', + 'email' => 'setEmail', + 'metadata' => 'setMetadata', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName', + 'email' => 'getEmail', + 'metadata' => 'getMetadata', + 'object' => 'getObject' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'customer'); + } + + /** + * 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique ID of a customer that is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Customer's first and last name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email Customer's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. This object stores information about the customer. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/SimpleLoyaltyCard.php b/src/Model/SimpleLoyaltyCard.php new file mode 100644 index 0000000..c420cf7 --- /dev/null +++ b/src/Model/SimpleLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class SimpleLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => 'string', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => null, + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return string|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param string|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/SimpleProductDiscountUnit.php b/src/Model/SimpleProductDiscountUnit.php new file mode 100644 index 0000000..6472782 --- /dev/null +++ b/src/Model/SimpleProductDiscountUnit.php @@ -0,0 +1,499 @@ + + */ +class SimpleProductDiscountUnit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleProductDiscountUnit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Product's source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/SimpleSegment.php b/src/Model/SimpleSegment.php new file mode 100644 index 0000000..4dc71dd --- /dev/null +++ b/src/Model/SimpleSegment.php @@ -0,0 +1,531 @@ + + */ +class SimpleSegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleSegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SEGMENT = 'segment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SEGMENT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'segment'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique segment ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Segment name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the ID. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/SimpleSkuDiscountUnit.php b/src/Model/SimpleSkuDiscountUnit.php new file mode 100644 index 0000000..91754c9 --- /dev/null +++ b/src/Model/SimpleSkuDiscountUnit.php @@ -0,0 +1,499 @@ + + */ +class SimpleSkuDiscountUnit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleSkuDiscountUnit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique SKU ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Product variant's source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Sku name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/SimpleVoucher.php b/src/Model/SimpleVoucher.php new file mode 100644 index 0000000..b44745f --- /dev/null +++ b/src/Model/SimpleVoucher.php @@ -0,0 +1,1285 @@ + + */ +class SimpleVoucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleVoucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'loyaltyCard' => '\OpenAPI\Client\Model\SimpleLoyaltyCard', + 'type' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'isReferralCode' => 'bool', + 'holderId' => 'string', + 'referrerId' => 'string', + 'categoryId' => 'string', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'active' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'redemption' => '\OpenAPI\Client\Model\SimpleVoucherRedemption', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'metadata' => 'object', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'gift' => null, + 'discount' => null, + 'loyaltyCard' => null, + 'type' => null, + 'campaign' => null, + 'campaignId' => null, + 'isReferralCode' => null, + 'holderId' => null, + 'referrerId' => null, + 'categoryId' => null, + 'categories' => null, + 'active' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'redemption' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'metadata' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'gift' => false, + 'discount' => false, + 'loyaltyCard' => false, + 'type' => true, + 'campaign' => true, + 'campaignId' => true, + 'isReferralCode' => true, + 'holderId' => true, + 'referrerId' => true, + 'categoryId' => true, + 'categories' => true, + 'active' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'redemption' => true, + 'startDate' => true, + 'expirationDate' => true, + 'metadata' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'code' => 'code', + 'gift' => 'gift', + 'discount' => 'discount', + 'loyaltyCard' => 'loyalty_card', + 'type' => 'type', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'isReferralCode' => 'is_referral_code', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'categoryId' => 'category_id', + 'categories' => 'categories', + 'active' => 'active', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'redemption' => 'redemption', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'metadata' => 'metadata', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'gift' => 'setGift', + 'discount' => 'setDiscount', + 'loyaltyCard' => 'setLoyaltyCard', + 'type' => 'setType', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'isReferralCode' => 'setIsReferralCode', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'categoryId' => 'setCategoryId', + 'categories' => 'setCategories', + 'active' => 'setActive', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'redemption' => 'setRedemption', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'metadata' => 'setMetadata', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'gift' => 'getGift', + 'discount' => 'getDiscount', + 'loyaltyCard' => 'getLoyaltyCard', + 'type' => 'getType', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'isReferralCode' => 'getIsReferralCode', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'categoryId' => 'getCategoryId', + 'categories' => 'getCategories', + 'active' => 'getActive', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'redemption' => 'getRedemption', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'metadata' => 'getMetadata', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const OBJECT_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + self::TYPE_GIFT_VOUCHER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the voucher assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Voucher code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\SimpleLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\SimpleLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign Campaign name. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Campaign unique ID. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referrer assigned by Voucherify. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique identifier of the category that this voucher belongs to. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active Shows whether the voucher is on or off. `true` indicates an *active* voucher and `false` indicates an *inactive* voucher. + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the order was created in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\SimpleVoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\SimpleVoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of custom key/value pairs that you can attach to a voucher. The metadata object stores all custom attributes assigned to the voucher. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/SimpleVoucherRedemption.php b/src/Model/SimpleVoucherRedemption.php new file mode 100644 index 0000000..35716e6 --- /dev/null +++ b/src/Model/SimpleVoucherRedemption.php @@ -0,0 +1,459 @@ + + */ +class SimpleVoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimpleVoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + 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/Sku.php b/src/Model/Sku.php new file mode 100644 index 0000000..4cc63f4 --- /dev/null +++ b/src/Model/Sku.php @@ -0,0 +1,901 @@ + + */ +class Sku implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Sku'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'productId' => 'string', + 'sku' => 'string', + 'price' => 'int', + 'currency' => 'string', + 'attributes' => 'object', + 'imageUrl' => 'string', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'productId' => null, + 'sku' => null, + 'price' => null, + 'currency' => null, + 'attributes' => null, + 'imageUrl' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'productId' => true, + 'sku' => true, + 'price' => true, + 'currency' => true, + 'attributes' => true, + 'imageUrl' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'productId' => 'product_id', + 'sku' => 'sku', + 'price' => 'price', + 'currency' => 'currency', + 'attributes' => 'attributes', + 'imageUrl' => 'image_url', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'productId' => 'setProductId', + 'sku' => 'setSku', + 'price' => 'setPrice', + 'currency' => 'setCurrency', + 'attributes' => 'setAttributes', + 'imageUrl' => 'setImageUrl', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'productId' => 'getProductId', + 'sku' => 'getSku', + 'price' => 'getPrice', + 'currency' => 'getCurrency', + 'attributes' => 'getAttributes', + 'imageUrl' => 'getImageUrl', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SKU, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'sku'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the SKU and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique SKU identifier from your inventory system. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId The parent product's unique ID. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku Unique user-defined SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency SKU price currency. + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + array_push($this->openAPINullablesSetToNull, 'currency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the `SKU`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/SkusGetResponseBody.php b/src/Model/SkusGetResponseBody.php new file mode 100644 index 0000000..f8ca7bd --- /dev/null +++ b/src/Model/SkusGetResponseBody.php @@ -0,0 +1,901 @@ + + */ +class SkusGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SkusGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'productId' => 'string', + 'sku' => 'string', + 'price' => 'int', + 'currency' => 'string', + 'attributes' => 'object', + 'imageUrl' => 'string', + 'metadata' => 'object', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'productId' => null, + 'sku' => null, + 'price' => null, + 'currency' => null, + 'attributes' => null, + 'imageUrl' => null, + 'metadata' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'productId' => true, + 'sku' => true, + 'price' => true, + 'currency' => true, + 'attributes' => true, + 'imageUrl' => true, + 'metadata' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'productId' => 'product_id', + 'sku' => 'sku', + 'price' => 'price', + 'currency' => 'currency', + 'attributes' => 'attributes', + 'imageUrl' => 'image_url', + 'metadata' => 'metadata', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'productId' => 'setProductId', + 'sku' => 'setSku', + 'price' => 'setPrice', + 'currency' => 'setCurrency', + 'attributes' => 'setAttributes', + 'imageUrl' => 'setImageUrl', + 'metadata' => 'setMetadata', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'productId' => 'getProductId', + 'sku' => 'getSku', + 'price' => 'getPrice', + 'currency' => 'getCurrency', + 'attributes' => 'getAttributes', + 'imageUrl' => 'getImageUrl', + 'metadata' => 'getMetadata', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 OBJECT_SKU = 'sku'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_SKU, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('attributes', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'sku'); + } + + /** + * 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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier that represents the SKU and is assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId A unique SKU identifier from your inventory system. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets productId + * + * @return string|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param string|null $productId The parent product's unique ID. + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets sku + * + * @return string|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param string|null $sku Unique user-defined SKU name. + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + array_push($this->openAPINullablesSetToNull, 'sku'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sku', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets price + * + * @return int|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param int|null $price Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + array_push($this->openAPINullablesSetToNull, 'price'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('price', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency SKU price currency. + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + array_push($this->openAPINullablesSetToNull, 'currency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets attributes + * + * @return object|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param object|null $attributes The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. + * + * @return self + */ + public function setAttributes($attributes) + { + if (is_null($attributes)) { + array_push($this->openAPINullablesSetToNull, 'attributes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attributes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + array_push($this->openAPINullablesSetToNull, 'imageUrl'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('imageUrl', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the `SKU`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/SkusImportCsvCreateResponseBody.php b/src/Model/SkusImportCsvCreateResponseBody.php new file mode 100644 index 0000000..1684ece --- /dev/null +++ b/src/Model/SkusImportCsvCreateResponseBody.php @@ -0,0 +1,418 @@ + + */ +class SkusImportCsvCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SkusImportCsvCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/SkusListForProduct.php b/src/Model/SkusListForProduct.php new file mode 100644 index 0000000..7fc4543 --- /dev/null +++ b/src/Model/SkusListForProduct.php @@ -0,0 +1,541 @@ + + */ +class SkusListForProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SkusListForProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\Sku[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about SKUs. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of SKUs. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\Sku[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\Sku[]|null $data A dictionary that contains an array of SKUs. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of SKUs in the product. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/StackingRules.php b/src/Model/StackingRules.php new file mode 100644 index 0000000..b51e1ae --- /dev/null +++ b/src/Model/StackingRules.php @@ -0,0 +1,1044 @@ + + */ +class StackingRules implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StackingRules'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'redeemablesLimit' => 'int', + 'applicableRedeemablesLimit' => 'int', + 'applicableRedeemablesPerCategoryLimit' => 'int', + 'applicableExclusiveRedeemablesLimit' => 'int', + 'applicableExclusiveRedeemablesPerCategoryLimit' => 'int', + 'exclusiveCategories' => 'string[]', + 'jointCategories' => 'string[]', + 'redeemablesApplicationMode' => 'string', + 'redeemablesSortingRule' => 'string', + 'redeemablesProductsApplicationMode' => 'string', + 'redeemablesNoEffectRule' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'redeemablesLimit' => null, + 'applicableRedeemablesLimit' => null, + 'applicableRedeemablesPerCategoryLimit' => null, + 'applicableExclusiveRedeemablesLimit' => null, + 'applicableExclusiveRedeemablesPerCategoryLimit' => null, + 'exclusiveCategories' => null, + 'jointCategories' => null, + 'redeemablesApplicationMode' => null, + 'redeemablesSortingRule' => null, + 'redeemablesProductsApplicationMode' => null, + 'redeemablesNoEffectRule' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'redeemablesLimit' => true, + 'applicableRedeemablesLimit' => true, + 'applicableRedeemablesPerCategoryLimit' => true, + 'applicableExclusiveRedeemablesLimit' => true, + 'applicableExclusiveRedeemablesPerCategoryLimit' => true, + 'exclusiveCategories' => true, + 'jointCategories' => true, + 'redeemablesApplicationMode' => true, + 'redeemablesSortingRule' => true, + 'redeemablesProductsApplicationMode' => true, + 'redeemablesNoEffectRule' => true + ]; + + /** + * 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 = [ + 'redeemablesLimit' => 'redeemables_limit', + 'applicableRedeemablesLimit' => 'applicable_redeemables_limit', + 'applicableRedeemablesPerCategoryLimit' => 'applicable_redeemables_per_category_limit', + 'applicableExclusiveRedeemablesLimit' => 'applicable_exclusive_redeemables_limit', + 'applicableExclusiveRedeemablesPerCategoryLimit' => 'applicable_exclusive_redeemables_per_category_limit', + 'exclusiveCategories' => 'exclusive_categories', + 'jointCategories' => 'joint_categories', + 'redeemablesApplicationMode' => 'redeemables_application_mode', + 'redeemablesSortingRule' => 'redeemables_sorting_rule', + 'redeemablesProductsApplicationMode' => 'redeemables_products_application_mode', + 'redeemablesNoEffectRule' => 'redeemables_no_effect_rule' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'redeemablesLimit' => 'setRedeemablesLimit', + 'applicableRedeemablesLimit' => 'setApplicableRedeemablesLimit', + 'applicableRedeemablesPerCategoryLimit' => 'setApplicableRedeemablesPerCategoryLimit', + 'applicableExclusiveRedeemablesLimit' => 'setApplicableExclusiveRedeemablesLimit', + 'applicableExclusiveRedeemablesPerCategoryLimit' => 'setApplicableExclusiveRedeemablesPerCategoryLimit', + 'exclusiveCategories' => 'setExclusiveCategories', + 'jointCategories' => 'setJointCategories', + 'redeemablesApplicationMode' => 'setRedeemablesApplicationMode', + 'redeemablesSortingRule' => 'setRedeemablesSortingRule', + 'redeemablesProductsApplicationMode' => 'setRedeemablesProductsApplicationMode', + 'redeemablesNoEffectRule' => 'setRedeemablesNoEffectRule' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'redeemablesLimit' => 'getRedeemablesLimit', + 'applicableRedeemablesLimit' => 'getApplicableRedeemablesLimit', + 'applicableRedeemablesPerCategoryLimit' => 'getApplicableRedeemablesPerCategoryLimit', + 'applicableExclusiveRedeemablesLimit' => 'getApplicableExclusiveRedeemablesLimit', + 'applicableExclusiveRedeemablesPerCategoryLimit' => 'getApplicableExclusiveRedeemablesPerCategoryLimit', + 'exclusiveCategories' => 'getExclusiveCategories', + 'jointCategories' => 'getJointCategories', + 'redeemablesApplicationMode' => 'getRedeemablesApplicationMode', + 'redeemablesSortingRule' => 'getRedeemablesSortingRule', + 'redeemablesProductsApplicationMode' => 'getRedeemablesProductsApplicationMode', + 'redeemablesNoEffectRule' => 'getRedeemablesNoEffectRule' + ]; + + /** + * 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 REDEEMABLES_APPLICATION_MODE_ALL = 'ALL'; + public const REDEEMABLES_APPLICATION_MODE_PARTIAL = 'PARTIAL'; + public const REDEEMABLES_SORTING_RULE_CATEGORY_HIERARCHY = 'CATEGORY_HIERARCHY'; + public const REDEEMABLES_SORTING_RULE_REQUESTED_ORDER = 'REQUESTED_ORDER'; + public const REDEEMABLES_PRODUCTS_APPLICATION_MODE_STACK = 'STACK'; + public const REDEEMABLES_PRODUCTS_APPLICATION_MODE_ONCE = 'ONCE'; + public const REDEEMABLES_NO_EFFECT_RULE_REDEEM_ANYWAY = 'REDEEM_ANYWAY'; + public const REDEEMABLES_NO_EFFECT_RULE_SKIP = 'SKIP'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRedeemablesApplicationModeAllowableValues() + { + return [ + self::REDEEMABLES_APPLICATION_MODE_ALL, + self::REDEEMABLES_APPLICATION_MODE_PARTIAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRedeemablesSortingRuleAllowableValues() + { + return [ + self::REDEEMABLES_SORTING_RULE_CATEGORY_HIERARCHY, + self::REDEEMABLES_SORTING_RULE_REQUESTED_ORDER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRedeemablesProductsApplicationModeAllowableValues() + { + return [ + self::REDEEMABLES_PRODUCTS_APPLICATION_MODE_STACK, + self::REDEEMABLES_PRODUCTS_APPLICATION_MODE_ONCE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRedeemablesNoEffectRuleAllowableValues() + { + return [ + self::REDEEMABLES_NO_EFFECT_RULE_REDEEM_ANYWAY, + self::REDEEMABLES_NO_EFFECT_RULE_SKIP, + ]; + } + + /** + * 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('redeemablesLimit', $data ?? [], 30); + $this->setIfExists('applicableRedeemablesLimit', $data ?? [], 5); + $this->setIfExists('applicableRedeemablesPerCategoryLimit', $data ?? [], 1); + $this->setIfExists('applicableExclusiveRedeemablesLimit', $data ?? [], 1); + $this->setIfExists('applicableExclusiveRedeemablesPerCategoryLimit', $data ?? [], 1); + $this->setIfExists('exclusiveCategories', $data ?? [], null); + $this->setIfExists('jointCategories', $data ?? [], null); + $this->setIfExists('redeemablesApplicationMode', $data ?? [], null); + $this->setIfExists('redeemablesSortingRule', $data ?? [], 'REQUESTED_ORDER'); + $this->setIfExists('redeemablesProductsApplicationMode', $data ?? [], null); + $this->setIfExists('redeemablesNoEffectRule', $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 = []; + + if (!is_null($this->container['redeemablesLimit']) && ($this->container['redeemablesLimit'] > 30)) { + $invalidProperties[] = "invalid value for 'redeemablesLimit', must be smaller than or equal to 30."; + } + + if (!is_null($this->container['redeemablesLimit']) && ($this->container['redeemablesLimit'] < 1)) { + $invalidProperties[] = "invalid value for 'redeemablesLimit', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['applicableRedeemablesLimit']) && ($this->container['applicableRedeemablesLimit'] > 30)) { + $invalidProperties[] = "invalid value for 'applicableRedeemablesLimit', must be smaller than or equal to 30."; + } + + if (!is_null($this->container['applicableRedeemablesLimit']) && ($this->container['applicableRedeemablesLimit'] < 1)) { + $invalidProperties[] = "invalid value for 'applicableRedeemablesLimit', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['applicableRedeemablesPerCategoryLimit']) && ($this->container['applicableRedeemablesPerCategoryLimit'] > 5)) { + $invalidProperties[] = "invalid value for 'applicableRedeemablesPerCategoryLimit', must be smaller than or equal to 5."; + } + + if (!is_null($this->container['applicableRedeemablesPerCategoryLimit']) && ($this->container['applicableRedeemablesPerCategoryLimit'] < 1)) { + $invalidProperties[] = "invalid value for 'applicableRedeemablesPerCategoryLimit', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['applicableExclusiveRedeemablesLimit']) && ($this->container['applicableExclusiveRedeemablesLimit'] > 5)) { + $invalidProperties[] = "invalid value for 'applicableExclusiveRedeemablesLimit', must be smaller than or equal to 5."; + } + + if (!is_null($this->container['applicableExclusiveRedeemablesLimit']) && ($this->container['applicableExclusiveRedeemablesLimit'] < 1)) { + $invalidProperties[] = "invalid value for 'applicableExclusiveRedeemablesLimit', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['applicableExclusiveRedeemablesPerCategoryLimit']) && ($this->container['applicableExclusiveRedeemablesPerCategoryLimit'] > 5)) { + $invalidProperties[] = "invalid value for 'applicableExclusiveRedeemablesPerCategoryLimit', must be smaller than or equal to 5."; + } + + if (!is_null($this->container['applicableExclusiveRedeemablesPerCategoryLimit']) && ($this->container['applicableExclusiveRedeemablesPerCategoryLimit'] < 1)) { + $invalidProperties[] = "invalid value for 'applicableExclusiveRedeemablesPerCategoryLimit', must be bigger than or equal to 1."; + } + + $allowedValues = $this->getRedeemablesApplicationModeAllowableValues(); + if (!is_null($this->container['redeemablesApplicationMode']) && !in_array($this->container['redeemablesApplicationMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'redeemablesApplicationMode', must be one of '%s'", + $this->container['redeemablesApplicationMode'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRedeemablesSortingRuleAllowableValues(); + if (!is_null($this->container['redeemablesSortingRule']) && !in_array($this->container['redeemablesSortingRule'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'redeemablesSortingRule', must be one of '%s'", + $this->container['redeemablesSortingRule'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRedeemablesProductsApplicationModeAllowableValues(); + if (!is_null($this->container['redeemablesProductsApplicationMode']) && !in_array($this->container['redeemablesProductsApplicationMode'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'redeemablesProductsApplicationMode', must be one of '%s'", + $this->container['redeemablesProductsApplicationMode'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRedeemablesNoEffectRuleAllowableValues(); + if (!is_null($this->container['redeemablesNoEffectRule']) && !in_array($this->container['redeemablesNoEffectRule'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'redeemablesNoEffectRule', must be one of '%s'", + $this->container['redeemablesNoEffectRule'], + 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 redeemablesLimit + * + * @return int|null + */ + public function getRedeemablesLimit() + { + return $this->container['redeemablesLimit']; + } + + /** + * Sets redeemablesLimit + * + * @param int|null $redeemablesLimit Defines how many redeemables can be sent in one stacking request (note: more redeemables means more processing time!). + * + * @return self + */ + public function setRedeemablesLimit($redeemablesLimit) + { + if (is_null($redeemablesLimit)) { + array_push($this->openAPINullablesSetToNull, 'redeemablesLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemablesLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($redeemablesLimit) && ($redeemablesLimit > 30)) { + throw new \InvalidArgumentException('invalid value for $redeemablesLimit when calling StackingRules., must be smaller than or equal to 30.'); + } + if (!is_null($redeemablesLimit) && ($redeemablesLimit < 1)) { + throw new \InvalidArgumentException('invalid value for $redeemablesLimit when calling StackingRules., must be bigger than or equal to 1.'); + } + + $this->container['redeemablesLimit'] = $redeemablesLimit; + + return $this; + } + + /** + * Gets applicableRedeemablesLimit + * + * @return int|null + */ + public function getApplicableRedeemablesLimit() + { + return $this->container['applicableRedeemablesLimit']; + } + + /** + * Sets applicableRedeemablesLimit + * + * @param int|null $applicableRedeemablesLimit Defines how many of the sent redeemables will be applied to the order. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be labelled as SKIPPED. + * + * @return self + */ + public function setApplicableRedeemablesLimit($applicableRedeemablesLimit) + { + if (is_null($applicableRedeemablesLimit)) { + array_push($this->openAPINullablesSetToNull, 'applicableRedeemablesLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableRedeemablesLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($applicableRedeemablesLimit) && ($applicableRedeemablesLimit > 30)) { + throw new \InvalidArgumentException('invalid value for $applicableRedeemablesLimit when calling StackingRules., must be smaller than or equal to 30.'); + } + if (!is_null($applicableRedeemablesLimit) && ($applicableRedeemablesLimit < 1)) { + throw new \InvalidArgumentException('invalid value for $applicableRedeemablesLimit when calling StackingRules., must be bigger than or equal to 1.'); + } + + $this->container['applicableRedeemablesLimit'] = $applicableRedeemablesLimit; + + return $this; + } + + /** + * Gets applicableRedeemablesPerCategoryLimit + * + * @return int|null + */ + public function getApplicableRedeemablesPerCategoryLimit() + { + return $this->container['applicableRedeemablesPerCategoryLimit']; + } + + /** + * Sets applicableRedeemablesPerCategoryLimit + * + * @param int|null $applicableRedeemablesPerCategoryLimit Defines how many redeemables per category can be applied in one request. + * + * @return self + */ + public function setApplicableRedeemablesPerCategoryLimit($applicableRedeemablesPerCategoryLimit) + { + if (is_null($applicableRedeemablesPerCategoryLimit)) { + array_push($this->openAPINullablesSetToNull, 'applicableRedeemablesPerCategoryLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableRedeemablesPerCategoryLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($applicableRedeemablesPerCategoryLimit) && ($applicableRedeemablesPerCategoryLimit > 5)) { + throw new \InvalidArgumentException('invalid value for $applicableRedeemablesPerCategoryLimit when calling StackingRules., must be smaller than or equal to 5.'); + } + if (!is_null($applicableRedeemablesPerCategoryLimit) && ($applicableRedeemablesPerCategoryLimit < 1)) { + throw new \InvalidArgumentException('invalid value for $applicableRedeemablesPerCategoryLimit when calling StackingRules., must be bigger than or equal to 1.'); + } + + $this->container['applicableRedeemablesPerCategoryLimit'] = $applicableRedeemablesPerCategoryLimit; + + return $this; + } + + /** + * Gets applicableExclusiveRedeemablesLimit + * + * @return int|null + */ + public function getApplicableExclusiveRedeemablesLimit() + { + return $this->container['applicableExclusiveRedeemablesLimit']; + } + + /** + * Sets applicableExclusiveRedeemablesLimit + * + * @param int|null $applicableExclusiveRedeemablesLimit Defines how many redeemables with an exclusive category can be applied in one request. + * + * @return self + */ + public function setApplicableExclusiveRedeemablesLimit($applicableExclusiveRedeemablesLimit) + { + if (is_null($applicableExclusiveRedeemablesLimit)) { + array_push($this->openAPINullablesSetToNull, 'applicableExclusiveRedeemablesLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableExclusiveRedeemablesLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($applicableExclusiveRedeemablesLimit) && ($applicableExclusiveRedeemablesLimit > 5)) { + throw new \InvalidArgumentException('invalid value for $applicableExclusiveRedeemablesLimit when calling StackingRules., must be smaller than or equal to 5.'); + } + if (!is_null($applicableExclusiveRedeemablesLimit) && ($applicableExclusiveRedeemablesLimit < 1)) { + throw new \InvalidArgumentException('invalid value for $applicableExclusiveRedeemablesLimit when calling StackingRules., must be bigger than or equal to 1.'); + } + + $this->container['applicableExclusiveRedeemablesLimit'] = $applicableExclusiveRedeemablesLimit; + + return $this; + } + + /** + * Gets applicableExclusiveRedeemablesPerCategoryLimit + * + * @return int|null + */ + public function getApplicableExclusiveRedeemablesPerCategoryLimit() + { + return $this->container['applicableExclusiveRedeemablesPerCategoryLimit']; + } + + /** + * Sets applicableExclusiveRedeemablesPerCategoryLimit + * + * @param int|null $applicableExclusiveRedeemablesPerCategoryLimit Defines how many redeemables with an exclusive category per category in stacking rules can be applied in one request. + * + * @return self + */ + public function setApplicableExclusiveRedeemablesPerCategoryLimit($applicableExclusiveRedeemablesPerCategoryLimit) + { + if (is_null($applicableExclusiveRedeemablesPerCategoryLimit)) { + array_push($this->openAPINullablesSetToNull, 'applicableExclusiveRedeemablesPerCategoryLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableExclusiveRedeemablesPerCategoryLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($applicableExclusiveRedeemablesPerCategoryLimit) && ($applicableExclusiveRedeemablesPerCategoryLimit > 5)) { + throw new \InvalidArgumentException('invalid value for $applicableExclusiveRedeemablesPerCategoryLimit when calling StackingRules., must be smaller than or equal to 5.'); + } + if (!is_null($applicableExclusiveRedeemablesPerCategoryLimit) && ($applicableExclusiveRedeemablesPerCategoryLimit < 1)) { + throw new \InvalidArgumentException('invalid value for $applicableExclusiveRedeemablesPerCategoryLimit when calling StackingRules., must be bigger than or equal to 1.'); + } + + $this->container['applicableExclusiveRedeemablesPerCategoryLimit'] = $applicableExclusiveRedeemablesPerCategoryLimit; + + return $this; + } + + /** + * Gets exclusiveCategories + * + * @return string[]|null + */ + public function getExclusiveCategories() + { + return $this->container['exclusiveCategories']; + } + + /** + * Sets exclusiveCategories + * + * @param string[]|null $exclusiveCategories Lists all exclusive categories. A redeemable from a campaign with an exclusive category is the only redeemable to be redeemed when applied with redeemables from other campaigns unless these campaigns are exclusive or joint. + * + * @return self + */ + public function setExclusiveCategories($exclusiveCategories) + { + if (is_null($exclusiveCategories)) { + array_push($this->openAPINullablesSetToNull, 'exclusiveCategories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exclusiveCategories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['exclusiveCategories'] = $exclusiveCategories; + + return $this; + } + + /** + * Gets jointCategories + * + * @return string[]|null + */ + public function getJointCategories() + { + return $this->container['jointCategories']; + } + + /** + * Sets jointCategories + * + * @param string[]|null $jointCategories Lists all joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns. + * + * @return self + */ + public function setJointCategories($jointCategories) + { + if (is_null($jointCategories)) { + array_push($this->openAPINullablesSetToNull, 'jointCategories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('jointCategories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['jointCategories'] = $jointCategories; + + return $this; + } + + /** + * Gets redeemablesApplicationMode + * + * @return string|null + */ + public function getRedeemablesApplicationMode() + { + return $this->container['redeemablesApplicationMode']; + } + + /** + * Sets redeemablesApplicationMode + * + * @param string|null $redeemablesApplicationMode Defines redeemables application mode. + * + * @return self + */ + public function setRedeemablesApplicationMode($redeemablesApplicationMode) + { + if (is_null($redeemablesApplicationMode)) { + array_push($this->openAPINullablesSetToNull, 'redeemablesApplicationMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemablesApplicationMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRedeemablesApplicationModeAllowableValues(); + if (!is_null($redeemablesApplicationMode) && !in_array($redeemablesApplicationMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'redeemablesApplicationMode', must be one of '%s'", + $redeemablesApplicationMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['redeemablesApplicationMode'] = $redeemablesApplicationMode; + + return $this; + } + + /** + * Gets redeemablesSortingRule + * + * @return string|null + */ + public function getRedeemablesSortingRule() + { + return $this->container['redeemablesSortingRule']; + } + + /** + * Sets redeemablesSortingRule + * + * @param string|null $redeemablesSortingRule Defines redeemables sorting rule. + * + * @return self + */ + public function setRedeemablesSortingRule($redeemablesSortingRule) + { + if (is_null($redeemablesSortingRule)) { + array_push($this->openAPINullablesSetToNull, 'redeemablesSortingRule'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemablesSortingRule', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRedeemablesSortingRuleAllowableValues(); + if (!is_null($redeemablesSortingRule) && !in_array($redeemablesSortingRule, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'redeemablesSortingRule', must be one of '%s'", + $redeemablesSortingRule, + implode("', '", $allowedValues) + ) + ); + } + $this->container['redeemablesSortingRule'] = $redeemablesSortingRule; + + return $this; + } + + /** + * Gets redeemablesProductsApplicationMode + * + * @return string|null + */ + public function getRedeemablesProductsApplicationMode() + { + return $this->container['redeemablesProductsApplicationMode']; + } + + /** + * Sets redeemablesProductsApplicationMode + * + * @param string|null $redeemablesProductsApplicationMode Defines redeemables products application mode. + * + * @return self + */ + public function setRedeemablesProductsApplicationMode($redeemablesProductsApplicationMode) + { + if (is_null($redeemablesProductsApplicationMode)) { + array_push($this->openAPINullablesSetToNull, 'redeemablesProductsApplicationMode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemablesProductsApplicationMode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRedeemablesProductsApplicationModeAllowableValues(); + if (!is_null($redeemablesProductsApplicationMode) && !in_array($redeemablesProductsApplicationMode, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'redeemablesProductsApplicationMode', must be one of '%s'", + $redeemablesProductsApplicationMode, + implode("', '", $allowedValues) + ) + ); + } + $this->container['redeemablesProductsApplicationMode'] = $redeemablesProductsApplicationMode; + + return $this; + } + + /** + * Gets redeemablesNoEffectRule + * + * @return string|null + */ + public function getRedeemablesNoEffectRule() + { + return $this->container['redeemablesNoEffectRule']; + } + + /** + * Sets redeemablesNoEffectRule + * + * @param string|null $redeemablesNoEffectRule Defines redeemables no effect rule. + * + * @return self + */ + public function setRedeemablesNoEffectRule($redeemablesNoEffectRule) + { + if (is_null($redeemablesNoEffectRule)) { + array_push($this->openAPINullablesSetToNull, 'redeemablesNoEffectRule'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemablesNoEffectRule', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRedeemablesNoEffectRuleAllowableValues(); + if (!is_null($redeemablesNoEffectRule) && !in_array($redeemablesNoEffectRule, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'redeemablesNoEffectRule', must be one of '%s'", + $redeemablesNoEffectRule, + implode("', '", $allowedValues) + ) + ); + } + $this->container['redeemablesNoEffectRule'] = $redeemablesNoEffectRule; + + 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/ValidationRule.php b/src/Model/ValidationRule.php new file mode 100644 index 0000000..7a6e7f8 --- /dev/null +++ b/src/Model/ValidationRule.php @@ -0,0 +1,1002 @@ + + */ +class ValidationRule implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRule'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'rules' => 'object', + 'error' => '\OpenAPI\Client\Model\ValidationRuleError', + 'applicableTo' => '\OpenAPI\Client\Model\ValidationRuleApplicableTo', + 'type' => 'string', + 'contextType' => 'string', + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'assignmentsCount' => 'int', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'rules' => null, + 'error' => null, + 'applicableTo' => null, + 'type' => null, + 'contextType' => null, + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'assignmentsCount' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'rules' => false, + 'error' => true, + 'applicableTo' => true, + 'type' => true, + 'contextType' => true, + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'assignmentsCount' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'rules' => 'rules', + 'error' => 'error', + 'applicableTo' => 'applicable_to', + 'type' => 'type', + 'contextType' => 'context_type', + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'assignmentsCount' => 'assignments_count', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'rules' => 'setRules', + 'error' => 'setError', + 'applicableTo' => 'setApplicableTo', + 'type' => 'setType', + 'contextType' => 'setContextType', + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'assignmentsCount' => 'setAssignmentsCount', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'rules' => 'getRules', + 'error' => 'getError', + 'applicableTo' => 'getApplicableTo', + 'type' => 'getType', + 'contextType' => 'getContextType', + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'assignmentsCount' => 'getAssignmentsCount', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_EXPRESSION = 'expression'; + public const TYPE_BASIC = 'basic'; + public const TYPE_ADVANCED = 'advanced'; + public const TYPE_COMPLEX = 'complex'; + public const CONTEXT_TYPE_EARNING_RULE_ORDER_PAID = 'earning_rule.order.paid'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT = 'earning_rule.custom_event'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED = 'earning_rule.customer.segment.entered'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED = 'earning_rule.customer.tier.joined'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT = 'earning_rule.customer.tier.left'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED = 'earning_rule.customer.tier.upgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED = 'earning_rule.customer.tier.downgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED = 'earning_rule.customer.tier.prolonged'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS = 'campaign.discount_coupons'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER = 'campaign.discount_coupons.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.discount_coupons.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS = 'campaign.gift_vouchers'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER = 'campaign.gift_vouchers.gift.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS = 'campaign.gift_vouchers.gift.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM = 'campaign.referral_program'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER = 'campaign.referral_program.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.referral_program.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.referral_program.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION = 'campaign.promotion'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER = 'campaign.promotion.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS = 'campaign.promotion.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.promotion.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.promotion.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.promotion.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM = 'campaign.loyalty_program'; + public const CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW = 'campaign.lucky_draw'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER = 'voucher.discount_voucher'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER = 'voucher.discount_voucher.discount.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'voucher.discount_voucher.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER = 'voucher.gift_voucher'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER = 'voucher.gift_voucher.gift.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS = 'voucher.gift_voucher.gift.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_LOYALTY_CARD = 'voucher.loyalty_card'; + public const CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE = 'voucher.lucky_draw_code'; + public const CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT = 'distribution.custom_event'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID = 'distribution.order.paid'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED = 'distribution.order.created'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED = 'distribution.order.canceled'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED = 'distribution.order.updated'; + public const CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS = 'reward_assignment.pay_with_points'; + public const CONTEXT_TYPE__GLOBAL = 'global'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_EXPRESSION, + self::TYPE_BASIC, + self::TYPE_ADVANCED, + self::TYPE_COMPLEX, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getContextTypeAllowableValues() + { + return [ + self::CONTEXT_TYPE_EARNING_RULE_ORDER_PAID, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_LOYALTY_CARD, + self::CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE, + self::CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED, + self::CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS, + self::CONTEXT_TYPE__GLOBAL, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('rules', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'expression'); + $this->setIfExists('contextType', $data ?? [], 'global'); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('assignmentsCount', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'validation_rules'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($this->container['contextType']) && !in_array($this->container['contextType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'contextType', must be one of '%s'", + $this->container['contextType'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Custom, unique name for set of validation rules. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets rules + * + * @return object|null + */ + public function getRules() + { + return $this->container['rules']; + } + + /** + * Sets rules + * + * @param object|null $rules Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. + * + * @return self + */ + public function setRules($rules) + { + if (is_null($rules)) { + throw new \InvalidArgumentException('non-nullable rules cannot be null'); + } + $this->container['rules'] = $rules; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\ValidationRuleError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\ValidationRuleError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ValidationRuleApplicableTo|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ValidationRuleApplicableTo|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + array_push($this->openAPINullablesSetToNull, 'applicableTo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableTo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of validation rule. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets contextType + * + * @return string|null + */ + public function getContextType() + { + return $this->container['contextType']; + } + + /** + * Sets contextType + * + * @param string|null $contextType Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | + * + * @return self + */ + public function setContextType($contextType) + { + if (is_null($contextType)) { + array_push($this->openAPINullablesSetToNull, 'contextType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('contextType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($contextType) && !in_array($contextType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'contextType', must be one of '%s'", + $contextType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['contextType'] = $contextType; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique validation rule ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets assignmentsCount + * + * @return int|null + */ + public function getAssignmentsCount() + { + return $this->container['assignmentsCount']; + } + + /** + * Sets assignmentsCount + * + * @param int|null $assignmentsCount The number of instances the validation rule has been assigned to different types of redeemables. + * + * @return self + */ + public function setAssignmentsCount($assignmentsCount) + { + if (is_null($assignmentsCount)) { + array_push($this->openAPINullablesSetToNull, 'assignmentsCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assignmentsCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assignmentsCount'] = $assignmentsCount; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the validation rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/ValidationRuleApplicableTo.php b/src/Model/ValidationRuleApplicableTo.php new file mode 100644 index 0000000..2738d99 --- /dev/null +++ b/src/Model/ValidationRuleApplicableTo.php @@ -0,0 +1,499 @@ + + */ +class ValidationRuleApplicableTo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRuleApplicableTo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'excluded' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'included' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'includedAll' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'excluded' => null, + 'included' => null, + 'includedAll' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'excluded' => true, + 'included' => true, + 'includedAll' => true + ]; + + /** + * 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 = [ + 'excluded' => 'excluded', + 'included' => 'included', + 'includedAll' => 'included_all' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'excluded' => 'setExcluded', + 'included' => 'setIncluded', + 'includedAll' => 'setIncludedAll' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'excluded' => 'getExcluded', + 'included' => 'getIncluded', + 'includedAll' => 'getIncludedAll' + ]; + + /** + * 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('excluded', $data ?? [], null); + $this->setIfExists('included', $data ?? [], null); + $this->setIfExists('includedAll', $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 excluded + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getExcluded() + { + return $this->container['excluded']; + } + + /** + * Sets excluded + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $excluded Defines which items are excluded from a discount. + * + * @return self + */ + public function setExcluded($excluded) + { + if (is_null($excluded)) { + array_push($this->openAPINullablesSetToNull, 'excluded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('excluded', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['excluded'] = $excluded; + + return $this; + } + + /** + * Gets included + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getIncluded() + { + return $this->container['included']; + } + + /** + * Sets included + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $included Defines which items are included in a discount. + * + * @return self + */ + public function setIncluded($included) + { + if (is_null($included)) { + array_push($this->openAPINullablesSetToNull, 'included'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('included', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['included'] = $included; + + return $this; + } + + /** + * Gets includedAll + * + * @return bool|null + */ + public function getIncludedAll() + { + return $this->container['includedAll']; + } + + /** + * Sets includedAll + * + * @param bool|null $includedAll Indicates whether all items are included in the discount. + * + * @return self + */ + public function setIncludedAll($includedAll) + { + if (is_null($includedAll)) { + array_push($this->openAPINullablesSetToNull, 'includedAll'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('includedAll', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['includedAll'] = $includedAll; + + 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/ValidationRuleAssignment.php b/src/Model/ValidationRuleAssignment.php new file mode 100644 index 0000000..4696c5b --- /dev/null +++ b/src/Model/ValidationRuleAssignment.php @@ -0,0 +1,697 @@ + + */ +class ValidationRuleAssignment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRuleAssignment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'ruleId' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'createdAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'ruleId' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'createdAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'ruleId' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'createdAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'ruleId' => 'rule_id', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'createdAt' => 'created_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'ruleId' => 'setRuleId', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'createdAt' => 'setCreatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'ruleId' => 'getRuleId', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'createdAt' => 'getCreatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + public const RELATED_OBJECT_TYPE_EARNING_RULE = 'earning_rule'; + public const RELATED_OBJECT_TYPE_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_DISTRIBUTION = 'distribution'; + public const OBJECT_VALIDATION_RULES_ASSIGNMENT = 'validation_rules_assignment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_CAMPAIGN, + self::RELATED_OBJECT_TYPE_EARNING_RULE, + self::RELATED_OBJECT_TYPE_REWARD_ASSIGNMENT, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_DISTRIBUTION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VALIDATION_RULES_ASSIGNMENT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('ruleId', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'validation_rules_assignment'); + } + + /** + * 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->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Validation rule assignment ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets ruleId + * + * @return string|null + */ + public function getRuleId() + { + return $this->container['ruleId']; + } + + /** + * Sets ruleId + * + * @param string|null $ruleId Validation rule ID. + * + * @return self + */ + public function setRuleId($ruleId) + { + if (is_null($ruleId)) { + array_push($this->openAPINullablesSetToNull, 'ruleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ruleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ruleId'] = $ruleId; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId The resource ID to which the validation rule was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType The type of resource to which the validation rule was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the ID. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ValidationRuleAssignmentsList.php b/src/Model/ValidationRuleAssignmentsList.php new file mode 100644 index 0000000..4cf130a --- /dev/null +++ b/src/Model/ValidationRuleAssignmentsList.php @@ -0,0 +1,541 @@ + + */ +class ValidationRuleAssignmentsList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRuleAssignmentsList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\ValidationRuleAssignment[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about validation rule assignments. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of validation rule assignments. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignment[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignment[]|null $data A dictionary that contains an array of validation rule assignments. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of validation rule assignments. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/ValidationRuleError.php b/src/Model/ValidationRuleError.php new file mode 100644 index 0000000..119cb4d --- /dev/null +++ b/src/Model/ValidationRuleError.php @@ -0,0 +1,418 @@ + + */ +class ValidationRuleError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRuleError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true + ]; + + /** + * 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 = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * 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('message', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message The error message returned from API when validation / redemption fails to meet requirements of defined rules. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + 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/ValidationRulesAssignmentsCreateRequestBody.php b/src/Model/ValidationRulesAssignmentsCreateRequestBody.php new file mode 100644 index 0000000..2a69d47 --- /dev/null +++ b/src/Model/ValidationRulesAssignmentsCreateRequestBody.php @@ -0,0 +1,501 @@ + + */ +class ValidationRulesAssignmentsCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesAssignmentsCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'relatedObjectType' => 'string', + 'relatedObjectId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'relatedObjectType' => null, + 'relatedObjectId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'relatedObjectType' => true, + 'relatedObjectId' => true + ]; + + /** + * 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 = [ + 'relatedObjectType' => 'related_object_type', + 'relatedObjectId' => 'related_object_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'relatedObjectType' => 'setRelatedObjectType', + 'relatedObjectId' => 'setRelatedObjectId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'relatedObjectType' => 'getRelatedObjectType', + 'relatedObjectId' => 'getRelatedObjectId' + ]; + + /** + * 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 RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + public const RELATED_OBJECT_TYPE_EARNING_RULE = 'earning_rule'; + public const RELATED_OBJECT_TYPE_DISTRIBUTION = 'distribution'; + public const RELATED_OBJECT_TYPE_REWARD_ASSIGNMENT = 'reward_assignment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_CAMPAIGN, + self::RELATED_OBJECT_TYPE_EARNING_RULE, + self::RELATED_OBJECT_TYPE_DISTRIBUTION, + self::RELATED_OBJECT_TYPE_REWARD_ASSIGNMENT, + ]; + } + + /** + * 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('relatedObjectType', $data ?? [], 'voucher'); + $this->setIfExists('relatedObjectId', $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->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + 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 relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType Defines the related object, e.g. `voucher`. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId Unique related object ID assigned by Voucherify, e.g. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + 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/ValidationRulesAssignmentsCreateResponseBody.php b/src/Model/ValidationRulesAssignmentsCreateResponseBody.php new file mode 100644 index 0000000..7ee1c64 --- /dev/null +++ b/src/Model/ValidationRulesAssignmentsCreateResponseBody.php @@ -0,0 +1,697 @@ + + */ +class ValidationRulesAssignmentsCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesAssignmentsCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'ruleId' => 'string', + 'relatedObjectId' => 'string', + 'relatedObjectType' => 'string', + 'createdAt' => '\DateTime', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'ruleId' => null, + 'relatedObjectId' => null, + 'relatedObjectType' => null, + 'createdAt' => 'date-time', + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'ruleId' => true, + 'relatedObjectId' => true, + 'relatedObjectType' => true, + 'createdAt' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'ruleId' => 'rule_id', + 'relatedObjectId' => 'related_object_id', + 'relatedObjectType' => 'related_object_type', + 'createdAt' => 'created_at', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'ruleId' => 'setRuleId', + 'relatedObjectId' => 'setRelatedObjectId', + 'relatedObjectType' => 'setRelatedObjectType', + 'createdAt' => 'setCreatedAt', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'ruleId' => 'getRuleId', + 'relatedObjectId' => 'getRelatedObjectId', + 'relatedObjectType' => 'getRelatedObjectType', + 'createdAt' => 'getCreatedAt', + 'object' => 'getObject' + ]; + + /** + * 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 RELATED_OBJECT_TYPE_VOUCHER = 'voucher'; + public const RELATED_OBJECT_TYPE_CAMPAIGN = 'campaign'; + public const RELATED_OBJECT_TYPE_EARNING_RULE = 'earning_rule'; + public const RELATED_OBJECT_TYPE_REWARD_ASSIGNMENT = 'reward_assignment'; + public const RELATED_OBJECT_TYPE_PROMOTION_TIER = 'promotion_tier'; + public const RELATED_OBJECT_TYPE_DISTRIBUTION = 'distribution'; + public const OBJECT_VALIDATION_RULES_ASSIGNMENT = 'validation_rules_assignment'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelatedObjectTypeAllowableValues() + { + return [ + self::RELATED_OBJECT_TYPE_VOUCHER, + self::RELATED_OBJECT_TYPE_CAMPAIGN, + self::RELATED_OBJECT_TYPE_EARNING_RULE, + self::RELATED_OBJECT_TYPE_REWARD_ASSIGNMENT, + self::RELATED_OBJECT_TYPE_PROMOTION_TIER, + self::RELATED_OBJECT_TYPE_DISTRIBUTION, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VALIDATION_RULES_ASSIGNMENT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('ruleId', $data ?? [], null); + $this->setIfExists('relatedObjectId', $data ?? [], null); + $this->setIfExists('relatedObjectType', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'validation_rules_assignment'); + } + + /** + * 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->getRelatedObjectTypeAllowableValues(); + if (!is_null($this->container['relatedObjectType']) && !in_array($this->container['relatedObjectType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $this->container['relatedObjectType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Validation rule assignment ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets ruleId + * + * @return string|null + */ + public function getRuleId() + { + return $this->container['ruleId']; + } + + /** + * Sets ruleId + * + * @param string|null $ruleId Validation rule ID. + * + * @return self + */ + public function setRuleId($ruleId) + { + if (is_null($ruleId)) { + array_push($this->openAPINullablesSetToNull, 'ruleId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ruleId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ruleId'] = $ruleId; + + return $this; + } + + /** + * Gets relatedObjectId + * + * @return string|null + */ + public function getRelatedObjectId() + { + return $this->container['relatedObjectId']; + } + + /** + * Sets relatedObjectId + * + * @param string|null $relatedObjectId The resource ID to which the validation rule was assigned. + * + * @return self + */ + public function setRelatedObjectId($relatedObjectId) + { + if (is_null($relatedObjectId)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObjectId'] = $relatedObjectId; + + return $this; + } + + /** + * Gets relatedObjectType + * + * @return string|null + */ + public function getRelatedObjectType() + { + return $this->container['relatedObjectType']; + } + + /** + * Sets relatedObjectType + * + * @param string|null $relatedObjectType The type of resource to which the validation rule was assigned. + * + * @return self + */ + public function setRelatedObjectType($relatedObjectType) + { + if (is_null($relatedObjectType)) { + array_push($this->openAPINullablesSetToNull, 'relatedObjectType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObjectType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRelatedObjectTypeAllowableValues(); + if (!is_null($relatedObjectType) && !in_array($relatedObjectType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relatedObjectType', must be one of '%s'", + $relatedObjectType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relatedObjectType'] = $relatedObjectType; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the ID. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + 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/ValidationRulesAssignmentsList.php b/src/Model/ValidationRulesAssignmentsList.php new file mode 100644 index 0000000..f363730 --- /dev/null +++ b/src/Model/ValidationRulesAssignmentsList.php @@ -0,0 +1,614 @@ + + */ +class ValidationRulesAssignmentsList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesAssignmentsList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\BusValRuleAssignment[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_DATA = 'data'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_DATA, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['total']) && ($this->container['total'] < 0)) { + $invalidProperties[] = "invalid value for 'total', must be bigger than or equal to 0."; + } + + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about validation rules assignments. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of validation rules assignments. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\BusValRuleAssignment[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\BusValRuleAssignment[]|null $data Contains array of validation rules assignments. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of validation rules assignments. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($total) && ($total < 0)) { + throw new \InvalidArgumentException('invalid value for $total when calling ValidationRulesAssignmentsList., must be bigger than or equal to 0.'); + } + + $this->container['total'] = $total; + + 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/ValidationRulesAssignmentsListResponseBody.php b/src/Model/ValidationRulesAssignmentsListResponseBody.php new file mode 100644 index 0000000..c408dd5 --- /dev/null +++ b/src/Model/ValidationRulesAssignmentsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class ValidationRulesAssignmentsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesAssignmentsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\ValidationRuleAssignment[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about validation rule assignments. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the JSON property that contains the array of validation rule assignments. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\ValidationRuleAssignment[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\ValidationRuleAssignment[]|null $data A dictionary that contains an array of validation rule assignments. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of validation rule assignments. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/ValidationRulesCreateRequestBody.php b/src/Model/ValidationRulesCreateRequestBody.php new file mode 100644 index 0000000..8ae760f --- /dev/null +++ b/src/Model/ValidationRulesCreateRequestBody.php @@ -0,0 +1,798 @@ + + */ +class ValidationRulesCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'rules' => 'object', + 'error' => '\OpenAPI\Client\Model\ValidationRulesCreateRequestBodyError', + 'applicableTo' => '\OpenAPI\Client\Model\ValidationRulesCreateRequestBodyApplicableTo', + 'type' => 'string', + 'contextType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'rules' => null, + 'error' => null, + 'applicableTo' => null, + 'type' => null, + 'contextType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'rules' => false, + 'error' => true, + 'applicableTo' => true, + 'type' => true, + 'contextType' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'rules' => 'rules', + 'error' => 'error', + 'applicableTo' => 'applicable_to', + 'type' => 'type', + 'contextType' => 'context_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'rules' => 'setRules', + 'error' => 'setError', + 'applicableTo' => 'setApplicableTo', + 'type' => 'setType', + 'contextType' => 'setContextType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'rules' => 'getRules', + 'error' => 'getError', + 'applicableTo' => 'getApplicableTo', + 'type' => 'getType', + 'contextType' => 'getContextType' + ]; + + /** + * 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 TYPE_EXPRESSION = 'expression'; + public const TYPE_BASIC = 'basic'; + public const TYPE_ADVANCED = 'advanced'; + public const TYPE_COMPLEX = 'complex'; + public const CONTEXT_TYPE_EARNING_RULE_ORDER_PAID = 'earning_rule.order.paid'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT = 'earning_rule.custom_event'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED = 'earning_rule.customer.segment.entered'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED = 'earning_rule.customer.tier.joined'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT = 'earning_rule.customer.tier.left'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED = 'earning_rule.customer.tier.upgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED = 'earning_rule.customer.tier.downgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED = 'earning_rule.customer.tier.prolonged'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS = 'campaign.discount_coupons'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER = 'campaign.discount_coupons.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.discount_coupons.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS = 'campaign.gift_vouchers'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER = 'campaign.gift_vouchers.gift.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS = 'campaign.gift_vouchers.gift.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM = 'campaign.referral_program'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER = 'campaign.referral_program.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.referral_program.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.referral_program.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION = 'campaign.promotion'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER = 'campaign.promotion.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS = 'campaign.promotion.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.promotion.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.promotion.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.promotion.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM = 'campaign.loyalty_program'; + public const CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW = 'campaign.lucky_draw'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER = 'voucher.discount_voucher'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER = 'voucher.discount_voucher.discount.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'voucher.discount_voucher.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER = 'voucher.gift_voucher'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER = 'voucher.gift_voucher.gift.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS = 'voucher.gift_voucher.gift.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_LOYALTY_CARD = 'voucher.loyalty_card'; + public const CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE = 'voucher.lucky_draw_code'; + public const CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT = 'distribution.custom_event'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID = 'distribution.order.paid'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED = 'distribution.order.created'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED = 'distribution.order.canceled'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED = 'distribution.order.updated'; + public const CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS = 'reward_assignment.pay_with_points'; + public const CONTEXT_TYPE__GLOBAL = 'global'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_EXPRESSION, + self::TYPE_BASIC, + self::TYPE_ADVANCED, + self::TYPE_COMPLEX, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getContextTypeAllowableValues() + { + return [ + self::CONTEXT_TYPE_EARNING_RULE_ORDER_PAID, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_LOYALTY_CARD, + self::CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE, + self::CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED, + self::CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS, + self::CONTEXT_TYPE__GLOBAL, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('rules', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'expression'); + $this->setIfExists('contextType', $data ?? [], 'global'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($this->container['contextType']) && !in_array($this->container['contextType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'contextType', must be one of '%s'", + $this->container['contextType'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Custom, unique name for set of validation rules. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets rules + * + * @return object|null + */ + public function getRules() + { + return $this->container['rules']; + } + + /** + * Sets rules + * + * @param object|null $rules Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. + * + * @return self + */ + public function setRules($rules) + { + if (is_null($rules)) { + throw new \InvalidArgumentException('non-nullable rules cannot be null'); + } + $this->container['rules'] = $rules; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\ValidationRulesCreateRequestBodyError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateRequestBodyError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ValidationRulesCreateRequestBodyApplicableTo|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateRequestBodyApplicableTo|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + array_push($this->openAPINullablesSetToNull, 'applicableTo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableTo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of validation rule. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets contextType + * + * @return string|null + */ + public function getContextType() + { + return $this->container['contextType']; + } + + /** + * Sets contextType + * + * @param string|null $contextType Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | + * + * @return self + */ + public function setContextType($contextType) + { + if (is_null($contextType)) { + array_push($this->openAPINullablesSetToNull, 'contextType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('contextType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($contextType) && !in_array($contextType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'contextType', must be one of '%s'", + $contextType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['contextType'] = $contextType; + + 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/ValidationRulesCreateRequestBodyApplicableTo.php b/src/Model/ValidationRulesCreateRequestBodyApplicableTo.php new file mode 100644 index 0000000..7c7ece2 --- /dev/null +++ b/src/Model/ValidationRulesCreateRequestBodyApplicableTo.php @@ -0,0 +1,499 @@ + + */ +class ValidationRulesCreateRequestBodyApplicableTo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesCreateRequestBodyApplicableTo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'excluded' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'included' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'includedAll' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'excluded' => null, + 'included' => null, + 'includedAll' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'excluded' => true, + 'included' => true, + 'includedAll' => true + ]; + + /** + * 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 = [ + 'excluded' => 'excluded', + 'included' => 'included', + 'includedAll' => 'included_all' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'excluded' => 'setExcluded', + 'included' => 'setIncluded', + 'includedAll' => 'setIncludedAll' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'excluded' => 'getExcluded', + 'included' => 'getIncluded', + 'includedAll' => 'getIncludedAll' + ]; + + /** + * 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('excluded', $data ?? [], null); + $this->setIfExists('included', $data ?? [], null); + $this->setIfExists('includedAll', $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 excluded + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getExcluded() + { + return $this->container['excluded']; + } + + /** + * Sets excluded + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $excluded Defines which items are excluded from a discount. + * + * @return self + */ + public function setExcluded($excluded) + { + if (is_null($excluded)) { + array_push($this->openAPINullablesSetToNull, 'excluded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('excluded', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['excluded'] = $excluded; + + return $this; + } + + /** + * Gets included + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getIncluded() + { + return $this->container['included']; + } + + /** + * Sets included + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $included Defines which items are included in a discount. + * + * @return self + */ + public function setIncluded($included) + { + if (is_null($included)) { + array_push($this->openAPINullablesSetToNull, 'included'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('included', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['included'] = $included; + + return $this; + } + + /** + * Gets includedAll + * + * @return bool|null + */ + public function getIncludedAll() + { + return $this->container['includedAll']; + } + + /** + * Sets includedAll + * + * @param bool|null $includedAll Indicates whether all items are included in the discount. + * + * @return self + */ + public function setIncludedAll($includedAll) + { + if (is_null($includedAll)) { + array_push($this->openAPINullablesSetToNull, 'includedAll'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('includedAll', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['includedAll'] = $includedAll; + + 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/ValidationRulesCreateRequestBodyError.php b/src/Model/ValidationRulesCreateRequestBodyError.php new file mode 100644 index 0000000..b7a85a5 --- /dev/null +++ b/src/Model/ValidationRulesCreateRequestBodyError.php @@ -0,0 +1,418 @@ + + */ +class ValidationRulesCreateRequestBodyError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesCreateRequestBodyError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true + ]; + + /** + * 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 = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * 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('message', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message The error message returned from API when validation / redemption fails to meet requirements of defined rules. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + 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/ValidationRulesCreateResponseBody.php b/src/Model/ValidationRulesCreateResponseBody.php new file mode 100644 index 0000000..8f5f992 --- /dev/null +++ b/src/Model/ValidationRulesCreateResponseBody.php @@ -0,0 +1,1003 @@ + + */ +class ValidationRulesCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'rules' => 'object', + 'error' => '\OpenAPI\Client\Model\ValidationRulesCreateResponseBodyError', + 'applicableTo' => '\OpenAPI\Client\Model\ValidationRulesCreateResponseBodyApplicableTo', + 'type' => 'string', + 'contextType' => 'string', + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'assignmentsCount' => 'int', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'rules' => null, + 'error' => null, + 'applicableTo' => null, + 'type' => null, + 'contextType' => null, + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'assignmentsCount' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'rules' => false, + 'error' => true, + 'applicableTo' => true, + 'type' => true, + 'contextType' => true, + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'assignmentsCount' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'rules' => 'rules', + 'error' => 'error', + 'applicableTo' => 'applicable_to', + 'type' => 'type', + 'contextType' => 'context_type', + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'assignmentsCount' => 'assignments_count', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'rules' => 'setRules', + 'error' => 'setError', + 'applicableTo' => 'setApplicableTo', + 'type' => 'setType', + 'contextType' => 'setContextType', + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'assignmentsCount' => 'setAssignmentsCount', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'rules' => 'getRules', + 'error' => 'getError', + 'applicableTo' => 'getApplicableTo', + 'type' => 'getType', + 'contextType' => 'getContextType', + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'assignmentsCount' => 'getAssignmentsCount', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_EXPRESSION = 'expression'; + public const TYPE_BASIC = 'basic'; + public const TYPE_ADVANCED = 'advanced'; + public const TYPE_COMPLEX = 'complex'; + public const CONTEXT_TYPE_EARNING_RULE_ORDER_PAID = 'earning_rule.order.paid'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT = 'earning_rule.custom_event'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED = 'earning_rule.customer.segment.entered'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED = 'earning_rule.customer.tier.joined'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT = 'earning_rule.customer.tier.left'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED = 'earning_rule.customer.tier.upgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED = 'earning_rule.customer.tier.downgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED = 'earning_rule.customer.tier.prolonged'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS = 'campaign.discount_coupons'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER = 'campaign.discount_coupons.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.discount_coupons.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS = 'campaign.gift_vouchers'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER = 'campaign.gift_vouchers.gift.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS = 'campaign.gift_vouchers.gift.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM = 'campaign.referral_program'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER = 'campaign.referral_program.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.referral_program.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.referral_program.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION = 'campaign.promotion'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER = 'campaign.promotion.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS = 'campaign.promotion.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.promotion.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.promotion.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.promotion.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM = 'campaign.loyalty_program'; + public const CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW = 'campaign.lucky_draw'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER = 'voucher.discount_voucher'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER = 'voucher.discount_voucher.discount.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'voucher.discount_voucher.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER = 'voucher.gift_voucher'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER = 'voucher.gift_voucher.gift.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS = 'voucher.gift_voucher.gift.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_LOYALTY_CARD = 'voucher.loyalty_card'; + public const CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE = 'voucher.lucky_draw_code'; + public const CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT = 'distribution.custom_event'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID = 'distribution.order.paid'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED = 'distribution.order.created'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED = 'distribution.order.canceled'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED = 'distribution.order.updated'; + public const CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS = 'reward_assignment.pay_with_points'; + public const CONTEXT_TYPE__GLOBAL = 'global'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_EXPRESSION, + self::TYPE_BASIC, + self::TYPE_ADVANCED, + self::TYPE_COMPLEX, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getContextTypeAllowableValues() + { + return [ + self::CONTEXT_TYPE_EARNING_RULE_ORDER_PAID, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_LOYALTY_CARD, + self::CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE, + self::CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED, + self::CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS, + self::CONTEXT_TYPE__GLOBAL, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('rules', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'expression'); + $this->setIfExists('contextType', $data ?? [], 'global'); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('assignmentsCount', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'validation_rules'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($this->container['contextType']) && !in_array($this->container['contextType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'contextType', must be one of '%s'", + $this->container['contextType'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Custom, unique name for set of validation rules. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets rules + * + * @return object|null + */ + public function getRules() + { + return $this->container['rules']; + } + + /** + * Sets rules + * + * @param object|null $rules Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. + * + * @return self + */ + public function setRules($rules) + { + if (is_null($rules)) { + throw new \InvalidArgumentException('non-nullable rules cannot be null'); + } + $this->container['rules'] = $rules; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\ValidationRulesCreateResponseBodyError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateResponseBodyError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ValidationRulesCreateResponseBodyApplicableTo|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ValidationRulesCreateResponseBodyApplicableTo|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + array_push($this->openAPINullablesSetToNull, 'applicableTo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableTo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of validation rule. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets contextType + * + * @return string|null + */ + public function getContextType() + { + return $this->container['contextType']; + } + + /** + * Sets contextType + * + * @param string|null $contextType Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | + * + * @return self + */ + public function setContextType($contextType) + { + if (is_null($contextType)) { + array_push($this->openAPINullablesSetToNull, 'contextType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('contextType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($contextType) && !in_array($contextType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'contextType', must be one of '%s'", + $contextType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['contextType'] = $contextType; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique validation rule ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets assignmentsCount + * + * @return int|null + */ + public function getAssignmentsCount() + { + return $this->container['assignmentsCount']; + } + + /** + * Sets assignmentsCount + * + * @param int|null $assignmentsCount The number of instances the validation rule has been assigned to different types of redeemables. + * + * @return self + */ + public function setAssignmentsCount($assignmentsCount) + { + if (is_null($assignmentsCount)) { + array_push($this->openAPINullablesSetToNull, 'assignmentsCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assignmentsCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assignmentsCount'] = $assignmentsCount; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the validation rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/ValidationRulesCreateResponseBodyApplicableTo.php b/src/Model/ValidationRulesCreateResponseBodyApplicableTo.php new file mode 100644 index 0000000..eb627ca --- /dev/null +++ b/src/Model/ValidationRulesCreateResponseBodyApplicableTo.php @@ -0,0 +1,499 @@ + + */ +class ValidationRulesCreateResponseBodyApplicableTo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesCreateResponseBodyApplicableTo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'excluded' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'included' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'includedAll' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'excluded' => null, + 'included' => null, + 'includedAll' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'excluded' => true, + 'included' => true, + 'includedAll' => true + ]; + + /** + * 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 = [ + 'excluded' => 'excluded', + 'included' => 'included', + 'includedAll' => 'included_all' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'excluded' => 'setExcluded', + 'included' => 'setIncluded', + 'includedAll' => 'setIncludedAll' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'excluded' => 'getExcluded', + 'included' => 'getIncluded', + 'includedAll' => 'getIncludedAll' + ]; + + /** + * 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('excluded', $data ?? [], null); + $this->setIfExists('included', $data ?? [], null); + $this->setIfExists('includedAll', $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 excluded + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getExcluded() + { + return $this->container['excluded']; + } + + /** + * Sets excluded + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $excluded Defines which items are excluded from a discount. + * + * @return self + */ + public function setExcluded($excluded) + { + if (is_null($excluded)) { + array_push($this->openAPINullablesSetToNull, 'excluded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('excluded', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['excluded'] = $excluded; + + return $this; + } + + /** + * Gets included + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getIncluded() + { + return $this->container['included']; + } + + /** + * Sets included + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $included Defines which items are included in a discount. + * + * @return self + */ + public function setIncluded($included) + { + if (is_null($included)) { + array_push($this->openAPINullablesSetToNull, 'included'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('included', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['included'] = $included; + + return $this; + } + + /** + * Gets includedAll + * + * @return bool|null + */ + public function getIncludedAll() + { + return $this->container['includedAll']; + } + + /** + * Sets includedAll + * + * @param bool|null $includedAll Indicates whether all items are included in the discount. + * + * @return self + */ + public function setIncludedAll($includedAll) + { + if (is_null($includedAll)) { + array_push($this->openAPINullablesSetToNull, 'includedAll'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('includedAll', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['includedAll'] = $includedAll; + + 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/ValidationRulesCreateResponseBodyError.php b/src/Model/ValidationRulesCreateResponseBodyError.php new file mode 100644 index 0000000..13220aa --- /dev/null +++ b/src/Model/ValidationRulesCreateResponseBodyError.php @@ -0,0 +1,418 @@ + + */ +class ValidationRulesCreateResponseBodyError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesCreateResponseBodyError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true + ]; + + /** + * 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 = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * 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('message', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message The error message returned from API when validation / redemption fails to meet requirements of defined rules. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + 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/ValidationRulesGetResponseBody.php b/src/Model/ValidationRulesGetResponseBody.php new file mode 100644 index 0000000..b83bb4c --- /dev/null +++ b/src/Model/ValidationRulesGetResponseBody.php @@ -0,0 +1,1003 @@ + + */ +class ValidationRulesGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'rules' => 'object', + 'error' => '\OpenAPI\Client\Model\ValidationRulesGetResponseBodyError', + 'applicableTo' => '\OpenAPI\Client\Model\ValidationRulesGetResponseBodyApplicableTo', + 'type' => 'string', + 'contextType' => 'string', + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'assignmentsCount' => 'int', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'rules' => null, + 'error' => null, + 'applicableTo' => null, + 'type' => null, + 'contextType' => null, + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'assignmentsCount' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'rules' => false, + 'error' => true, + 'applicableTo' => true, + 'type' => true, + 'contextType' => true, + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'assignmentsCount' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'rules' => 'rules', + 'error' => 'error', + 'applicableTo' => 'applicable_to', + 'type' => 'type', + 'contextType' => 'context_type', + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'assignmentsCount' => 'assignments_count', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'rules' => 'setRules', + 'error' => 'setError', + 'applicableTo' => 'setApplicableTo', + 'type' => 'setType', + 'contextType' => 'setContextType', + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'assignmentsCount' => 'setAssignmentsCount', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'rules' => 'getRules', + 'error' => 'getError', + 'applicableTo' => 'getApplicableTo', + 'type' => 'getType', + 'contextType' => 'getContextType', + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'assignmentsCount' => 'getAssignmentsCount', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_EXPRESSION = 'expression'; + public const TYPE_BASIC = 'basic'; + public const TYPE_ADVANCED = 'advanced'; + public const TYPE_COMPLEX = 'complex'; + public const CONTEXT_TYPE_EARNING_RULE_ORDER_PAID = 'earning_rule.order.paid'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT = 'earning_rule.custom_event'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED = 'earning_rule.customer.segment.entered'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED = 'earning_rule.customer.tier.joined'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT = 'earning_rule.customer.tier.left'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED = 'earning_rule.customer.tier.upgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED = 'earning_rule.customer.tier.downgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED = 'earning_rule.customer.tier.prolonged'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS = 'campaign.discount_coupons'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER = 'campaign.discount_coupons.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.discount_coupons.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS = 'campaign.gift_vouchers'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER = 'campaign.gift_vouchers.gift.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS = 'campaign.gift_vouchers.gift.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM = 'campaign.referral_program'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER = 'campaign.referral_program.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.referral_program.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.referral_program.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION = 'campaign.promotion'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER = 'campaign.promotion.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS = 'campaign.promotion.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.promotion.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.promotion.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.promotion.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM = 'campaign.loyalty_program'; + public const CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW = 'campaign.lucky_draw'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER = 'voucher.discount_voucher'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER = 'voucher.discount_voucher.discount.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'voucher.discount_voucher.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER = 'voucher.gift_voucher'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER = 'voucher.gift_voucher.gift.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS = 'voucher.gift_voucher.gift.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_LOYALTY_CARD = 'voucher.loyalty_card'; + public const CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE = 'voucher.lucky_draw_code'; + public const CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT = 'distribution.custom_event'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID = 'distribution.order.paid'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED = 'distribution.order.created'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED = 'distribution.order.canceled'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED = 'distribution.order.updated'; + public const CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS = 'reward_assignment.pay_with_points'; + public const CONTEXT_TYPE__GLOBAL = 'global'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_EXPRESSION, + self::TYPE_BASIC, + self::TYPE_ADVANCED, + self::TYPE_COMPLEX, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getContextTypeAllowableValues() + { + return [ + self::CONTEXT_TYPE_EARNING_RULE_ORDER_PAID, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_LOYALTY_CARD, + self::CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE, + self::CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED, + self::CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS, + self::CONTEXT_TYPE__GLOBAL, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('rules', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'expression'); + $this->setIfExists('contextType', $data ?? [], 'global'); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('assignmentsCount', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'validation_rules'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($this->container['contextType']) && !in_array($this->container['contextType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'contextType', must be one of '%s'", + $this->container['contextType'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Custom, unique name for set of validation rules. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets rules + * + * @return object|null + */ + public function getRules() + { + return $this->container['rules']; + } + + /** + * Sets rules + * + * @param object|null $rules Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. + * + * @return self + */ + public function setRules($rules) + { + if (is_null($rules)) { + throw new \InvalidArgumentException('non-nullable rules cannot be null'); + } + $this->container['rules'] = $rules; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\ValidationRulesGetResponseBodyError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\ValidationRulesGetResponseBodyError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ValidationRulesGetResponseBodyApplicableTo|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ValidationRulesGetResponseBodyApplicableTo|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + array_push($this->openAPINullablesSetToNull, 'applicableTo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableTo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of validation rule. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets contextType + * + * @return string|null + */ + public function getContextType() + { + return $this->container['contextType']; + } + + /** + * Sets contextType + * + * @param string|null $contextType Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | + * + * @return self + */ + public function setContextType($contextType) + { + if (is_null($contextType)) { + array_push($this->openAPINullablesSetToNull, 'contextType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('contextType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($contextType) && !in_array($contextType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'contextType', must be one of '%s'", + $contextType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['contextType'] = $contextType; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique validation rule ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets assignmentsCount + * + * @return int|null + */ + public function getAssignmentsCount() + { + return $this->container['assignmentsCount']; + } + + /** + * Sets assignmentsCount + * + * @param int|null $assignmentsCount The number of instances the validation rule has been assigned to different types of redeemables. + * + * @return self + */ + public function setAssignmentsCount($assignmentsCount) + { + if (is_null($assignmentsCount)) { + array_push($this->openAPINullablesSetToNull, 'assignmentsCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assignmentsCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assignmentsCount'] = $assignmentsCount; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the validation rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/ValidationRulesGetResponseBodyApplicableTo.php b/src/Model/ValidationRulesGetResponseBodyApplicableTo.php new file mode 100644 index 0000000..b7dcf88 --- /dev/null +++ b/src/Model/ValidationRulesGetResponseBodyApplicableTo.php @@ -0,0 +1,499 @@ + + */ +class ValidationRulesGetResponseBodyApplicableTo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesGetResponseBodyApplicableTo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'excluded' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'included' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'includedAll' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'excluded' => null, + 'included' => null, + 'includedAll' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'excluded' => true, + 'included' => true, + 'includedAll' => true + ]; + + /** + * 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 = [ + 'excluded' => 'excluded', + 'included' => 'included', + 'includedAll' => 'included_all' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'excluded' => 'setExcluded', + 'included' => 'setIncluded', + 'includedAll' => 'setIncludedAll' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'excluded' => 'getExcluded', + 'included' => 'getIncluded', + 'includedAll' => 'getIncludedAll' + ]; + + /** + * 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('excluded', $data ?? [], null); + $this->setIfExists('included', $data ?? [], null); + $this->setIfExists('includedAll', $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 excluded + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getExcluded() + { + return $this->container['excluded']; + } + + /** + * Sets excluded + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $excluded Defines which items are excluded from a discount. + * + * @return self + */ + public function setExcluded($excluded) + { + if (is_null($excluded)) { + array_push($this->openAPINullablesSetToNull, 'excluded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('excluded', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['excluded'] = $excluded; + + return $this; + } + + /** + * Gets included + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getIncluded() + { + return $this->container['included']; + } + + /** + * Sets included + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $included Defines which items are included in a discount. + * + * @return self + */ + public function setIncluded($included) + { + if (is_null($included)) { + array_push($this->openAPINullablesSetToNull, 'included'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('included', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['included'] = $included; + + return $this; + } + + /** + * Gets includedAll + * + * @return bool|null + */ + public function getIncludedAll() + { + return $this->container['includedAll']; + } + + /** + * Sets includedAll + * + * @param bool|null $includedAll Indicates whether all items are included in the discount. + * + * @return self + */ + public function setIncludedAll($includedAll) + { + if (is_null($includedAll)) { + array_push($this->openAPINullablesSetToNull, 'includedAll'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('includedAll', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['includedAll'] = $includedAll; + + 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/ValidationRulesGetResponseBodyError.php b/src/Model/ValidationRulesGetResponseBodyError.php new file mode 100644 index 0000000..06b2b8e --- /dev/null +++ b/src/Model/ValidationRulesGetResponseBodyError.php @@ -0,0 +1,418 @@ + + */ +class ValidationRulesGetResponseBodyError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesGetResponseBodyError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true + ]; + + /** + * 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 = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * 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('message', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message The error message returned from API when validation / redemption fails to meet requirements of defined rules. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + 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/ValidationRulesListResponseBody.php b/src/Model/ValidationRulesListResponseBody.php new file mode 100644 index 0000000..1fa57b2 --- /dev/null +++ b/src/Model/ValidationRulesListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class ValidationRulesListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\ValidationRule[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'total' => 'getTotal' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about validation rules. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of validation rules. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\ValidationRule[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\ValidationRule[]|null $data An array of validation rules. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of validation rules in the project. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/ValidationRulesUpdateRequestBody.php b/src/Model/ValidationRulesUpdateRequestBody.php new file mode 100644 index 0000000..e1e3a74 --- /dev/null +++ b/src/Model/ValidationRulesUpdateRequestBody.php @@ -0,0 +1,798 @@ + + */ +class ValidationRulesUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'rules' => 'object', + 'error' => '\OpenAPI\Client\Model\ValidationRulesUpdateRequestBodyError', + 'applicableTo' => '\OpenAPI\Client\Model\ValidationRulesUpdateRequestBodyApplicableTo', + 'type' => 'string', + 'contextType' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'rules' => null, + 'error' => null, + 'applicableTo' => null, + 'type' => null, + 'contextType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'rules' => false, + 'error' => true, + 'applicableTo' => true, + 'type' => true, + 'contextType' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'rules' => 'rules', + 'error' => 'error', + 'applicableTo' => 'applicable_to', + 'type' => 'type', + 'contextType' => 'context_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'rules' => 'setRules', + 'error' => 'setError', + 'applicableTo' => 'setApplicableTo', + 'type' => 'setType', + 'contextType' => 'setContextType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'rules' => 'getRules', + 'error' => 'getError', + 'applicableTo' => 'getApplicableTo', + 'type' => 'getType', + 'contextType' => 'getContextType' + ]; + + /** + * 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 TYPE_EXPRESSION = 'expression'; + public const TYPE_BASIC = 'basic'; + public const TYPE_ADVANCED = 'advanced'; + public const TYPE_COMPLEX = 'complex'; + public const CONTEXT_TYPE_EARNING_RULE_ORDER_PAID = 'earning_rule.order.paid'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT = 'earning_rule.custom_event'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED = 'earning_rule.customer.segment.entered'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED = 'earning_rule.customer.tier.joined'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT = 'earning_rule.customer.tier.left'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED = 'earning_rule.customer.tier.upgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED = 'earning_rule.customer.tier.downgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED = 'earning_rule.customer.tier.prolonged'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS = 'campaign.discount_coupons'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER = 'campaign.discount_coupons.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.discount_coupons.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS = 'campaign.gift_vouchers'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER = 'campaign.gift_vouchers.gift.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS = 'campaign.gift_vouchers.gift.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM = 'campaign.referral_program'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER = 'campaign.referral_program.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.referral_program.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.referral_program.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION = 'campaign.promotion'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER = 'campaign.promotion.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS = 'campaign.promotion.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.promotion.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.promotion.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.promotion.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM = 'campaign.loyalty_program'; + public const CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW = 'campaign.lucky_draw'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER = 'voucher.discount_voucher'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER = 'voucher.discount_voucher.discount.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'voucher.discount_voucher.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER = 'voucher.gift_voucher'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER = 'voucher.gift_voucher.gift.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS = 'voucher.gift_voucher.gift.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_LOYALTY_CARD = 'voucher.loyalty_card'; + public const CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE = 'voucher.lucky_draw_code'; + public const CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT = 'distribution.custom_event'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID = 'distribution.order.paid'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED = 'distribution.order.created'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED = 'distribution.order.canceled'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED = 'distribution.order.updated'; + public const CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS = 'reward_assignment.pay_with_points'; + public const CONTEXT_TYPE__GLOBAL = 'global'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_EXPRESSION, + self::TYPE_BASIC, + self::TYPE_ADVANCED, + self::TYPE_COMPLEX, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getContextTypeAllowableValues() + { + return [ + self::CONTEXT_TYPE_EARNING_RULE_ORDER_PAID, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_LOYALTY_CARD, + self::CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE, + self::CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED, + self::CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS, + self::CONTEXT_TYPE__GLOBAL, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('rules', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'expression'); + $this->setIfExists('contextType', $data ?? [], 'global'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($this->container['contextType']) && !in_array($this->container['contextType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'contextType', must be one of '%s'", + $this->container['contextType'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Custom, unique name for set of validation rules. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets rules + * + * @return object|null + */ + public function getRules() + { + return $this->container['rules']; + } + + /** + * Sets rules + * + * @param object|null $rules Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. + * + * @return self + */ + public function setRules($rules) + { + if (is_null($rules)) { + throw new \InvalidArgumentException('non-nullable rules cannot be null'); + } + $this->container['rules'] = $rules; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\ValidationRulesUpdateRequestBodyError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\ValidationRulesUpdateRequestBodyError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ValidationRulesUpdateRequestBodyApplicableTo|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ValidationRulesUpdateRequestBodyApplicableTo|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + array_push($this->openAPINullablesSetToNull, 'applicableTo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableTo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of validation rule. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets contextType + * + * @return string|null + */ + public function getContextType() + { + return $this->container['contextType']; + } + + /** + * Sets contextType + * + * @param string|null $contextType Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | + * + * @return self + */ + public function setContextType($contextType) + { + if (is_null($contextType)) { + array_push($this->openAPINullablesSetToNull, 'contextType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('contextType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($contextType) && !in_array($contextType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'contextType', must be one of '%s'", + $contextType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['contextType'] = $contextType; + + 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/ValidationRulesUpdateRequestBodyApplicableTo.php b/src/Model/ValidationRulesUpdateRequestBodyApplicableTo.php new file mode 100644 index 0000000..a230935 --- /dev/null +++ b/src/Model/ValidationRulesUpdateRequestBodyApplicableTo.php @@ -0,0 +1,499 @@ + + */ +class ValidationRulesUpdateRequestBodyApplicableTo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesUpdateRequestBodyApplicableTo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'excluded' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'included' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'includedAll' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'excluded' => null, + 'included' => null, + 'includedAll' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'excluded' => true, + 'included' => true, + 'includedAll' => true + ]; + + /** + * 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 = [ + 'excluded' => 'excluded', + 'included' => 'included', + 'includedAll' => 'included_all' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'excluded' => 'setExcluded', + 'included' => 'setIncluded', + 'includedAll' => 'setIncludedAll' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'excluded' => 'getExcluded', + 'included' => 'getIncluded', + 'includedAll' => 'getIncludedAll' + ]; + + /** + * 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('excluded', $data ?? [], null); + $this->setIfExists('included', $data ?? [], null); + $this->setIfExists('includedAll', $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 excluded + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getExcluded() + { + return $this->container['excluded']; + } + + /** + * Sets excluded + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $excluded Defines which items are excluded from a discount. + * + * @return self + */ + public function setExcluded($excluded) + { + if (is_null($excluded)) { + array_push($this->openAPINullablesSetToNull, 'excluded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('excluded', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['excluded'] = $excluded; + + return $this; + } + + /** + * Gets included + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getIncluded() + { + return $this->container['included']; + } + + /** + * Sets included + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $included Defines which items are included in a discount. + * + * @return self + */ + public function setIncluded($included) + { + if (is_null($included)) { + array_push($this->openAPINullablesSetToNull, 'included'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('included', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['included'] = $included; + + return $this; + } + + /** + * Gets includedAll + * + * @return bool|null + */ + public function getIncludedAll() + { + return $this->container['includedAll']; + } + + /** + * Sets includedAll + * + * @param bool|null $includedAll Indicates whether all items are included in the discount. + * + * @return self + */ + public function setIncludedAll($includedAll) + { + if (is_null($includedAll)) { + array_push($this->openAPINullablesSetToNull, 'includedAll'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('includedAll', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['includedAll'] = $includedAll; + + 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/ValidationRulesUpdateRequestBodyError.php b/src/Model/ValidationRulesUpdateRequestBodyError.php new file mode 100644 index 0000000..d288093 --- /dev/null +++ b/src/Model/ValidationRulesUpdateRequestBodyError.php @@ -0,0 +1,418 @@ + + */ +class ValidationRulesUpdateRequestBodyError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesUpdateRequestBodyError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true + ]; + + /** + * 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 = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * 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('message', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message The error message returned from API when validation / redemption fails to meet requirements of defined rules. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + 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/ValidationRulesUpdateResponseBody.php b/src/Model/ValidationRulesUpdateResponseBody.php new file mode 100644 index 0000000..7b12904 --- /dev/null +++ b/src/Model/ValidationRulesUpdateResponseBody.php @@ -0,0 +1,1003 @@ + + */ +class ValidationRulesUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'rules' => 'object', + 'error' => '\OpenAPI\Client\Model\ValidationRulesUpdateResponseBodyError', + 'applicableTo' => '\OpenAPI\Client\Model\ValidationRulesUpdateResponseBodyApplicableTo', + 'type' => 'string', + 'contextType' => 'string', + 'id' => 'string', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'assignmentsCount' => 'int', + 'object' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'rules' => null, + 'error' => null, + 'applicableTo' => null, + 'type' => null, + 'contextType' => null, + 'id' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'assignmentsCount' => null, + 'object' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => true, + 'rules' => false, + 'error' => true, + 'applicableTo' => true, + 'type' => true, + 'contextType' => true, + 'id' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'assignmentsCount' => true, + 'object' => true + ]; + + /** + * 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 = [ + 'name' => 'name', + 'rules' => 'rules', + 'error' => 'error', + 'applicableTo' => 'applicable_to', + 'type' => 'type', + 'contextType' => 'context_type', + 'id' => 'id', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'assignmentsCount' => 'assignments_count', + 'object' => 'object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'rules' => 'setRules', + 'error' => 'setError', + 'applicableTo' => 'setApplicableTo', + 'type' => 'setType', + 'contextType' => 'setContextType', + 'id' => 'setId', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'assignmentsCount' => 'setAssignmentsCount', + 'object' => 'setObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'rules' => 'getRules', + 'error' => 'getError', + 'applicableTo' => 'getApplicableTo', + 'type' => 'getType', + 'contextType' => 'getContextType', + 'id' => 'getId', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'assignmentsCount' => 'getAssignmentsCount', + 'object' => 'getObject' + ]; + + /** + * 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 TYPE_EXPRESSION = 'expression'; + public const TYPE_BASIC = 'basic'; + public const TYPE_ADVANCED = 'advanced'; + public const TYPE_COMPLEX = 'complex'; + public const CONTEXT_TYPE_EARNING_RULE_ORDER_PAID = 'earning_rule.order.paid'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT = 'earning_rule.custom_event'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED = 'earning_rule.customer.segment.entered'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED = 'earning_rule.customer.tier.joined'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT = 'earning_rule.customer.tier.left'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED = 'earning_rule.customer.tier.upgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED = 'earning_rule.customer.tier.downgraded'; + public const CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED = 'earning_rule.customer.tier.prolonged'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS = 'campaign.discount_coupons'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER = 'campaign.discount_coupons.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.discount_coupons.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.discount_coupons.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.discount_coupons.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS = 'campaign.gift_vouchers'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER = 'campaign.gift_vouchers.gift.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS = 'campaign.gift_vouchers.gift.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM = 'campaign.referral_program'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER = 'campaign.referral_program.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.referral_program.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.referral_program.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.referral_program.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.referral_program.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION = 'campaign.promotion'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER = 'campaign.promotion.discount.apply_to_order'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS = 'campaign.promotion.discount.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'campaign.promotion.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'campaign.promotion.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'campaign.promotion.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'campaign.promotion.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM = 'campaign.loyalty_program'; + public const CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW = 'campaign.lucky_draw'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER = 'voucher.discount_voucher'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER = 'voucher.discount_voucher.discount.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY = 'voucher.discount_voucher.discount.apply_to_items_proportionally'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY = 'voucher.discount_voucher.discount.apply_to_items_by_quantity'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.fixed.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS = 'voucher.discount_voucher.discount.percent.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER = 'voucher.gift_voucher'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER = 'voucher.gift_voucher.gift.apply_to_order'; + public const CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS = 'voucher.gift_voucher.gift.apply_to_items'; + public const CONTEXT_TYPE_VOUCHER_LOYALTY_CARD = 'voucher.loyalty_card'; + public const CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE = 'voucher.lucky_draw_code'; + public const CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT = 'distribution.custom_event'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID = 'distribution.order.paid'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED = 'distribution.order.created'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED = 'distribution.order.canceled'; + public const CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED = 'distribution.order.updated'; + public const CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS = 'reward_assignment.pay_with_points'; + public const CONTEXT_TYPE__GLOBAL = 'global'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_EXPRESSION, + self::TYPE_BASIC, + self::TYPE_ADVANCED, + self::TYPE_COMPLEX, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getContextTypeAllowableValues() + { + return [ + self::CONTEXT_TYPE_EARNING_RULE_ORDER_PAID, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOM_EVENT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_SEGMENT_ENTERED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_JOINED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_LEFT, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_UPGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_DOWNGRADED, + self::CONTEXT_TYPE_EARNING_RULE_CUSTOMER_TIER_PROLONGED, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_DISCOUNT_COUPONS_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_GIFT_VOUCHERS_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_REFERRAL_PROGRAM_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_PROMOTION_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_CAMPAIGN_LOYALTY_PROGRAM, + self::CONTEXT_TYPE_CAMPAIGN_LUCKY_DRAW, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_APPLY_TO_ITEMS_BY_QUANTITY, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_FIXED_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_DISCOUNT_VOUCHER_DISCOUNT_PERCENT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ORDER, + self::CONTEXT_TYPE_VOUCHER_GIFT_VOUCHER_GIFT_APPLY_TO_ITEMS, + self::CONTEXT_TYPE_VOUCHER_LOYALTY_CARD, + self::CONTEXT_TYPE_VOUCHER_LUCKY_DRAW_CODE, + self::CONTEXT_TYPE_DISTRIBUTION_CUSTOM_EVENT, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_PAID, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CREATED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_CANCELED, + self::CONTEXT_TYPE_DISTRIBUTION_ORDER_UPDATED, + self::CONTEXT_TYPE_REWARD_ASSIGNMENT_PAY_WITH_POINTS, + self::CONTEXT_TYPE__GLOBAL, + ]; + } + + /** + * 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('name', $data ?? [], null); + $this->setIfExists('rules', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'expression'); + $this->setIfExists('contextType', $data ?? [], 'global'); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('assignmentsCount', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'validation_rules'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($this->container['contextType']) && !in_array($this->container['contextType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'contextType', must be one of '%s'", + $this->container['contextType'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Custom, unique name for set of validation rules. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets rules + * + * @return object|null + */ + public function getRules() + { + return $this->container['rules']; + } + + /** + * Sets rules + * + * @param object|null $rules Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. + * + * @return self + */ + public function setRules($rules) + { + if (is_null($rules)) { + throw new \InvalidArgumentException('non-nullable rules cannot be null'); + } + $this->container['rules'] = $rules; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\ValidationRulesUpdateResponseBodyError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\ValidationRulesUpdateResponseBodyError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ValidationRulesUpdateResponseBodyApplicableTo|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ValidationRulesUpdateResponseBodyApplicableTo|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + array_push($this->openAPINullablesSetToNull, 'applicableTo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('applicableTo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of validation rule. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets contextType + * + * @return string|null + */ + public function getContextType() + { + return $this->container['contextType']; + } + + /** + * Sets contextType + * + * @param string|null $contextType Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | + * + * @return self + */ + public function setContextType($contextType) + { + if (is_null($contextType)) { + array_push($this->openAPINullablesSetToNull, 'contextType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('contextType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getContextTypeAllowableValues(); + if (!is_null($contextType) && !in_array($contextType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'contextType', must be one of '%s'", + $contextType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['contextType'] = $contextType; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique validation rule ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets assignmentsCount + * + * @return int|null + */ + public function getAssignmentsCount() + { + return $this->container['assignmentsCount']; + } + + /** + * Sets assignmentsCount + * + * @param int|null $assignmentsCount The number of instances the validation rule has been assigned to different types of redeemables. + * + * @return self + */ + public function setAssignmentsCount($assignmentsCount) + { + if (is_null($assignmentsCount)) { + array_push($this->openAPINullablesSetToNull, 'assignmentsCount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('assignmentsCount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['assignmentsCount'] = $assignmentsCount; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about the validation rule. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + 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/ValidationRulesUpdateResponseBodyApplicableTo.php b/src/Model/ValidationRulesUpdateResponseBodyApplicableTo.php new file mode 100644 index 0000000..286a0ac --- /dev/null +++ b/src/Model/ValidationRulesUpdateResponseBodyApplicableTo.php @@ -0,0 +1,499 @@ + + */ +class ValidationRulesUpdateResponseBodyApplicableTo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesUpdateResponseBodyApplicableTo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'excluded' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'included' => '\OpenAPI\Client\Model\ApplicableTo[]', + 'includedAll' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'excluded' => null, + 'included' => null, + 'includedAll' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'excluded' => true, + 'included' => true, + 'includedAll' => true + ]; + + /** + * 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 = [ + 'excluded' => 'excluded', + 'included' => 'included', + 'includedAll' => 'included_all' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'excluded' => 'setExcluded', + 'included' => 'setIncluded', + 'includedAll' => 'setIncludedAll' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'excluded' => 'getExcluded', + 'included' => 'getIncluded', + 'includedAll' => 'getIncludedAll' + ]; + + /** + * 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('excluded', $data ?? [], null); + $this->setIfExists('included', $data ?? [], null); + $this->setIfExists('includedAll', $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 excluded + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getExcluded() + { + return $this->container['excluded']; + } + + /** + * Sets excluded + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $excluded Defines which items are excluded from a discount. + * + * @return self + */ + public function setExcluded($excluded) + { + if (is_null($excluded)) { + array_push($this->openAPINullablesSetToNull, 'excluded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('excluded', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['excluded'] = $excluded; + + return $this; + } + + /** + * Gets included + * + * @return \OpenAPI\Client\Model\ApplicableTo[]|null + */ + public function getIncluded() + { + return $this->container['included']; + } + + /** + * Sets included + * + * @param \OpenAPI\Client\Model\ApplicableTo[]|null $included Defines which items are included in a discount. + * + * @return self + */ + public function setIncluded($included) + { + if (is_null($included)) { + array_push($this->openAPINullablesSetToNull, 'included'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('included', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['included'] = $included; + + return $this; + } + + /** + * Gets includedAll + * + * @return bool|null + */ + public function getIncludedAll() + { + return $this->container['includedAll']; + } + + /** + * Sets includedAll + * + * @param bool|null $includedAll Indicates whether all items are included in the discount. + * + * @return self + */ + public function setIncludedAll($includedAll) + { + if (is_null($includedAll)) { + array_push($this->openAPINullablesSetToNull, 'includedAll'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('includedAll', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['includedAll'] = $includedAll; + + 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/ValidationRulesUpdateResponseBodyError.php b/src/Model/ValidationRulesUpdateResponseBodyError.php new file mode 100644 index 0000000..ef3d0fb --- /dev/null +++ b/src/Model/ValidationRulesUpdateResponseBodyError.php @@ -0,0 +1,418 @@ + + */ +class ValidationRulesUpdateResponseBodyError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationRulesUpdateResponseBodyError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true + ]; + + /** + * 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 = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * 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('message', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message The error message returned from API when validation / redemption fails to meet requirements of defined rules. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + 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/ValidationsRedeemableInapplicable.php b/src/Model/ValidationsRedeemableInapplicable.php new file mode 100644 index 0000000..78c810d --- /dev/null +++ b/src/Model/ValidationsRedeemableInapplicable.php @@ -0,0 +1,688 @@ + + */ +class ValidationsRedeemableInapplicable implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsRedeemableInapplicable'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'id' => 'string', + 'object' => 'string', + 'result' => '\OpenAPI\Client\Model\ValidationsRedeemableInapplicableResult', + 'metadata' => 'object', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'id' => null, + 'object' => null, + 'result' => null, + 'metadata' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => true, + 'id' => true, + 'object' => true, + 'result' => true, + 'metadata' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'status' => 'status', + 'id' => 'id', + 'object' => 'object', + 'result' => 'result', + 'metadata' => 'metadata', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'id' => 'setId', + 'object' => 'setObject', + 'result' => 'setResult', + 'metadata' => 'setMetadata', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'id' => 'getId', + 'object' => 'getObject', + 'result' => 'getResult', + 'metadata' => 'getMetadata', + 'categories' => 'getCategories' + ]; + + /** + * 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 STATUS_INAPPLICABLE = 'INAPPLICABLE'; + public const OBJECT_VOUCHER = 'voucher'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_INAPPLICABLE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + self::OBJECT_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('status', $data ?? [], 'INAPPLICABLE'); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('categories', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Indicates whether the redeemable can be applied or not applied based on the validation rules. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Redeemable ID, i.e. the voucher code. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Redeemable's object type. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableInapplicableResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableInapplicableResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/ValidationsRedeemableInapplicableResult.php b/src/Model/ValidationsRedeemableInapplicableResult.php new file mode 100644 index 0000000..b3b49f3 --- /dev/null +++ b/src/Model/ValidationsRedeemableInapplicableResult.php @@ -0,0 +1,452 @@ + + */ +class ValidationsRedeemableInapplicableResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsRedeemableInapplicableResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => '\OpenAPI\Client\Model\Error', + 'details' => '\OpenAPI\Client\Model\ValidationsRedeemableInapplicableResultDetails' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null, + 'details' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false, + 'details' => true + ]; + + /** + * 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 = [ + 'error' => 'error', + 'details' => 'details' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError', + 'details' => 'setDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError', + 'details' => 'getDetails' + ]; + + /** + * 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('error', $data ?? [], null); + $this->setIfExists('details', $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 error + * + * @return \OpenAPI\Client\Model\Error|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\Error|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets details + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableInapplicableResultDetails|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableInapplicableResultDetails|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + array_push($this->openAPINullablesSetToNull, 'details'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('details', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['details'] = $details; + + 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/ValidationsRedeemableInapplicableResultDetails.php b/src/Model/ValidationsRedeemableInapplicableResultDetails.php new file mode 100644 index 0000000..d8cf0e1 --- /dev/null +++ b/src/Model/ValidationsRedeemableInapplicableResultDetails.php @@ -0,0 +1,459 @@ + + */ +class ValidationsRedeemableInapplicableResultDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsRedeemableInapplicableResultDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => true, + 'key' => true + ]; + + /** + * 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 = [ + 'message' => 'message', + 'key' => 'key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'key' => 'setKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'key' => 'getKey' + ]; + + /** + * 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('message', $data ?? [], null); + $this->setIfExists('key', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message Generic message from the `message` string shown in the `error` object or the message configured in a validation rule. + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key Generic message from the `key` string shown in the `error` object. + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + array_push($this->openAPINullablesSetToNull, 'key'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('key', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['key'] = $key; + + 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/ValidationsRedeemableSkipped.php b/src/Model/ValidationsRedeemableSkipped.php new file mode 100644 index 0000000..2993f1b --- /dev/null +++ b/src/Model/ValidationsRedeemableSkipped.php @@ -0,0 +1,688 @@ + + */ +class ValidationsRedeemableSkipped implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsRedeemableSkipped'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'id' => 'string', + 'object' => 'string', + 'result' => '\OpenAPI\Client\Model\ValidationsRedeemableSkippedResult', + 'metadata' => 'object', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'id' => null, + 'object' => null, + 'result' => null, + 'metadata' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => true, + 'id' => true, + 'object' => true, + 'result' => true, + 'metadata' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'status' => 'status', + 'id' => 'id', + 'object' => 'object', + 'result' => 'result', + 'metadata' => 'metadata', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'id' => 'setId', + 'object' => 'setObject', + 'result' => 'setResult', + 'metadata' => 'setMetadata', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'id' => 'getId', + 'object' => 'getObject', + 'result' => 'getResult', + 'metadata' => 'getMetadata', + 'categories' => 'getCategories' + ]; + + /** + * 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 STATUS_SKIPPED = 'SKIPPED'; + public const OBJECT_VOUCHER = 'voucher'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SKIPPED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + self::OBJECT_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('status', $data ?? [], 'SKIPPED'); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('categories', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Indicates whether the redeemable can be applied or not applied based on the validation rules. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Redeemable ID, i.e. the voucher code. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Redeemable's object type. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableSkippedResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableSkippedResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/ValidationsRedeemableSkippedResult.php b/src/Model/ValidationsRedeemableSkippedResult.php new file mode 100644 index 0000000..a5a62ca --- /dev/null +++ b/src/Model/ValidationsRedeemableSkippedResult.php @@ -0,0 +1,418 @@ + + */ +class ValidationsRedeemableSkippedResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsRedeemableSkippedResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'details' => '\OpenAPI\Client\Model\ValidationsRedeemableSkippedResultDetails' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'details' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'details' => true + ]; + + /** + * 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 = [ + 'details' => 'details' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'details' => 'setDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'details' => 'getDetails' + ]; + + /** + * 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('details', $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 details + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableSkippedResultDetails|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableSkippedResultDetails|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + array_push($this->openAPINullablesSetToNull, 'details'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('details', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['details'] = $details; + + 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/ValidationsRedeemableSkippedResultDetails.php b/src/Model/ValidationsRedeemableSkippedResultDetails.php new file mode 100644 index 0000000..4931c4b --- /dev/null +++ b/src/Model/ValidationsRedeemableSkippedResultDetails.php @@ -0,0 +1,500 @@ + + */ +class ValidationsRedeemableSkippedResultDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsRedeemableSkippedResultDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key' => true, + 'message' => true + ]; + + /** + * 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 = [ + 'key' => 'key', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'message' => 'getMessage' + ]; + + /** + * 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 KEY_APPLICABLE_REDEEMABLES_LIMIT_EXCEEDED = 'applicable_redeemables_limit_exceeded'; + public const KEY_APPLICABLE_REDEEMABLES_PER_CATEGORY_LIMIT_EXCEEDED = 'applicable_redeemables_per_category_limit_exceeded'; + public const KEY_APPLICABLE_EXCLUSIVE_REDEEMABLES_LIMIT_EXCEEDED = 'applicable_exclusive_redeemables_limit_exceeded'; + public const KEY_APPLICABLE_EXCLUSIVE_REDEEMABLES_PER_CATEGORY_LIMIT_EXCEEDED = 'applicable_exclusive_redeemables_per_category_limit_exceeded'; + public const KEY_EXCLUSION_RULES_NOT_MET = 'exclusion_rules_not_met'; + public const KEY_PRECEDING_VALIDATION_FAILED = 'preceding_validation_failed'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getKeyAllowableValues() + { + return [ + self::KEY_APPLICABLE_REDEEMABLES_LIMIT_EXCEEDED, + self::KEY_APPLICABLE_REDEEMABLES_PER_CATEGORY_LIMIT_EXCEEDED, + self::KEY_APPLICABLE_EXCLUSIVE_REDEEMABLES_LIMIT_EXCEEDED, + self::KEY_APPLICABLE_EXCLUSIVE_REDEEMABLES_PER_CATEGORY_LIMIT_EXCEEDED, + self::KEY_EXCLUSION_RULES_NOT_MET, + self::KEY_PRECEDING_VALIDATION_FAILED, + ]; + } + + /** + * 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('key', $data ?? [], null); + $this->setIfExists('message', $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->getKeyAllowableValues(); + if (!is_null($this->container['key']) && !in_array($this->container['key'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'key', must be one of '%s'", + $this->container['key'], + 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 key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key key + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + array_push($this->openAPINullablesSetToNull, 'key'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('key', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getKeyAllowableValues(); + if (!is_null($key) && !in_array($key, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'key', must be one of '%s'", + $key, + implode("', '", $allowedValues) + ) + ); + } + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message'] = $message; + + 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/ValidationsValidateRequestBody.php b/src/Model/ValidationsValidateRequestBody.php new file mode 100644 index 0000000..d51f1a0 --- /dev/null +++ b/src/Model/ValidationsValidateRequestBody.php @@ -0,0 +1,643 @@ + + */ +class ValidationsValidateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'options' => '\OpenAPI\Client\Model\ValidationsValidateRequestBodyOptions', + 'redeemables' => '\OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItem[]', + 'order' => '\OpenAPI\Client\Model\Order', + 'customer' => '\OpenAPI\Client\Model\Customer', + 'session' => '\OpenAPI\Client\Model\Session', + 'trackingId' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'options' => null, + 'redeemables' => null, + 'order' => null, + 'customer' => null, + 'session' => null, + 'trackingId' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'options' => true, + 'redeemables' => true, + 'order' => false, + 'customer' => false, + 'session' => false, + 'trackingId' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'options' => 'options', + 'redeemables' => 'redeemables', + 'order' => 'order', + 'customer' => 'customer', + 'session' => 'session', + 'trackingId' => 'tracking_id', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'options' => 'setOptions', + 'redeemables' => 'setRedeemables', + 'order' => 'setOrder', + 'customer' => 'setCustomer', + 'session' => 'setSession', + 'trackingId' => 'setTrackingId', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'options' => 'getOptions', + 'redeemables' => 'getRedeemables', + 'order' => 'getOrder', + 'customer' => 'getCustomer', + 'session' => 'getSession', + 'trackingId' => 'getTrackingId', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('options', $data ?? [], null); + $this->setIfExists('redeemables', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('customer', $data ?? [], null); + $this->setIfExists('session', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('metadata', $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 options + * + * @return \OpenAPI\Client\Model\ValidationsValidateRequestBodyOptions|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBodyOptions|null $options options + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + array_push($this->openAPINullablesSetToNull, 'options'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('options', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets redeemables + * + * @return \OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItem[]|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItem[]|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + array_push($this->openAPINullablesSetToNull, 'redeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemables'] = $redeemables; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\Order|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\Order|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets customer + * + * @return \OpenAPI\Client\Model\Customer|null + */ + public function getCustomer() + { + return $this->container['customer']; + } + + /** + * Sets customer + * + * @param \OpenAPI\Client\Model\Customer|null $customer customer + * + * @return self + */ + public function setCustomer($customer) + { + if (is_null($customer)) { + throw new \InvalidArgumentException('non-nullable customer cannot be null'); + } + $this->container['customer'] = $customer; + + return $this; + } + + /** + * Gets session + * + * @return \OpenAPI\Client\Model\Session|null + */ + public function getSession() + { + return $this->container['session']; + } + + /** + * Sets session + * + * @param \OpenAPI\Client\Model\Session|null $session session + * + * @return self + */ + public function setSession($session) + { + if (is_null($session)) { + throw new \InvalidArgumentException('non-nullable session cannot be null'); + } + $this->container['session'] = $session; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Is correspondent to Customer's source_id + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/ValidationsValidateRequestBodyOptions.php b/src/Model/ValidationsValidateRequestBodyOptions.php new file mode 100644 index 0000000..6af5559 --- /dev/null +++ b/src/Model/ValidationsValidateRequestBodyOptions.php @@ -0,0 +1,446 @@ + + */ +class ValidationsValidateRequestBodyOptions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateRequestBodyOptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'expand' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'expand' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expand' => true + ]; + + /** + * 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 = [ + 'expand' => 'expand' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'expand' => 'setExpand' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'expand' => 'getExpand' + ]; + + /** + * 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 EXPAND_ORDER = 'order'; + public const EXPAND_REDEMPTION = 'redemption'; + public const EXPAND_REDEEMABLE = 'redeemable'; + public const EXPAND_CATEGORY = 'category'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExpandAllowableValues() + { + return [ + self::EXPAND_ORDER, + self::EXPAND_REDEMPTION, + self::EXPAND_REDEEMABLE, + self::EXPAND_CATEGORY, + ]; + } + + /** + * 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('expand', $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 expand + * + * @return string[]|null + */ + public function getExpand() + { + return $this->container['expand']; + } + + /** + * Sets expand + * + * @param string[]|null $expand The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | + * + * @return self + */ + public function setExpand($expand) + { + if (is_null($expand)) { + array_push($this->openAPINullablesSetToNull, 'expand'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expand', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExpandAllowableValues(); + if (!is_null($expand) && array_diff($expand, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'expand', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['expand'] = $expand; + + 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/ValidationsValidateRequestBodyRedeemablesItem.php b/src/Model/ValidationsValidateRequestBodyRedeemablesItem.php new file mode 100644 index 0000000..9c0d167 --- /dev/null +++ b/src/Model/ValidationsValidateRequestBodyRedeemablesItem.php @@ -0,0 +1,562 @@ + + */ +class ValidationsValidateRequestBodyRedeemablesItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateRequestBodyRedeemablesItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'id' => 'string', + 'gift' => '\OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItemGift', + 'reward' => '\OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItemReward' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'id' => null, + 'gift' => null, + 'reward' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => false, + 'id' => false, + 'gift' => true, + 'reward' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'id' => 'id', + 'gift' => 'gift', + 'reward' => 'reward' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'id' => 'setId', + 'gift' => 'setGift', + 'reward' => 'setReward' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'id' => 'getId', + 'gift' => 'getGift', + 'reward' => 'getReward' + ]; + + /** + * 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 OBJECT_VOUCHER = 'voucher'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + public const OBJECT_PROMOTION_STACK = 'promotion_stack'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + self::OBJECT_PROMOTION_TIER, + self::OBJECT_PROMOTION_STACK, + ]; + } + + /** + * 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('object', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('reward', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object object + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + throw new \InvalidArgumentException('non-nullable object cannot be null'); + } + $allowedValues = $this->getObjectAllowableValues(); + if (!in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItemGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItemGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItemReward|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBodyRedeemablesItemReward|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + array_push($this->openAPINullablesSetToNull, 'reward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reward'] = $reward; + + 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/ValidationsValidateRequestBodyRedeemablesItemGift.php b/src/Model/ValidationsValidateRequestBodyRedeemablesItemGift.php new file mode 100644 index 0000000..ab7a327 --- /dev/null +++ b/src/Model/ValidationsValidateRequestBodyRedeemablesItemGift.php @@ -0,0 +1,418 @@ + + */ +class ValidationsValidateRequestBodyRedeemablesItemGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateRequestBodyRedeemablesItemGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'credits' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'credits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'credits' => true + ]; + + /** + * 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 = [ + 'credits' => 'credits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'credits' => 'setCredits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'credits' => 'getCredits' + ]; + + /** + * 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('credits', $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 credits + * + * @return int|null + */ + public function getCredits() + { + return $this->container['credits']; + } + + /** + * Sets credits + * + * @param int|null $credits The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. + * + * @return self + */ + public function setCredits($credits) + { + if (is_null($credits)) { + array_push($this->openAPINullablesSetToNull, 'credits'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('credits', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['credits'] = $credits; + + 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/ValidationsValidateRequestBodyRedeemablesItemReward.php b/src/Model/ValidationsValidateRequestBodyRedeemablesItemReward.php new file mode 100644 index 0000000..5a32cfc --- /dev/null +++ b/src/Model/ValidationsValidateRequestBodyRedeemablesItemReward.php @@ -0,0 +1,459 @@ + + */ +class ValidationsValidateRequestBodyRedeemablesItemReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateRequestBodyRedeemablesItemReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'points' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'points' => 'getPoints' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('points', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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 new file mode 100644 index 0000000..a86305c --- /dev/null +++ b/src/Model/ValidationsValidateResponseBody.php @@ -0,0 +1,687 @@ + + */ +class ValidationsValidateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'valid' => 'bool', + 'redeemables' => '\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItem[]', + 'skippedRedeemables' => '\OpenAPI\Client\Model\ValidationsRedeemableSkipped[]', + 'inapplicableRedeemables' => '\OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'trackingId' => 'string', + 'session' => '\OpenAPI\Client\Model\Session', + 'stackingRules' => '\OpenAPI\Client\Model\StackingRules' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'valid' => null, + 'redeemables' => null, + 'skippedRedeemables' => null, + 'inapplicableRedeemables' => null, + 'order' => null, + 'trackingId' => null, + 'session' => null, + 'stackingRules' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'valid' => true, + 'redeemables' => true, + 'skippedRedeemables' => true, + 'inapplicableRedeemables' => true, + 'order' => false, + 'trackingId' => true, + 'session' => false, + 'stackingRules' => 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 = [ + 'valid' => 'valid', + 'redeemables' => 'redeemables', + 'skippedRedeemables' => 'skipped_redeemables', + 'inapplicableRedeemables' => 'inapplicable_redeemables', + 'order' => 'order', + 'trackingId' => 'tracking_id', + 'session' => 'session', + 'stackingRules' => 'stacking_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'valid' => 'setValid', + 'redeemables' => 'setRedeemables', + 'skippedRedeemables' => 'setSkippedRedeemables', + 'inapplicableRedeemables' => 'setInapplicableRedeemables', + 'order' => 'setOrder', + 'trackingId' => 'setTrackingId', + 'session' => 'setSession', + 'stackingRules' => 'setStackingRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'valid' => 'getValid', + 'redeemables' => 'getRedeemables', + 'skippedRedeemables' => 'getSkippedRedeemables', + 'inapplicableRedeemables' => 'getInapplicableRedeemables', + 'order' => 'getOrder', + 'trackingId' => 'getTrackingId', + 'session' => 'getSession', + 'stackingRules' => 'getStackingRules' + ]; + + /** + * 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('valid', $data ?? [], null); + $this->setIfExists('redeemables', $data ?? [], null); + $this->setIfExists('skippedRedeemables', $data ?? [], null); + $this->setIfExists('inapplicableRedeemables', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('trackingId', $data ?? [], null); + $this->setIfExists('session', $data ?? [], null); + $this->setIfExists('stackingRules', $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 = []; + + if ($this->container['stackingRules'] === null) { + $invalidProperties[] = "'stackingRules' can't be null"; + } + 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 valid + * + * @return bool|null + */ + public function getValid() + { + return $this->container['valid']; + } + + /** + * Sets valid + * + * @param bool|null $valid The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. + * + * @return self + */ + public function setValid($valid) + { + if (is_null($valid)) { + array_push($this->openAPINullablesSetToNull, 'valid'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('valid', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['valid'] = $valid; + + return $this; + } + + /** + * Gets redeemables + * + * @return \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItem[]|null + */ + public function getRedeemables() + { + return $this->container['redeemables']; + } + + /** + * Sets redeemables + * + * @param \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItem[]|null $redeemables redeemables + * + * @return self + */ + public function setRedeemables($redeemables) + { + if (is_null($redeemables)) { + array_push($this->openAPINullablesSetToNull, 'redeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemables'] = $redeemables; + + return $this; + } + + /** + * Gets skippedRedeemables + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableSkipped[]|null + */ + public function getSkippedRedeemables() + { + return $this->container['skippedRedeemables']; + } + + /** + * Sets skippedRedeemables + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableSkipped[]|null $skippedRedeemables Lists validation results of each skipped redeemable. + * + * @return self + */ + public function setSkippedRedeemables($skippedRedeemables) + { + if (is_null($skippedRedeemables)) { + array_push($this->openAPINullablesSetToNull, 'skippedRedeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('skippedRedeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['skippedRedeemables'] = $skippedRedeemables; + + return $this; + } + + /** + * Gets inapplicableRedeemables + * + * @return \OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]|null + */ + public function getInapplicableRedeemables() + { + return $this->container['inapplicableRedeemables']; + } + + /** + * Sets inapplicableRedeemables + * + * @param \OpenAPI\Client\Model\ValidationsRedeemableInapplicable[]|null $inapplicableRedeemables Lists validation results of each inapplicable redeemable. + * + * @return self + */ + public function setInapplicableRedeemables($inapplicableRedeemables) + { + if (is_null($inapplicableRedeemables)) { + array_push($this->openAPINullablesSetToNull, 'inapplicableRedeemables'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('inapplicableRedeemables', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['inapplicableRedeemables'] = $inapplicableRedeemables; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets trackingId + * + * @return string|null + */ + public function getTrackingId() + { + return $this->container['trackingId']; + } + + /** + * Sets trackingId + * + * @param string|null $trackingId Hashed customer source ID. + * + * @return self + */ + public function setTrackingId($trackingId) + { + if (is_null($trackingId)) { + array_push($this->openAPINullablesSetToNull, 'trackingId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('trackingId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['trackingId'] = $trackingId; + + return $this; + } + + /** + * Gets session + * + * @return \OpenAPI\Client\Model\Session|null + */ + public function getSession() + { + return $this->container['session']; + } + + /** + * Sets session + * + * @param \OpenAPI\Client\Model\Session|null $session session + * + * @return self + */ + public function setSession($session) + { + if (is_null($session)) { + throw new \InvalidArgumentException('non-nullable session cannot be null'); + } + $this->container['session'] = $session; + + return $this; + } + + /** + * Gets stackingRules + * + * @return \OpenAPI\Client\Model\StackingRules + */ + public function getStackingRules() + { + return $this->container['stackingRules']; + } + + /** + * Sets stackingRules + * + * @param \OpenAPI\Client\Model\StackingRules $stackingRules stackingRules + * + * @return self + */ + public function setStackingRules($stackingRules) + { + if (is_null($stackingRules)) { + throw new \InvalidArgumentException('non-nullable stackingRules cannot be null'); + } + $this->container['stackingRules'] = $stackingRules; + + 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/ValidationsValidateResponseBodyRedeemablesItem.php b/src/Model/ValidationsValidateResponseBodyRedeemablesItem.php new file mode 100644 index 0000000..f79aded --- /dev/null +++ b/src/Model/ValidationsValidateResponseBodyRedeemablesItem.php @@ -0,0 +1,773 @@ + + */ +class ValidationsValidateResponseBodyRedeemablesItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateResponseBodyRedeemablesItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + 'id' => 'string', + 'object' => 'string', + 'order' => '\OpenAPI\Client\Model\OrderCalculated', + 'applicableTo' => '\OpenAPI\Client\Model\ApplicableToResultList', + 'inapplicableTo' => '\OpenAPI\Client\Model\InapplicableToResultList', + 'result' => '\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResult', + 'metadata' => 'object', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'id' => null, + 'object' => null, + 'order' => null, + 'applicableTo' => null, + 'inapplicableTo' => null, + 'result' => null, + 'metadata' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'id' => true, + 'object' => true, + 'order' => false, + 'applicableTo' => false, + 'inapplicableTo' => false, + 'result' => false, + 'metadata' => false, + 'categories' => true + ]; + + /** + * 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 = [ + 'status' => 'status', + 'id' => 'id', + 'object' => 'object', + 'order' => 'order', + 'applicableTo' => 'applicable_to', + 'inapplicableTo' => 'inapplicable_to', + 'result' => 'result', + 'metadata' => 'metadata', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'id' => 'setId', + 'object' => 'setObject', + 'order' => 'setOrder', + 'applicableTo' => 'setApplicableTo', + 'inapplicableTo' => 'setInapplicableTo', + 'result' => 'setResult', + 'metadata' => 'setMetadata', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'id' => 'getId', + 'object' => 'getObject', + 'order' => 'getOrder', + 'applicableTo' => 'getApplicableTo', + 'inapplicableTo' => 'getInapplicableTo', + 'result' => 'getResult', + 'metadata' => 'getMetadata', + 'categories' => 'getCategories' + ]; + + /** + * 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 STATUS_APPLICABLE = 'APPLICABLE'; + public const STATUS_INAPPLICABLE = 'INAPPLICABLE'; + public const STATUS_SKIPPED = 'SKIPPED'; + public const OBJECT_VOUCHER = 'voucher'; + public const OBJECT_PROMOTION_TIER = 'promotion_tier'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_APPLICABLE, + self::STATUS_INAPPLICABLE, + self::STATUS_SKIPPED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_VOUCHER, + self::OBJECT_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('status', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('applicableTo', $data ?? [], null); + $this->setIfExists('inapplicableTo', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('categories', $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->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Redeemable ID, i.e. the voucher code. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object Redeemable's object type. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\OrderCalculated|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\OrderCalculated|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + throw new \InvalidArgumentException('non-nullable order cannot be null'); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets applicableTo + * + * @return \OpenAPI\Client\Model\ApplicableToResultList|null + */ + public function getApplicableTo() + { + return $this->container['applicableTo']; + } + + /** + * Sets applicableTo + * + * @param \OpenAPI\Client\Model\ApplicableToResultList|null $applicableTo applicableTo + * + * @return self + */ + public function setApplicableTo($applicableTo) + { + if (is_null($applicableTo)) { + throw new \InvalidArgumentException('non-nullable applicableTo cannot be null'); + } + $this->container['applicableTo'] = $applicableTo; + + return $this; + } + + /** + * Gets inapplicableTo + * + * @return \OpenAPI\Client\Model\InapplicableToResultList|null + */ + public function getInapplicableTo() + { + return $this->container['inapplicableTo']; + } + + /** + * Sets inapplicableTo + * + * @param \OpenAPI\Client\Model\InapplicableToResultList|null $inapplicableTo inapplicableTo + * + * @return self + */ + public function setInapplicableTo($inapplicableTo) + { + if (is_null($inapplicableTo)) { + throw new \InvalidArgumentException('non-nullable inapplicableTo cannot be null'); + } + $this->container['inapplicableTo'] = $inapplicableTo; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + throw new \InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories categories + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/ValidationsValidateResponseBodyRedeemablesItemResult.php b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResult.php new file mode 100644 index 0000000..1596f69 --- /dev/null +++ b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResult.php @@ -0,0 +1,553 @@ + + */ +class ValidationsValidateResponseBodyRedeemablesItemResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateResponseBodyRedeemablesItemResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'discount' => '\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDiscount', + 'gift' => '\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard', + 'error' => '\OpenAPI\Client\Model\Error', + 'details' => '\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDetails' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'error' => null, + 'details' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => false, + 'error' => false, + 'details' => 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 = [ + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'error' => 'error', + 'details' => 'details' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'error' => 'setError', + 'details' => 'setDetails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'error' => 'getError', + 'details' => 'getDetails' + ]; + + /** + * 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('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('details', $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 discount + * + * @return \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDiscount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDiscount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets error + * + * @return \OpenAPI\Client\Model\Error|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \OpenAPI\Client\Model\Error|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets details + * + * @return \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDetails|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDetails|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } + $this->container['details'] = $details; + + 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/ValidationsValidateResponseBodyRedeemablesItemResultDetails.php b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDetails.php new file mode 100644 index 0000000..1cade7e --- /dev/null +++ b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDetails.php @@ -0,0 +1,444 @@ + + */ +class ValidationsValidateResponseBodyRedeemablesItemResultDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateResponseBodyRedeemablesItemResultDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key' => false, + 'message' => 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 = [ + 'key' => 'key', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'message' => 'getMessage' + ]; + + /** + * 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('key', $data ?? [], null); + $this->setIfExists('message', $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 key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key key + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + throw new \InvalidArgumentException('non-nullable key cannot be null'); + } + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + 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/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.php b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.php new file mode 100644 index 0000000..4fdf374 --- /dev/null +++ b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.php @@ -0,0 +1,1129 @@ + + */ +class ValidationsValidateResponseBodyRedeemablesItemResultDiscount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateResponseBodyRedeemablesItemResultDiscount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'amountOff' => 'float', + 'amountOffFormula' => 'string', + 'aggregatedAmountLimit' => 'int', + 'effect' => 'string', + 'isDynamic' => 'bool', + 'unitOff' => 'int', + 'unitOffFormula' => 'string', + 'unitType' => 'string', + 'product' => '\OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct', + 'sku' => '\OpenAPI\Client\Model\SimpleSkuDiscountUnit', + 'units' => '\OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]', + 'percentOff' => 'float', + 'percentOffFormula' => 'string', + 'amountLimit' => 'float', + 'fixedAmount' => 'float', + 'fixedAmountFormula' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'amountOff' => null, + 'amountOffFormula' => null, + 'aggregatedAmountLimit' => null, + 'effect' => null, + 'isDynamic' => null, + 'unitOff' => null, + 'unitOffFormula' => null, + 'unitType' => null, + 'product' => null, + 'sku' => null, + 'units' => null, + 'percentOff' => null, + 'percentOffFormula' => null, + 'amountLimit' => null, + 'fixedAmount' => null, + 'fixedAmountFormula' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'amountOff' => true, + 'amountOffFormula' => true, + 'aggregatedAmountLimit' => true, + 'effect' => false, + 'isDynamic' => true, + 'unitOff' => true, + 'unitOffFormula' => true, + 'unitType' => true, + 'product' => false, + 'sku' => false, + 'units' => true, + 'percentOff' => true, + 'percentOffFormula' => true, + 'amountLimit' => true, + 'fixedAmount' => true, + 'fixedAmountFormula' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'amountOff' => 'amount_off', + 'amountOffFormula' => 'amount_off_formula', + 'aggregatedAmountLimit' => 'aggregated_amount_limit', + 'effect' => 'effect', + 'isDynamic' => 'is_dynamic', + 'unitOff' => 'unit_off', + 'unitOffFormula' => 'unit_off_formula', + 'unitType' => 'unit_type', + 'product' => 'product', + 'sku' => 'sku', + 'units' => 'units', + 'percentOff' => 'percent_off', + 'percentOffFormula' => 'percent_off_formula', + 'amountLimit' => 'amount_limit', + 'fixedAmount' => 'fixed_amount', + 'fixedAmountFormula' => 'fixed_amount_formula' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'amountOff' => 'setAmountOff', + 'amountOffFormula' => 'setAmountOffFormula', + 'aggregatedAmountLimit' => 'setAggregatedAmountLimit', + 'effect' => 'setEffect', + 'isDynamic' => 'setIsDynamic', + 'unitOff' => 'setUnitOff', + 'unitOffFormula' => 'setUnitOffFormula', + 'unitType' => 'setUnitType', + 'product' => 'setProduct', + 'sku' => 'setSku', + 'units' => 'setUnits', + 'percentOff' => 'setPercentOff', + 'percentOffFormula' => 'setPercentOffFormula', + 'amountLimit' => 'setAmountLimit', + 'fixedAmount' => 'setFixedAmount', + 'fixedAmountFormula' => 'setFixedAmountFormula' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'amountOff' => 'getAmountOff', + 'amountOffFormula' => 'getAmountOffFormula', + 'aggregatedAmountLimit' => 'getAggregatedAmountLimit', + 'effect' => 'getEffect', + 'isDynamic' => 'getIsDynamic', + 'unitOff' => 'getUnitOff', + 'unitOffFormula' => 'getUnitOffFormula', + 'unitType' => 'getUnitType', + 'product' => 'getProduct', + 'sku' => 'getSku', + 'units' => 'getUnits', + 'percentOff' => 'getPercentOff', + 'percentOffFormula' => 'getPercentOffFormula', + 'amountLimit' => 'getAmountLimit', + 'fixedAmount' => 'getFixedAmount', + 'fixedAmountFormula' => 'getFixedAmountFormula' + ]; + + /** + * 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 TYPE_AMOUNT = 'AMOUNT'; + public const TYPE_UNIT = 'UNIT'; + public const TYPE_PERCENT = 'PERCENT'; + public const TYPE_FIXED = 'FIXED'; + public const EFFECT_APPLY_TO_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_APPLY_TO_ITEMS = 'APPLY_TO_ITEMS'; + public const EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY = 'APPLY_TO_ITEMS_PROPORTIONALLY'; + public const EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY = 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY'; + public const EFFECT_APPLY_TO_ITEMS_BY_QUANTITY = 'APPLY_TO_ITEMS_BY_QUANTITY'; + public const EFFECT_ADD_MISSING_ITEMS = 'ADD_MISSING_ITEMS'; + public const EFFECT_ADD_NEW_ITEMS = 'ADD_NEW_ITEMS'; + public const EFFECT_ADD_MANY_ITEMS = 'ADD_MANY_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_AMOUNT, + self::TYPE_UNIT, + self::TYPE_PERCENT, + self::TYPE_FIXED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_APPLY_TO_ORDER, + self::EFFECT_APPLY_TO_ITEMS, + self::EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY, + self::EFFECT_APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, + self::EFFECT_APPLY_TO_ITEMS_BY_QUANTITY, + self::EFFECT_ADD_MISSING_ITEMS, + self::EFFECT_ADD_NEW_ITEMS, + self::EFFECT_ADD_MANY_ITEMS, + ]; + } + + /** + * 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('type', $data ?? [], null); + $this->setIfExists('amountOff', $data ?? [], null); + $this->setIfExists('amountOffFormula', $data ?? [], null); + $this->setIfExists('aggregatedAmountLimit', $data ?? [], null); + $this->setIfExists('effect', $data ?? [], null); + $this->setIfExists('isDynamic', $data ?? [], null); + $this->setIfExists('unitOff', $data ?? [], null); + $this->setIfExists('unitOffFormula', $data ?? [], null); + $this->setIfExists('unitType', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('sku', $data ?? [], null); + $this->setIfExists('units', $data ?? [], null); + $this->setIfExists('percentOff', $data ?? [], null); + $this->setIfExists('percentOffFormula', $data ?? [], null); + $this->setIfExists('amountLimit', $data ?? [], null); + $this->setIfExists('fixedAmount', $data ?? [], null); + $this->setIfExists('fixedAmountFormula', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets amountOff + * + * @return float|null + */ + public function getAmountOff() + { + return $this->container['amountOff']; + } + + /** + * Sets amountOff + * + * @param float|null $amountOff Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. + * + * @return self + */ + public function setAmountOff($amountOff) + { + if (is_null($amountOff)) { + array_push($this->openAPINullablesSetToNull, 'amountOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountOff'] = $amountOff; + + return $this; + } + + /** + * Gets amountOffFormula + * + * @return string|null + */ + public function getAmountOffFormula() + { + return $this->container['amountOffFormula']; + } + + /** + * Sets amountOffFormula + * + * @param string|null $amountOffFormula amountOffFormula + * + * @return self + */ + public function setAmountOffFormula($amountOffFormula) + { + if (is_null($amountOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'amountOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountOffFormula'] = $amountOffFormula; + + return $this; + } + + /** + * Gets aggregatedAmountLimit + * + * @return int|null + */ + public function getAggregatedAmountLimit() + { + return $this->container['aggregatedAmountLimit']; + } + + /** + * Sets aggregatedAmountLimit + * + * @param int|null $aggregatedAmountLimit Maximum discount amount per order. + * + * @return self + */ + public function setAggregatedAmountLimit($aggregatedAmountLimit) + { + if (is_null($aggregatedAmountLimit)) { + array_push($this->openAPINullablesSetToNull, 'aggregatedAmountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('aggregatedAmountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['aggregatedAmountLimit'] = $aggregatedAmountLimit; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect effect + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + throw new \InvalidArgumentException('non-nullable effect cannot be null'); + } + $allowedValues = $this->getEffectAllowableValues(); + if (!in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + return $this; + } + + /** + * Gets isDynamic + * + * @return bool|null + */ + public function getIsDynamic() + { + return $this->container['isDynamic']; + } + + /** + * Sets isDynamic + * + * @param bool|null $isDynamic Flag indicating whether the discount was calculated using a formula. + * + * @return self + */ + public function setIsDynamic($isDynamic) + { + if (is_null($isDynamic)) { + array_push($this->openAPINullablesSetToNull, 'isDynamic'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isDynamic', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isDynamic'] = $isDynamic; + + return $this; + } + + /** + * Gets unitOff + * + * @return int|null + */ + public function getUnitOff() + { + return $this->container['unitOff']; + } + + /** + * Sets unitOff + * + * @param int|null $unitOff Number of units to be granted a full value discount. + * + * @return self + */ + public function setUnitOff($unitOff) + { + if (is_null($unitOff)) { + array_push($this->openAPINullablesSetToNull, 'unitOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitOff'] = $unitOff; + + return $this; + } + + /** + * Gets unitOffFormula + * + * @return string|null + */ + public function getUnitOffFormula() + { + return $this->container['unitOffFormula']; + } + + /** + * Sets unitOffFormula + * + * @param string|null $unitOffFormula unitOffFormula + * + * @return self + */ + public function setUnitOffFormula($unitOffFormula) + { + if (is_null($unitOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'unitOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitOffFormula'] = $unitOffFormula; + + return $this; + } + + /** + * Gets unitType + * + * @return string|null + */ + public function getUnitType() + { + return $this->container['unitType']; + } + + /** + * Sets unitType + * + * @param string|null $unitType The product deemed as free, chosen from product inventory (e.g. time, items). + * + * @return self + */ + public function setUnitType($unitType) + { + if (is_null($unitType)) { + array_push($this->openAPINullablesSetToNull, 'unitType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('unitType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['unitType'] = $unitType; + + return $this; + } + + /** + * Gets product + * + * @return \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct|null + */ + public function getProduct() + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param \OpenAPI\Client\Model\ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct|null $product product + * + * @return self + */ + public function setProduct($product) + { + if (is_null($product)) { + throw new \InvalidArgumentException('non-nullable product cannot be null'); + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets sku + * + * @return \OpenAPI\Client\Model\SimpleSkuDiscountUnit|null + */ + public function getSku() + { + return $this->container['sku']; + } + + /** + * Sets sku + * + * @param \OpenAPI\Client\Model\SimpleSkuDiscountUnit|null $sku sku + * + * @return self + */ + public function setSku($sku) + { + if (is_null($sku)) { + throw new \InvalidArgumentException('non-nullable sku cannot be null'); + } + $this->container['sku'] = $sku; + + return $this; + } + + /** + * Gets units + * + * @return \OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]|null + */ + public function getUnits() + { + return $this->container['units']; + } + + /** + * Sets units + * + * @param \OpenAPI\Client\Model\DiscountUnitMultipleOneUnit[]|null $units units + * + * @return self + */ + public function setUnits($units) + { + if (is_null($units)) { + array_push($this->openAPINullablesSetToNull, 'units'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('units', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['units'] = $units; + + return $this; + } + + /** + * Gets percentOff + * + * @return float|null + */ + public function getPercentOff() + { + return $this->container['percentOff']; + } + + /** + * Sets percentOff + * + * @param float|null $percentOff The percent discount that the customer will receive. + * + * @return self + */ + public function setPercentOff($percentOff) + { + if (is_null($percentOff)) { + array_push($this->openAPINullablesSetToNull, 'percentOff'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('percentOff', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['percentOff'] = $percentOff; + + return $this; + } + + /** + * Gets percentOffFormula + * + * @return string|null + */ + public function getPercentOffFormula() + { + return $this->container['percentOffFormula']; + } + + /** + * Sets percentOffFormula + * + * @param string|null $percentOffFormula percentOffFormula + * + * @return self + */ + public function setPercentOffFormula($percentOffFormula) + { + if (is_null($percentOffFormula)) { + array_push($this->openAPINullablesSetToNull, 'percentOffFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('percentOffFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['percentOffFormula'] = $percentOffFormula; + + return $this; + } + + /** + * Gets amountLimit + * + * @return float|null + */ + public function getAmountLimit() + { + return $this->container['amountLimit']; + } + + /** + * Sets amountLimit + * + * @param float|null $amountLimit Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. + * + * @return self + */ + public function setAmountLimit($amountLimit) + { + if (is_null($amountLimit)) { + array_push($this->openAPINullablesSetToNull, 'amountLimit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amountLimit', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amountLimit'] = $amountLimit; + + return $this; + } + + /** + * Gets fixedAmount + * + * @return float|null + */ + public function getFixedAmount() + { + return $this->container['fixedAmount']; + } + + /** + * Sets fixedAmount + * + * @param float|null $fixedAmount Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. + * + * @return self + */ + public function setFixedAmount($fixedAmount) + { + if (is_null($fixedAmount)) { + array_push($this->openAPINullablesSetToNull, 'fixedAmount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fixedAmount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fixedAmount'] = $fixedAmount; + + return $this; + } + + /** + * Gets fixedAmountFormula + * + * @return string|null + */ + public function getFixedAmountFormula() + { + return $this->container['fixedAmountFormula']; + } + + /** + * Sets fixedAmountFormula + * + * @param string|null $fixedAmountFormula fixedAmountFormula + * + * @return self + */ + public function setFixedAmountFormula($fixedAmountFormula) + { + if (is_null($fixedAmountFormula)) { + array_push($this->openAPINullablesSetToNull, 'fixedAmountFormula'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fixedAmountFormula', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fixedAmountFormula'] = $fixedAmountFormula; + + 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/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.php b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.php new file mode 100644 index 0000000..101c0e0 --- /dev/null +++ b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.php @@ -0,0 +1,499 @@ + + */ +class ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique product ID, assigned by Voucherify. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId Product's source ID. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Product name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/ValidationsValidateResponseBodyRedeemablesItemResultGift.php b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultGift.php new file mode 100644 index 0000000..c0fd44d --- /dev/null +++ b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultGift.php @@ -0,0 +1,418 @@ + + */ +class ValidationsValidateResponseBodyRedeemablesItemResultGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateResponseBodyRedeemablesItemResultGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'credits' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'credits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'credits' => true + ]; + + /** + * 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 = [ + 'credits' => 'credits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'credits' => 'setCredits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'credits' => 'getCredits' + ]; + + /** + * 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('credits', $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 credits + * + * @return int|null + */ + public function getCredits() + { + return $this->container['credits']; + } + + /** + * Sets credits + * + * @param int|null $credits Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). + * + * @return self + */ + public function setCredits($credits) + { + if (is_null($credits)) { + array_push($this->openAPINullablesSetToNull, 'credits'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('credits', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['credits'] = $credits; + + 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/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.php b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.php new file mode 100644 index 0000000..f0dd8a8 --- /dev/null +++ b/src/Model/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.php @@ -0,0 +1,417 @@ + + */ +class ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true + ]; + + /** + * 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 = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * 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('points', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total number of loyalty points to be applied in the redemption. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + 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/ValidityHours.php b/src/Model/ValidityHours.php new file mode 100644 index 0000000..586dad3 --- /dev/null +++ b/src/Model/ValidityHours.php @@ -0,0 +1,418 @@ + + */ +class ValidityHours implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidityHours'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'daily' => '\OpenAPI\Client\Model\ValidityHoursDailyItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'daily' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'daily' => true + ]; + + /** + * 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 = [ + 'daily' => 'daily' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'daily' => 'setDaily' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'daily' => 'getDaily' + ]; + + /** + * 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('daily', $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 daily + * + * @return \OpenAPI\Client\Model\ValidityHoursDailyItem[]|null + */ + public function getDaily() + { + return $this->container['daily']; + } + + /** + * Sets daily + * + * @param \OpenAPI\Client\Model\ValidityHoursDailyItem[]|null $daily Defines the reccuring period(s) when the resource is active. The periods should not overlap. + * + * @return self + */ + public function setDaily($daily) + { + if (is_null($daily)) { + array_push($this->openAPINullablesSetToNull, 'daily'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('daily', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['daily'] = $daily; + + 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/ValidityHoursDailyItem.php b/src/Model/ValidityHoursDailyItem.php new file mode 100644 index 0000000..33d64b1 --- /dev/null +++ b/src/Model/ValidityHoursDailyItem.php @@ -0,0 +1,513 @@ + + */ +class ValidityHoursDailyItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidityHoursDailyItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'startTime' => 'string', + 'daysOfWeek' => 'int[]', + 'expirationTime' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'startTime' => 'time', + 'daysOfWeek' => null, + 'expirationTime' => 'time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'startTime' => false, + 'daysOfWeek' => false, + 'expirationTime' => 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 = [ + 'startTime' => 'start_time', + 'daysOfWeek' => 'days_of_week', + 'expirationTime' => 'expiration_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'startTime' => 'setStartTime', + 'daysOfWeek' => 'setDaysOfWeek', + 'expirationTime' => 'setExpirationTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'startTime' => 'getStartTime', + 'daysOfWeek' => 'getDaysOfWeek', + 'expirationTime' => 'getExpirationTime' + ]; + + /** + * 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 DAYS_OF_WEEK_0 = 0; + public const DAYS_OF_WEEK_1 = 1; + public const DAYS_OF_WEEK_2 = 2; + public const DAYS_OF_WEEK_3 = 3; + public const DAYS_OF_WEEK_4 = 4; + public const DAYS_OF_WEEK_5 = 5; + public const DAYS_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDaysOfWeekAllowableValues() + { + return [ + self::DAYS_OF_WEEK_0, + self::DAYS_OF_WEEK_1, + self::DAYS_OF_WEEK_2, + self::DAYS_OF_WEEK_3, + self::DAYS_OF_WEEK_4, + self::DAYS_OF_WEEK_5, + self::DAYS_OF_WEEK_6, + ]; + } + + /** + * 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('startTime', $data ?? [], null); + $this->setIfExists('daysOfWeek', $data ?? [], null); + $this->setIfExists('expirationTime', $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 startTime + * + * @return string|null + */ + public function getStartTime() + { + return $this->container['startTime']; + } + + /** + * Sets startTime + * + * @param string|null $startTime Defines the starting hour of validity in the HH:mm format. The resource is *inactive before* this time. + * + * @return self + */ + public function setStartTime($startTime) + { + if (is_null($startTime)) { + throw new \InvalidArgumentException('non-nullable startTime cannot be null'); + } + $this->container['startTime'] = $startTime; + + return $this; + } + + /** + * Gets daysOfWeek + * + * @return int[]|null + */ + public function getDaysOfWeek() + { + return $this->container['daysOfWeek']; + } + + /** + * Sets daysOfWeek + * + * @param int[]|null $daysOfWeek Integer array corresponding to the particular days of the week in which the resource is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setDaysOfWeek($daysOfWeek) + { + if (is_null($daysOfWeek)) { + throw new \InvalidArgumentException('non-nullable daysOfWeek cannot be null'); + } + $allowedValues = $this->getDaysOfWeekAllowableValues(); + if (array_diff($daysOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'daysOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['daysOfWeek'] = $daysOfWeek; + + return $this; + } + + /** + * Gets expirationTime + * + * @return string|null + */ + public function getExpirationTime() + { + return $this->container['expirationTime']; + } + + /** + * Sets expirationTime + * + * @param string|null $expirationTime Defines the ending hour of validity in the HH:mm format. The resource is *inactive after* this time. + * + * @return self + */ + public function setExpirationTime($expirationTime) + { + if (is_null($expirationTime)) { + throw new \InvalidArgumentException('non-nullable expirationTime cannot be null'); + } + $this->container['expirationTime'] = $expirationTime; + + 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/ValidityTimeframe.php b/src/Model/ValidityTimeframe.php new file mode 100644 index 0000000..43bf003 --- /dev/null +++ b/src/Model/ValidityTimeframe.php @@ -0,0 +1,459 @@ + + */ +class ValidityTimeframe implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidityTimeframe'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'duration' => 'string', + 'interval' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'duration' => null, + 'interval' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'duration' => true, + 'interval' => true + ]; + + /** + * 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 = [ + 'duration' => 'duration', + 'interval' => 'interval' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'duration' => 'setDuration', + 'interval' => 'setInterval' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'duration' => 'getDuration', + 'interval' => 'getInterval' + ]; + + /** + * 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('duration', $data ?? [], null); + $this->setIfExists('interval', $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 duration + * + * @return string|null + */ + public function getDuration() + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour. + * + * @return self + */ + public function setDuration($duration) + { + if (is_null($duration)) { + array_push($this->openAPINullablesSetToNull, 'duration'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('duration', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets interval + * + * @return string|null + */ + public function getInterval() + { + return $this->container['interval']; + } + + /** + * Sets interval + * + * @param string|null $interval Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day. + * + * @return self + */ + public function setInterval($interval) + { + if (is_null($interval)) { + array_push($this->openAPINullablesSetToNull, 'interval'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('interval', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['interval'] = $interval; + + 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/Voucher.php b/src/Model/Voucher.php new file mode 100644 index 0000000..69e463f --- /dev/null +++ b/src/Model/Voucher.php @@ -0,0 +1,1601 @@ + + */ +class Voucher implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Voucher'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\VoucherGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\VoucherLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\VoucherPublish', + 'redemption' => '\OpenAPI\Client\Model\VoucherRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\VoucherGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\VoucherGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\VoucherLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\VoucherLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\VoucherPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\VoucherPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VoucherRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VoucherRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + 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/VoucherAssets.php b/src/Model/VoucherAssets.php new file mode 100644 index 0000000..948b1de --- /dev/null +++ b/src/Model/VoucherAssets.php @@ -0,0 +1,459 @@ + + */ +class VoucherAssets implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherAssets'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'qr' => '\OpenAPI\Client\Model\VoucherAssetsQr', + 'barcode' => '\OpenAPI\Client\Model\VoucherAssetsBarcode' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'qr' => null, + 'barcode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'qr' => true, + 'barcode' => true + ]; + + /** + * 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 = [ + 'qr' => 'qr', + 'barcode' => 'barcode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'qr' => 'setQr', + 'barcode' => 'setBarcode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'qr' => 'getQr', + 'barcode' => 'getBarcode' + ]; + + /** + * 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('qr', $data ?? [], null); + $this->setIfExists('barcode', $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 qr + * + * @return \OpenAPI\Client\Model\VoucherAssetsQr|null + */ + public function getQr() + { + return $this->container['qr']; + } + + /** + * Sets qr + * + * @param \OpenAPI\Client\Model\VoucherAssetsQr|null $qr qr + * + * @return self + */ + public function setQr($qr) + { + if (is_null($qr)) { + array_push($this->openAPINullablesSetToNull, 'qr'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('qr', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['qr'] = $qr; + + return $this; + } + + /** + * Gets barcode + * + * @return \OpenAPI\Client\Model\VoucherAssetsBarcode|null + */ + public function getBarcode() + { + return $this->container['barcode']; + } + + /** + * Sets barcode + * + * @param \OpenAPI\Client\Model\VoucherAssetsBarcode|null $barcode barcode + * + * @return self + */ + public function setBarcode($barcode) + { + if (is_null($barcode)) { + array_push($this->openAPINullablesSetToNull, 'barcode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('barcode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['barcode'] = $barcode; + + 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/VoucherAssetsBarcode.php b/src/Model/VoucherAssetsBarcode.php new file mode 100644 index 0000000..54cb482 --- /dev/null +++ b/src/Model/VoucherAssetsBarcode.php @@ -0,0 +1,459 @@ + + */ +class VoucherAssetsBarcode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherAssetsBarcode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'url' => 'getUrl' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('url', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Encrypted voucher code ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VoucherAssetsQr.php b/src/Model/VoucherAssetsQr.php new file mode 100644 index 0000000..33c4799 --- /dev/null +++ b/src/Model/VoucherAssetsQr.php @@ -0,0 +1,459 @@ + + */ +class VoucherAssetsQr implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherAssetsQr'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'url' => 'getUrl' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('url', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Encrypted voucher code ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VoucherGift.php b/src/Model/VoucherGift.php new file mode 100644 index 0000000..77288cf --- /dev/null +++ b/src/Model/VoucherGift.php @@ -0,0 +1,534 @@ + + */ +class VoucherGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/VoucherLoyaltyCard.php b/src/Model/VoucherLoyaltyCard.php new file mode 100644 index 0000000..c19738f --- /dev/null +++ b/src/Model/VoucherLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class VoucherLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/VoucherPublish.php b/src/Model/VoucherPublish.php new file mode 100644 index 0000000..e343f4f --- /dev/null +++ b/src/Model/VoucherPublish.php @@ -0,0 +1,500 @@ + + */ +class VoucherPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VoucherRedemption.php b/src/Model/VoucherRedemption.php new file mode 100644 index 0000000..b714165 --- /dev/null +++ b/src/Model/VoucherRedemption.php @@ -0,0 +1,582 @@ + + */ +class VoucherRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VoucherTransaction.php b/src/Model/VoucherTransaction.php new file mode 100644 index 0000000..62b57cf --- /dev/null +++ b/src/Model/VoucherTransaction.php @@ -0,0 +1,832 @@ + + */ +class VoucherTransaction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string', + 'voucherId' => 'string', + 'campaignId' => 'string', + 'source' => 'string', + 'reason' => 'string', + 'type' => 'string', + 'details' => '\OpenAPI\Client\Model\VoucherTransactionDetails', + 'relatedTransactionId' => 'string', + 'createdAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null, + 'voucherId' => null, + 'campaignId' => null, + 'source' => null, + 'reason' => null, + 'type' => null, + 'details' => null, + 'relatedTransactionId' => null, + 'createdAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true, + 'voucherId' => true, + 'campaignId' => true, + 'source' => true, + 'reason' => true, + 'type' => true, + 'details' => true, + 'relatedTransactionId' => true, + 'createdAt' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id', + 'voucherId' => 'voucher_id', + 'campaignId' => 'campaign_id', + 'source' => 'source', + 'reason' => 'reason', + 'type' => 'type', + 'details' => 'details', + 'relatedTransactionId' => 'related_transaction_id', + 'createdAt' => 'created_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId', + 'voucherId' => 'setVoucherId', + 'campaignId' => 'setCampaignId', + 'source' => 'setSource', + 'reason' => 'setReason', + 'type' => 'setType', + 'details' => 'setDetails', + 'relatedTransactionId' => 'setRelatedTransactionId', + 'createdAt' => 'setCreatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId', + 'voucherId' => 'getVoucherId', + 'campaignId' => 'getCampaignId', + 'source' => 'getSource', + 'reason' => 'getReason', + 'type' => 'getType', + 'details' => 'getDetails', + 'relatedTransactionId' => 'getRelatedTransactionId', + 'createdAt' => 'getCreatedAt' + ]; + + /** + * 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 TYPE_ACCRUAL = 'POINTS_ACCRUAL'; + public const TYPE_REDEMPTION = 'POINTS_REDEMPTION'; + public const TYPE_REFUND = 'POINTS_REFUND'; + public const TYPE_ADDITION = 'POINTS_ADDITION'; + public const TYPE_REMOVAL = 'POINTS_REMOVAL'; + public const TYPE_EXPIRATION = 'POINTS_EXPIRATION'; + public const TYPE_TRANSFER_IN = 'POINTS_TRANSFER_IN'; + public const TYPE_TRANSFER_OUT = 'POINTS_TRANSFER_OUT'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_ACCRUAL, + self::TYPE_REDEMPTION, + self::TYPE_REFUND, + self::TYPE_ADDITION, + self::TYPE_REMOVAL, + self::TYPE_EXPIRATION, + self::TYPE_TRANSFER_IN, + self::TYPE_TRANSFER_OUT, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('voucherId', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + $this->setIfExists('relatedTransactionId', $data ?? [], null); + $this->setIfExists('createdAt', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique transaction ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets voucherId + * + * @return string|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param string|null $voucherId Unique voucher ID. + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + array_push($this->openAPINullablesSetToNull, 'voucherId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucherId'] = $voucherId; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets source + * + * @return string|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string|null $source The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason Reason why the transaction occurred. In case of a redemption, this value is null. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets details + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetails|null + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetails|null $details details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + array_push($this->openAPINullablesSetToNull, 'details'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('details', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['details'] = $details; + + return $this; + } + + /** + * Gets relatedTransactionId + * + * @return string|null + */ + public function getRelatedTransactionId() + { + return $this->container['relatedTransactionId']; + } + + /** + * Sets relatedTransactionId + * + * @param string|null $relatedTransactionId The related transaction ID on the receiving card. + * + * @return self + */ + public function setRelatedTransactionId($relatedTransactionId) + { + if (is_null($relatedTransactionId)) { + array_push($this->openAPINullablesSetToNull, 'relatedTransactionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedTransactionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedTransactionId'] = $relatedTransactionId; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + 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/VoucherTransactionDetails.php b/src/Model/VoucherTransactionDetails.php new file mode 100644 index 0000000..19ac477 --- /dev/null +++ b/src/Model/VoucherTransactionDetails.php @@ -0,0 +1,896 @@ + + */ +class VoucherTransactionDetails implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'balance' => '\OpenAPI\Client\Model\VoucherTransactionDetailsBalance', + 'order' => '\OpenAPI\Client\Model\VoucherTransactionDetailsOrder', + 'event' => '\OpenAPI\Client\Model\VoucherTransactionDetailsEvent', + 'earningRule' => '\OpenAPI\Client\Model\VoucherTransactionDetailsEarningRule', + 'segment' => '\OpenAPI\Client\Model\VoucherTransactionDetailsSegment', + 'loyaltyTier' => '\OpenAPI\Client\Model\VoucherTransactionDetailsLoyaltyTier', + 'redemption' => '\OpenAPI\Client\Model\VoucherTransactionDetailsRedemption', + 'rollback' => '\OpenAPI\Client\Model\VoucherTransactionDetailsRollback', + 'customEvent' => '\OpenAPI\Client\Model\VoucherTransactionDetailsCustomEvent', + 'eventSchema' => '\OpenAPI\Client\Model\VoucherTransactionDetailsEventSchema', + 'reward' => '\OpenAPI\Client\Model\VoucherTransactionDetailsReward', + 'sourceVoucher' => '\OpenAPI\Client\Model\SimpleVoucher', + 'destinationVoucher' => '\OpenAPI\Client\Model\SimpleVoucher' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'balance' => null, + 'order' => null, + 'event' => null, + 'earningRule' => null, + 'segment' => null, + 'loyaltyTier' => null, + 'redemption' => null, + 'rollback' => null, + 'customEvent' => null, + 'eventSchema' => null, + 'reward' => null, + 'sourceVoucher' => null, + 'destinationVoucher' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'balance' => true, + 'order' => true, + 'event' => true, + 'earningRule' => true, + 'segment' => true, + 'loyaltyTier' => true, + 'redemption' => true, + 'rollback' => true, + 'customEvent' => true, + 'eventSchema' => true, + 'reward' => true, + 'sourceVoucher' => false, + 'destinationVoucher' => 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 = [ + 'balance' => 'balance', + 'order' => 'order', + 'event' => 'event', + 'earningRule' => 'earning_rule', + 'segment' => 'segment', + 'loyaltyTier' => 'loyalty_tier', + 'redemption' => 'redemption', + 'rollback' => 'rollback', + 'customEvent' => 'custom_event', + 'eventSchema' => 'event_schema', + 'reward' => 'reward', + 'sourceVoucher' => 'source_voucher', + 'destinationVoucher' => 'destination_voucher' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'balance' => 'setBalance', + 'order' => 'setOrder', + 'event' => 'setEvent', + 'earningRule' => 'setEarningRule', + 'segment' => 'setSegment', + 'loyaltyTier' => 'setLoyaltyTier', + 'redemption' => 'setRedemption', + 'rollback' => 'setRollback', + 'customEvent' => 'setCustomEvent', + 'eventSchema' => 'setEventSchema', + 'reward' => 'setReward', + 'sourceVoucher' => 'setSourceVoucher', + 'destinationVoucher' => 'setDestinationVoucher' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'balance' => 'getBalance', + 'order' => 'getOrder', + 'event' => 'getEvent', + 'earningRule' => 'getEarningRule', + 'segment' => 'getSegment', + 'loyaltyTier' => 'getLoyaltyTier', + 'redemption' => 'getRedemption', + 'rollback' => 'getRollback', + 'customEvent' => 'getCustomEvent', + 'eventSchema' => 'getEventSchema', + 'reward' => 'getReward', + 'sourceVoucher' => 'getSourceVoucher', + 'destinationVoucher' => 'getDestinationVoucher' + ]; + + /** + * 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('balance', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('earningRule', $data ?? [], null); + $this->setIfExists('segment', $data ?? [], null); + $this->setIfExists('loyaltyTier', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('rollback', $data ?? [], null); + $this->setIfExists('customEvent', $data ?? [], null); + $this->setIfExists('eventSchema', $data ?? [], null); + $this->setIfExists('reward', $data ?? [], null); + $this->setIfExists('sourceVoucher', $data ?? [], null); + $this->setIfExists('destinationVoucher', $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 balance + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsBalance|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsBalance|null $balance balance + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets order + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsOrder|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsOrder|null $order order + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets event + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsEvent|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsEvent|null $event event + * + * @return self + */ + public function setEvent($event) + { + if (is_null($event)) { + array_push($this->openAPINullablesSetToNull, 'event'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets earningRule + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsEarningRule|null + */ + public function getEarningRule() + { + return $this->container['earningRule']; + } + + /** + * Sets earningRule + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsEarningRule|null $earningRule earningRule + * + * @return self + */ + public function setEarningRule($earningRule) + { + if (is_null($earningRule)) { + array_push($this->openAPINullablesSetToNull, 'earningRule'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('earningRule', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['earningRule'] = $earningRule; + + return $this; + } + + /** + * Gets segment + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsSegment|null + */ + public function getSegment() + { + return $this->container['segment']; + } + + /** + * Sets segment + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsSegment|null $segment segment + * + * @return self + */ + public function setSegment($segment) + { + if (is_null($segment)) { + array_push($this->openAPINullablesSetToNull, 'segment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('segment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['segment'] = $segment; + + return $this; + } + + /** + * Gets loyaltyTier + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsLoyaltyTier|null + */ + public function getLoyaltyTier() + { + return $this->container['loyaltyTier']; + } + + /** + * Sets loyaltyTier + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsLoyaltyTier|null $loyaltyTier loyaltyTier + * + * @return self + */ + public function setLoyaltyTier($loyaltyTier) + { + if (is_null($loyaltyTier)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyTier'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyTier', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyTier'] = $loyaltyTier; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets rollback + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsRollback|null + */ + public function getRollback() + { + return $this->container['rollback']; + } + + /** + * Sets rollback + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsRollback|null $rollback rollback + * + * @return self + */ + public function setRollback($rollback) + { + if (is_null($rollback)) { + array_push($this->openAPINullablesSetToNull, 'rollback'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('rollback', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['rollback'] = $rollback; + + return $this; + } + + /** + * Gets customEvent + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsCustomEvent|null + */ + public function getCustomEvent() + { + return $this->container['customEvent']; + } + + /** + * Sets customEvent + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsCustomEvent|null $customEvent customEvent + * + * @return self + */ + public function setCustomEvent($customEvent) + { + if (is_null($customEvent)) { + array_push($this->openAPINullablesSetToNull, 'customEvent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('customEvent', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['customEvent'] = $customEvent; + + return $this; + } + + /** + * Gets eventSchema + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsEventSchema|null + */ + public function getEventSchema() + { + return $this->container['eventSchema']; + } + + /** + * Sets eventSchema + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsEventSchema|null $eventSchema eventSchema + * + * @return self + */ + public function setEventSchema($eventSchema) + { + if (is_null($eventSchema)) { + array_push($this->openAPINullablesSetToNull, 'eventSchema'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('eventSchema', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['eventSchema'] = $eventSchema; + + return $this; + } + + /** + * Gets reward + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsReward|null + */ + public function getReward() + { + return $this->container['reward']; + } + + /** + * Sets reward + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsReward|null $reward reward + * + * @return self + */ + public function setReward($reward) + { + if (is_null($reward)) { + array_push($this->openAPINullablesSetToNull, 'reward'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reward', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reward'] = $reward; + + return $this; + } + + /** + * Gets sourceVoucher + * + * @return \OpenAPI\Client\Model\SimpleVoucher|null + */ + public function getSourceVoucher() + { + return $this->container['sourceVoucher']; + } + + /** + * Sets sourceVoucher + * + * @param \OpenAPI\Client\Model\SimpleVoucher|null $sourceVoucher sourceVoucher + * + * @return self + */ + public function setSourceVoucher($sourceVoucher) + { + if (is_null($sourceVoucher)) { + throw new \InvalidArgumentException('non-nullable sourceVoucher cannot be null'); + } + $this->container['sourceVoucher'] = $sourceVoucher; + + return $this; + } + + /** + * Gets destinationVoucher + * + * @return \OpenAPI\Client\Model\SimpleVoucher|null + */ + public function getDestinationVoucher() + { + return $this->container['destinationVoucher']; + } + + /** + * Sets destinationVoucher + * + * @param \OpenAPI\Client\Model\SimpleVoucher|null $destinationVoucher destinationVoucher + * + * @return self + */ + public function setDestinationVoucher($destinationVoucher) + { + if (is_null($destinationVoucher)) { + throw new \InvalidArgumentException('non-nullable destinationVoucher cannot be null'); + } + $this->container['destinationVoucher'] = $destinationVoucher; + + 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/VoucherTransactionDetailsBalance.php b/src/Model/VoucherTransactionDetailsBalance.php new file mode 100644 index 0000000..de6b735 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsBalance.php @@ -0,0 +1,705 @@ + + */ +class VoucherTransactionDetailsBalance implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsBalance'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'total' => 'int', + 'object' => 'string', + 'points' => 'int', + 'balance' => 'int', + 'relatedObject' => '\OpenAPI\Client\Model\VoucherTransactionDetailsBalanceRelatedObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'total' => null, + 'object' => null, + 'points' => null, + 'balance' => null, + 'relatedObject' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'total' => true, + 'object' => true, + 'points' => true, + 'balance' => true, + 'relatedObject' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'total' => 'total', + 'object' => 'object', + 'points' => 'points', + 'balance' => 'balance', + 'relatedObject' => 'related_object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'total' => 'setTotal', + 'object' => 'setObject', + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'relatedObject' => 'setRelatedObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'total' => 'getTotal', + 'object' => 'getObject', + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'relatedObject' => 'getRelatedObject' + ]; + + /** + * 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 TYPE_LOYALTY_CARD = 'loyalty_card'; + public const OBJECT_BALANCE = 'balance'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_BALANCE, + ]; + } + + /** + * 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('type', $data ?? [], 'loyalty_card'); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'balance'); + $this->setIfExists('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('relatedObject', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['type']) && !preg_match("/loyalty_card/", $this->container['type'])) { + $invalidProperties[] = "invalid value for 'type', must be conform to the pattern /loyalty_card/."; + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['object']) && !preg_match("/balance/", $this->container['object'])) { + $invalidProperties[] = "invalid value for 'object', must be conform to the pattern /balance/."; + } + + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of voucher whose balance is being adjusted due to the transaction. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($type) && (!preg_match("/loyalty_card/", $type))) { + throw new \InvalidArgumentException("invalid value for \$type when calling VoucherTransactionDetailsBalance., must conform to the pattern /loyalty_card/."); + } + + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total The number of all points accumulated on the card as affected by add or subtract operations. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by the JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($object) && (!preg_match("/balance/", $object))) { + throw new \InvalidArgumentException("invalid value for \$object when calling VoucherTransactionDetailsBalance., must conform to the pattern /balance/."); + } + + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Points added or subtracted in the transaction. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance The available points on the card after the transaction as affected by redemption or rollback. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets relatedObject + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsBalanceRelatedObject|null + */ + public function getRelatedObject() + { + return $this->container['relatedObject']; + } + + /** + * Sets relatedObject + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsBalanceRelatedObject|null $relatedObject relatedObject + * + * @return self + */ + public function setRelatedObject($relatedObject) + { + if (is_null($relatedObject)) { + array_push($this->openAPINullablesSetToNull, 'relatedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObject'] = $relatedObject; + + 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/VoucherTransactionDetailsBalanceRelatedObject.php b/src/Model/VoucherTransactionDetailsBalanceRelatedObject.php new file mode 100644 index 0000000..db6ddb9 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsBalanceRelatedObject.php @@ -0,0 +1,500 @@ + + */ +class VoucherTransactionDetailsBalanceRelatedObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsBalanceRelatedObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType' + ]; + + /** + * 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 TYPE_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_VOUCHER, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], 'voucher'); + } + + /** + * 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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['type']) && !preg_match("/voucher/", $this->container['type'])) { + $invalidProperties[] = "invalid value for 'type', must be conform to the pattern /voucher/."; + } + + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The object being modified, i.e. voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + + if (!is_null($type) && (!preg_match("/voucher/", $type))) { + throw new \InvalidArgumentException("invalid value for \$type when calling VoucherTransactionDetailsBalanceRelatedObject., must conform to the pattern /voucher/."); + } + + $this->container['type'] = $type; + + 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/VoucherTransactionDetailsCustomEvent.php b/src/Model/VoucherTransactionDetailsCustomEvent.php new file mode 100644 index 0000000..4407a60 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsCustomEvent.php @@ -0,0 +1,459 @@ + + */ +class VoucherTransactionDetailsCustomEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsCustomEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique event ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of custom event. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + 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/VoucherTransactionDetailsEarningRule.php b/src/Model/VoucherTransactionDetailsEarningRule.php new file mode 100644 index 0000000..33fa9d4 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsEarningRule.php @@ -0,0 +1,459 @@ + + */ +class VoucherTransactionDetailsEarningRule implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsEarningRule'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'source' => '\OpenAPI\Client\Model\VoucherTransactionDetailsEarningRuleSource' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'source' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'source' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'source' => 'source' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'source' => 'setSource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'source' => 'getSource' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('source', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique earning rule ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets source + * + * @return \OpenAPI\Client\Model\VoucherTransactionDetailsEarningRuleSource|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \OpenAPI\Client\Model\VoucherTransactionDetailsEarningRuleSource|null $source source + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + 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/VoucherTransactionDetailsEarningRuleSource.php b/src/Model/VoucherTransactionDetailsEarningRuleSource.php new file mode 100644 index 0000000..1a3dc4c --- /dev/null +++ b/src/Model/VoucherTransactionDetailsEarningRuleSource.php @@ -0,0 +1,418 @@ + + */ +class VoucherTransactionDetailsEarningRuleSource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsEarningRuleSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'banner' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'banner' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'banner' => true + ]; + + /** + * 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 = [ + 'banner' => 'banner' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'banner' => 'setBanner' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'banner' => 'getBanner' + ]; + + /** + * 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('banner', $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 banner + * + * @return string|null + */ + public function getBanner() + { + return $this->container['banner']; + } + + /** + * Sets banner + * + * @param string|null $banner Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. + * + * @return self + */ + public function setBanner($banner) + { + if (is_null($banner)) { + array_push($this->openAPINullablesSetToNull, 'banner'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('banner', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['banner'] = $banner; + + 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/VoucherTransactionDetailsEvent.php b/src/Model/VoucherTransactionDetailsEvent.php new file mode 100644 index 0000000..cb6bca8 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsEvent.php @@ -0,0 +1,459 @@ + + */ +class VoucherTransactionDetailsEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'type' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('type', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique event ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Type of event. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + 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/VoucherTransactionDetailsEventSchema.php b/src/Model/VoucherTransactionDetailsEventSchema.php new file mode 100644 index 0000000..d665e71 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsEventSchema.php @@ -0,0 +1,459 @@ + + */ +class VoucherTransactionDetailsEventSchema implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsEventSchema'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique metadata schema ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Type of custom event. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/VoucherTransactionDetailsLoyaltyTier.php b/src/Model/VoucherTransactionDetailsLoyaltyTier.php new file mode 100644 index 0000000..c430000 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsLoyaltyTier.php @@ -0,0 +1,459 @@ + + */ +class VoucherTransactionDetailsLoyaltyTier implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsLoyaltyTier'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/VoucherTransactionDetailsOrder.php b/src/Model/VoucherTransactionDetailsOrder.php new file mode 100644 index 0000000..ada3844 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsOrder.php @@ -0,0 +1,459 @@ + + */ +class VoucherTransactionDetailsOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'sourceId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'sourceId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'sourceId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'sourceId' => 'source_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'sourceId' => 'setSourceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'sourceId' => 'getSourceId' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('sourceId', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique order ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + 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/VoucherTransactionDetailsRedemption.php b/src/Model/VoucherTransactionDetailsRedemption.php new file mode 100644 index 0000000..8ee0b81 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsRedemption.php @@ -0,0 +1,418 @@ + + */ +class VoucherTransactionDetailsRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/VoucherTransactionDetailsReward.php b/src/Model/VoucherTransactionDetailsReward.php new file mode 100644 index 0000000..e93cc91 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsReward.php @@ -0,0 +1,459 @@ + + */ +class VoucherTransactionDetailsReward implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsReward'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique reward ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Reward name. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/VoucherTransactionDetailsRollback.php b/src/Model/VoucherTransactionDetailsRollback.php new file mode 100644 index 0000000..cfc19f5 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsRollback.php @@ -0,0 +1,418 @@ + + */ +class VoucherTransactionDetailsRollback implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsRollback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true + ]; + + /** + * 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 = [ + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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('id', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique redemption rollback ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/VoucherTransactionDetailsSegment.php b/src/Model/VoucherTransactionDetailsSegment.php new file mode 100644 index 0000000..a37ceb0 --- /dev/null +++ b/src/Model/VoucherTransactionDetailsSegment.php @@ -0,0 +1,459 @@ + + */ +class VoucherTransactionDetailsSegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionDetailsSegment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('name', $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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + array_push($this->openAPINullablesSetToNull, 'name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['name'] = $name; + + 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/VoucherTransactionsExportFilterConditions.php b/src/Model/VoucherTransactionsExportFilterConditions.php new file mode 100644 index 0000000..0441c68 --- /dev/null +++ b/src/Model/VoucherTransactionsExportFilterConditions.php @@ -0,0 +1,418 @@ + + */ +class VoucherTransactionsExportFilterConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionsExportFilterConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'voucherId' => '\OpenAPI\Client\Model\VoucherTransactionsExportFilterConditionsVoucherId' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'voucherId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'voucherId' => true + ]; + + /** + * 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 = [ + 'voucherId' => 'voucher_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'voucherId' => 'setVoucherId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'voucherId' => 'getVoucherId' + ]; + + /** + * 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('voucherId', $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 voucherId + * + * @return \OpenAPI\Client\Model\VoucherTransactionsExportFilterConditionsVoucherId|null + */ + public function getVoucherId() + { + return $this->container['voucherId']; + } + + /** + * Sets voucherId + * + * @param \OpenAPI\Client\Model\VoucherTransactionsExportFilterConditionsVoucherId|null $voucherId voucherId + * + * @return self + */ + public function setVoucherId($voucherId) + { + if (is_null($voucherId)) { + array_push($this->openAPINullablesSetToNull, 'voucherId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucherId'] = $voucherId; + + 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/VoucherTransactionsExportFilterConditionsVoucherId.php b/src/Model/VoucherTransactionsExportFilterConditionsVoucherId.php new file mode 100644 index 0000000..5106996 --- /dev/null +++ b/src/Model/VoucherTransactionsExportFilterConditionsVoucherId.php @@ -0,0 +1,418 @@ + + */ +class VoucherTransactionsExportFilterConditionsVoucherId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionsExportFilterConditionsVoucherId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\VoucherTransactionsExportFilterConditionsVoucherIdConditions' + ]; + + /** + * 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' => true + ]; + + /** + * 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\VoucherTransactionsExportFilterConditionsVoucherIdConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\VoucherTransactionsExportFilterConditionsVoucherIdConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + array_push($this->openAPINullablesSetToNull, 'conditions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conditions', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $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/VoucherTransactionsExportFilterConditionsVoucherIdConditions.php b/src/Model/VoucherTransactionsExportFilterConditionsVoucherIdConditions.php new file mode 100644 index 0000000..bf13132 --- /dev/null +++ b/src/Model/VoucherTransactionsExportFilterConditionsVoucherIdConditions.php @@ -0,0 +1,433 @@ + + */ +class VoucherTransactionsExportFilterConditionsVoucherIdConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionsExportFilterConditionsVoucherIdConditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'in' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'in' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'in' => true + ]; + + /** + * 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 = [ + 'in' => '$in' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'in' => 'setIn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'in' => 'getIn' + ]; + + /** + * 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('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 = []; + + if (!is_null($this->container['in']) && (count($this->container['in']) > 1)) { + $invalidProperties[] = "invalid value for 'in', number of items must be less than or equal to 1."; + } + + if (!is_null($this->container['in']) && (count($this->container['in']) < 1)) { + $invalidProperties[] = "invalid value for 'in', number of items must be greater than or equal to 1."; + } + + 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 in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in in + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + array_push($this->openAPINullablesSetToNull, 'in'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('in', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + + if (!is_null($in) && (count($in) > 1)) { + throw new \InvalidArgumentException('invalid value for $in when calling VoucherTransactionsExportFilterConditionsVoucherIdConditions., number of items must be less than or equal to 1.'); + } + if (!is_null($in) && (count($in) < 1)) { + throw new \InvalidArgumentException('invalid length for $in when calling VoucherTransactionsExportFilterConditionsVoucherIdConditions., number of items must be greater than or equal to 1.'); + } + $this->container['in'] = $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/VoucherTransactionsExportParameters.php b/src/Model/VoucherTransactionsExportParameters.php new file mode 100644 index 0000000..0b78d5f --- /dev/null +++ b/src/Model/VoucherTransactionsExportParameters.php @@ -0,0 +1,537 @@ + + */ +class VoucherTransactionsExportParameters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionsExportParameters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true + ]; + + /** + * 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 = [ + 'order' => 'order', + 'fields' => 'fields' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const FIELDS_ID = 'id'; + public const FIELDS_TYPE = 'type'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_REASON = 'reason'; + public const FIELDS_BALANCE = 'balance'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_SOURCE = 'source'; + public const FIELDS_DETAILS = 'details'; + public const FIELDS_RELATED_TRANSACTION_ID = 'related_transaction_id'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_ID, + self::FIELDS_TYPE, + self::FIELDS_SOURCE_ID, + self::FIELDS_REASON, + self::FIELDS_BALANCE, + self::FIELDS_AMOUNT, + self::FIELDS_CREATED_AT, + self::FIELDS_VOUCHER_ID, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_SOURCE, + self::FIELDS_DETAILS, + self::FIELDS_RELATED_TRANSACTION_ID, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION`
- `POINTS_ACCRUAL`
- `POINTS_REDEMPTION`
- `POINTS_REFUND`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_EXPIRATION`
- `POINTS_TRANSFER_IN`
- `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + 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/VoucherTransactionsFilters.php b/src/Model/VoucherTransactionsFilters.php new file mode 100644 index 0000000..11f9205 --- /dev/null +++ b/src/Model/VoucherTransactionsFilters.php @@ -0,0 +1,574 @@ + + */ +class VoucherTransactionsFilters implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherTransactionsFilters'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'order' => 'string', + 'fields' => 'string[]', + 'filters' => '\OpenAPI\Client\Model\VoucherTransactionsExportFilterConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'order' => null, + 'fields' => null, + 'filters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'order' => true, + 'fields' => true, + 'filters' => 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 = [ + 'order' => 'order', + 'fields' => 'fields', + 'filters' => 'filters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'order' => 'setOrder', + 'fields' => 'setFields', + 'filters' => 'setFilters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'order' => 'getOrder', + 'fields' => 'getFields', + 'filters' => 'getFilters' + ]; + + /** + * 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 ORDER_CREATED_AT = '-created_at'; + public const ORDER_CREATED_AT2 = 'created_at'; + public const FIELDS_ID = 'id'; + public const FIELDS_TYPE = 'type'; + public const FIELDS_SOURCE_ID = 'source_id'; + public const FIELDS_REASON = 'reason'; + public const FIELDS_BALANCE = 'balance'; + public const FIELDS_AMOUNT = 'amount'; + public const FIELDS_CREATED_AT = 'created_at'; + public const FIELDS_VOUCHER_ID = 'voucher_id'; + public const FIELDS_CAMPAIGN_ID = 'campaign_id'; + public const FIELDS_SOURCE = 'source'; + public const FIELDS_DETAILS = 'details'; + public const FIELDS_RELATED_TRANSACTION_ID = 'related_transaction_id'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOrderAllowableValues() + { + return [ + self::ORDER_CREATED_AT, + self::ORDER_CREATED_AT2, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getFieldsAllowableValues() + { + return [ + self::FIELDS_ID, + self::FIELDS_TYPE, + self::FIELDS_SOURCE_ID, + self::FIELDS_REASON, + self::FIELDS_BALANCE, + self::FIELDS_AMOUNT, + self::FIELDS_CREATED_AT, + self::FIELDS_VOUCHER_ID, + self::FIELDS_CAMPAIGN_ID, + self::FIELDS_SOURCE, + self::FIELDS_DETAILS, + self::FIELDS_RELATED_TRANSACTION_ID, + ]; + } + + /** + * 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('order', $data ?? [], null); + $this->setIfExists('fields', $data ?? [], null); + $this->setIfExists('filters', $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->getOrderAllowableValues(); + if (!is_null($this->container['order']) && !in_array($this->container['order'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'order', must be one of '%s'", + $this->container['order'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['filters'] === null) { + $invalidProperties[] = "'filters' can't be null"; + } + 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 order + * + * @return string|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param string|null $order How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. + * + * @return self + */ + public function setOrder($order) + { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOrderAllowableValues(); + if (!is_null($order) && !in_array($order, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'order', must be one of '%s'", + $order, + implode("', '", $allowedValues) + ) + ); + } + $this->container['order'] = $order; + + return $this; + } + + /** + * Gets fields + * + * @return string[]|null + */ + public function getFields() + { + return $this->container['fields']; + } + + /** + * Sets fields + * + * @param string[]|null $fields Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION`
- `POINTS_ACCRUAL`
- `POINTS_REDEMPTION`
- `POINTS_REFUND`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_EXPIRATION`
- `POINTS_TRANSFER_IN`
- `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | + * + * @return self + */ + public function setFields($fields) + { + if (is_null($fields)) { + array_push($this->openAPINullablesSetToNull, 'fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fields', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getFieldsAllowableValues(); + if (!is_null($fields) && array_diff($fields, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'fields', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['fields'] = $fields; + + return $this; + } + + /** + * Gets filters + * + * @return \OpenAPI\Client\Model\VoucherTransactionsExportFilterConditions + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param \OpenAPI\Client\Model\VoucherTransactionsExportFilterConditions $filters filters + * + * @return self + */ + public function setFilters($filters) + { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } + $this->container['filters'] = $filters; + + 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/VoucherWithCategories.php b/src/Model/VoucherWithCategories.php new file mode 100644 index 0000000..e23e712 --- /dev/null +++ b/src/Model/VoucherWithCategories.php @@ -0,0 +1,1567 @@ + + */ +class VoucherWithCategories implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherWithCategories'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\VoucherWithCategoriesGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\VoucherWithCategoriesLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\VoucherWithCategoriesPublish', + 'redemption' => '\OpenAPI\Client\Model\VoucherWithCategoriesRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\VoucherWithCategoriesGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\VoucherWithCategoriesGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\VoucherWithCategoriesLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\VoucherWithCategoriesLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\VoucherWithCategoriesPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\VoucherWithCategoriesPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VoucherWithCategoriesRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VoucherWithCategoriesRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + 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/VoucherWithCategoriesGift.php b/src/Model/VoucherWithCategoriesGift.php new file mode 100644 index 0000000..854467a --- /dev/null +++ b/src/Model/VoucherWithCategoriesGift.php @@ -0,0 +1,534 @@ + + */ +class VoucherWithCategoriesGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherWithCategoriesGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/VoucherWithCategoriesLoyaltyCard.php b/src/Model/VoucherWithCategoriesLoyaltyCard.php new file mode 100644 index 0000000..55e3d53 --- /dev/null +++ b/src/Model/VoucherWithCategoriesLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class VoucherWithCategoriesLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherWithCategoriesLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/VoucherWithCategoriesPublish.php b/src/Model/VoucherWithCategoriesPublish.php new file mode 100644 index 0000000..c162c1f --- /dev/null +++ b/src/Model/VoucherWithCategoriesPublish.php @@ -0,0 +1,500 @@ + + */ +class VoucherWithCategoriesPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherWithCategoriesPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VoucherWithCategoriesRedemption.php b/src/Model/VoucherWithCategoriesRedemption.php new file mode 100644 index 0000000..be5602a --- /dev/null +++ b/src/Model/VoucherWithCategoriesRedemption.php @@ -0,0 +1,582 @@ + + */ +class VoucherWithCategoriesRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VoucherWithCategoriesRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersBalanceUpdateRequestBody.php b/src/Model/VouchersBalanceUpdateRequestBody.php new file mode 100644 index 0000000..28779e2 --- /dev/null +++ b/src/Model/VouchersBalanceUpdateRequestBody.php @@ -0,0 +1,500 @@ + + */ +class VouchersBalanceUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersBalanceUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'sourceId' => 'string', + 'reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'sourceId' => null, + 'reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'sourceId' => true, + 'reason' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'sourceId' => 'source_id', + 'reason' => 'reason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'sourceId' => 'setSourceId', + 'reason' => 'setReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'sourceId' => 'getSourceId', + 'reason' => 'getReason' + ]; + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('sourceId', $data ?? [], null); + $this->setIfExists('reason', $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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount The incremental amount to be added to or removed from the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. To remove balance, simply add a minus sign before the value, i.e. to remove $20, use -2000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets sourceId + * + * @return string|null + */ + public function getSourceId() + { + return $this->container['sourceId']; + } + + /** + * Sets sourceId + * + * @param string|null $sourceId The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. + * + * @return self + */ + public function setSourceId($sourceId) + { + if (is_null($sourceId)) { + array_push($this->openAPINullablesSetToNull, 'sourceId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sourceId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['sourceId'] = $sourceId; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason Reason why the transaction occurred. + * + * @return self + */ + public function setReason($reason) + { + if (is_null($reason)) { + array_push($this->openAPINullablesSetToNull, 'reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reason', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['reason'] = $reason; + + 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/VouchersBalanceUpdateResponseBody.php b/src/Model/VouchersBalanceUpdateResponseBody.php new file mode 100644 index 0000000..890bd41 --- /dev/null +++ b/src/Model/VouchersBalanceUpdateResponseBody.php @@ -0,0 +1,762 @@ + + */ +class VouchersBalanceUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersBalanceUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'total' => 'int', + 'balance' => 'int', + 'type' => 'string', + 'operationType' => 'string', + 'object' => 'string', + 'relatedObject' => '\OpenAPI\Client\Model\VouchersBalanceUpdateResponseBodyRelatedObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'total' => null, + 'balance' => null, + 'type' => null, + 'operationType' => null, + 'object' => null, + 'relatedObject' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'total' => true, + 'balance' => true, + 'type' => true, + 'operationType' => true, + 'object' => true, + 'relatedObject' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'total' => 'total', + 'balance' => 'balance', + 'type' => 'type', + 'operationType' => 'operation_type', + 'object' => 'object', + 'relatedObject' => 'related_object' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'total' => 'setTotal', + 'balance' => 'setBalance', + 'type' => 'setType', + 'operationType' => 'setOperationType', + 'object' => 'setObject', + 'relatedObject' => 'setRelatedObject' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'total' => 'getTotal', + 'balance' => 'getBalance', + 'type' => 'getType', + 'operationType' => 'getOperationType', + 'object' => 'getObject', + 'relatedObject' => 'getRelatedObject' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'gift_voucher'; + public const TYPE_LOYALTY_CARD = 'loyalty_card'; + public const OPERATION_TYPE_MANUAL = 'MANUAL'; + public const OBJECT_BALANCE = 'balance'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperationTypeAllowableValues() + { + return [ + self::OPERATION_TYPE_MANUAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_BALANCE, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('operationType', $data ?? [], 'MANUAL'); + $this->setIfExists('object', $data ?? [], 'balance'); + $this->setIfExists('relatedObject', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getOperationTypeAllowableValues(); + if (!is_null($this->container['operationType']) && !in_array($this->container['operationType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operationType', must be one of '%s'", + $this->container['operationType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount The incremental amount added (positive integer) or subtracted (negative integer) to the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total income incurred over the lifespan of the gift card or loyalty card. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance The balance after adding or subtracting a specified amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of voucher being modified. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets operationType + * + * @return string|null + */ + public function getOperationType() + { + return $this->container['operationType']; + } + + /** + * Sets operationType + * + * @param string|null $operationType operationType + * + * @return self + */ + public function setOperationType($operationType) + { + if (is_null($operationType)) { + array_push($this->openAPINullablesSetToNull, 'operationType'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('operationType', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getOperationTypeAllowableValues(); + if (!is_null($operationType) && !in_array($operationType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operationType', must be one of '%s'", + $operationType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operationType'] = $operationType; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `balance`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets relatedObject + * + * @return \OpenAPI\Client\Model\VouchersBalanceUpdateResponseBodyRelatedObject|null + */ + public function getRelatedObject() + { + return $this->container['relatedObject']; + } + + /** + * Sets relatedObject + * + * @param \OpenAPI\Client\Model\VouchersBalanceUpdateResponseBodyRelatedObject|null $relatedObject relatedObject + * + * @return self + */ + public function setRelatedObject($relatedObject) + { + if (is_null($relatedObject)) { + array_push($this->openAPINullablesSetToNull, 'relatedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('relatedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['relatedObject'] = $relatedObject; + + 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/VouchersBalanceUpdateResponseBodyRelatedObject.php b/src/Model/VouchersBalanceUpdateResponseBodyRelatedObject.php new file mode 100644 index 0000000..007fcfe --- /dev/null +++ b/src/Model/VouchersBalanceUpdateResponseBodyRelatedObject.php @@ -0,0 +1,491 @@ + + */ +class VouchersBalanceUpdateResponseBodyRelatedObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersBalanceUpdateResponseBodyRelatedObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => true, + 'id' => true + ]; + + /** + * 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 = [ + 'type' => 'type', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'id' => 'getId' + ]; + + /** + * 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 TYPE_VOUCHER = 'voucher'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_VOUCHER, + ]; + } + + /** + * 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('type', $data ?? [], 'voucher'); + $this->setIfExists('id', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The object being modified, i.e. `voucher`. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + 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/VouchersCreateResponseBody.php b/src/Model/VouchersCreateResponseBody.php new file mode 100644 index 0000000..0509b01 --- /dev/null +++ b/src/Model/VouchersCreateResponseBody.php @@ -0,0 +1,1601 @@ + + */ +class VouchersCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\VouchersCreateResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\VouchersCreateResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\VouchersCreateResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\VouchersCreateResponseBodyRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\VouchersCreateResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\VouchersCreateResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\VouchersCreateResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\VouchersCreateResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\VouchersCreateResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\VouchersCreateResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VouchersCreateResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VouchersCreateResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + 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/VouchersCreateResponseBodyGift.php b/src/Model/VouchersCreateResponseBodyGift.php new file mode 100644 index 0000000..5e4e74c --- /dev/null +++ b/src/Model/VouchersCreateResponseBodyGift.php @@ -0,0 +1,534 @@ + + */ +class VouchersCreateResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersCreateResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/VouchersCreateResponseBodyLoyaltyCard.php b/src/Model/VouchersCreateResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..e6b48a5 --- /dev/null +++ b/src/Model/VouchersCreateResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class VouchersCreateResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersCreateResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/VouchersCreateResponseBodyPublish.php b/src/Model/VouchersCreateResponseBodyPublish.php new file mode 100644 index 0000000..cf5f854 --- /dev/null +++ b/src/Model/VouchersCreateResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class VouchersCreateResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersCreateResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersCreateResponseBodyRedemption.php b/src/Model/VouchersCreateResponseBodyRedemption.php new file mode 100644 index 0000000..00791bc --- /dev/null +++ b/src/Model/VouchersCreateResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class VouchersCreateResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersCreateResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersCreateWithSpecificCodeRequestBody.php b/src/Model/VouchersCreateWithSpecificCodeRequestBody.php new file mode 100644 index 0000000..d90e6f6 --- /dev/null +++ b/src/Model/VouchersCreateWithSpecificCodeRequestBody.php @@ -0,0 +1,1149 @@ + + */ +class VouchersCreateWithSpecificCodeRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersCreateWithSpecificCodeRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'validationRules' => 'string[]', + 'redemption' => '\OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBodyRedemption', + 'type' => 'string', + 'loyaltyCard' => '\OpenAPI\Client\Model\SimpleLoyaltyCard', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'validationRules' => null, + 'redemption' => null, + 'type' => null, + 'loyaltyCard' => null, + 'gift' => null, + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'validationRules' => true, + 'redemption' => true, + 'type' => true, + 'loyaltyCard' => false, + 'gift' => false, + 'discount' => 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 = [ + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'validationRules' => 'validation_rules', + 'redemption' => 'redemption', + 'type' => 'type', + 'loyaltyCard' => 'loyalty_card', + 'gift' => 'gift', + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'validationRules' => 'setValidationRules', + 'redemption' => 'setRedemption', + 'type' => 'setType', + 'loyaltyCard' => 'setLoyaltyCard', + 'gift' => 'setGift', + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'validationRules' => 'getValidationRules', + 'redemption' => 'getRedemption', + 'type' => 'getType', + 'loyaltyCard' => 'getLoyaltyCard', + 'gift' => 'getGift', + 'discount' => 'getDiscount' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + ]; + } + + /** + * 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('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('validationRules', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('discount', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign Identifies the voucher's parent campaign using a unique campaign name. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Identifies the voucher's parent campaign using a unique campaign ID assigned by the Voucherify API. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets validationRules + * + * @return string[]|null + */ + public function getValidationRules() + { + return $this->container['validationRules']; + } + + /** + * Sets validationRules + * + * @param string[]|null $validationRules Array containing the ID of the validation rule associated with the voucher. + * + * @return self + */ + public function setValidationRules($validationRules) + { + if (is_null($validationRules)) { + array_push($this->openAPINullablesSetToNull, 'validationRules'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validationRules', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['validationRules'] = $validationRules; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VouchersCreateWithSpecificCodeRequestBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\SimpleLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\SimpleLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/VouchersCreateWithSpecificCodeRequestBodyRedemption.php b/src/Model/VouchersCreateWithSpecificCodeRequestBodyRedemption.php new file mode 100644 index 0000000..2e0de47 --- /dev/null +++ b/src/Model/VouchersCreateWithSpecificCodeRequestBodyRedemption.php @@ -0,0 +1,417 @@ + + */ +class VouchersCreateWithSpecificCodeRequestBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersCreateWithSpecificCodeRequestBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/VouchersDisableResponseBody.php b/src/Model/VouchersDisableResponseBody.php new file mode 100644 index 0000000..efd52fb --- /dev/null +++ b/src/Model/VouchersDisableResponseBody.php @@ -0,0 +1,1601 @@ + + */ +class VouchersDisableResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersDisableResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\VouchersDisableResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\VouchersDisableResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\VouchersDisableResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\VouchersDisableResponseBodyRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\VouchersDisableResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\VouchersDisableResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\VouchersDisableResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\VouchersDisableResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\VouchersDisableResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\VouchersDisableResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VouchersDisableResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VouchersDisableResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + 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/VouchersDisableResponseBodyGift.php b/src/Model/VouchersDisableResponseBodyGift.php new file mode 100644 index 0000000..60e548e --- /dev/null +++ b/src/Model/VouchersDisableResponseBodyGift.php @@ -0,0 +1,534 @@ + + */ +class VouchersDisableResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersDisableResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/VouchersDisableResponseBodyLoyaltyCard.php b/src/Model/VouchersDisableResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..85388b2 --- /dev/null +++ b/src/Model/VouchersDisableResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class VouchersDisableResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersDisableResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/VouchersDisableResponseBodyPublish.php b/src/Model/VouchersDisableResponseBodyPublish.php new file mode 100644 index 0000000..94a3aee --- /dev/null +++ b/src/Model/VouchersDisableResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class VouchersDisableResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersDisableResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersDisableResponseBodyRedemption.php b/src/Model/VouchersDisableResponseBodyRedemption.php new file mode 100644 index 0000000..2c329aa --- /dev/null +++ b/src/Model/VouchersDisableResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class VouchersDisableResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersDisableResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersEnableResponseBody.php b/src/Model/VouchersEnableResponseBody.php new file mode 100644 index 0000000..07268d6 --- /dev/null +++ b/src/Model/VouchersEnableResponseBody.php @@ -0,0 +1,1601 @@ + + */ +class VouchersEnableResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersEnableResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\VouchersEnableResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\VouchersEnableResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\VouchersEnableResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\VouchersEnableResponseBodyRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\VouchersEnableResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\VouchersEnableResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\VouchersEnableResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\VouchersEnableResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\VouchersEnableResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\VouchersEnableResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VouchersEnableResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VouchersEnableResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + 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/VouchersEnableResponseBodyGift.php b/src/Model/VouchersEnableResponseBodyGift.php new file mode 100644 index 0000000..6a14d46 --- /dev/null +++ b/src/Model/VouchersEnableResponseBodyGift.php @@ -0,0 +1,534 @@ + + */ +class VouchersEnableResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersEnableResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/VouchersEnableResponseBodyLoyaltyCard.php b/src/Model/VouchersEnableResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..613b2c6 --- /dev/null +++ b/src/Model/VouchersEnableResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class VouchersEnableResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersEnableResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/VouchersEnableResponseBodyPublish.php b/src/Model/VouchersEnableResponseBodyPublish.php new file mode 100644 index 0000000..8a7bae6 --- /dev/null +++ b/src/Model/VouchersEnableResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class VouchersEnableResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersEnableResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersEnableResponseBodyRedemption.php b/src/Model/VouchersEnableResponseBodyRedemption.php new file mode 100644 index 0000000..89a0af7 --- /dev/null +++ b/src/Model/VouchersEnableResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class VouchersEnableResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersEnableResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersGetResponseBody.php b/src/Model/VouchersGetResponseBody.php new file mode 100644 index 0000000..163d449 --- /dev/null +++ b/src/Model/VouchersGetResponseBody.php @@ -0,0 +1,1601 @@ + + */ +class VouchersGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\VouchersGetResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\VouchersGetResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\VouchersGetResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\VouchersGetResponseBodyRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\VouchersGetResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\VouchersGetResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\VouchersGetResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\VouchersGetResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\VouchersGetResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\VouchersGetResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VouchersGetResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VouchersGetResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + 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/VouchersGetResponseBodyGift.php b/src/Model/VouchersGetResponseBodyGift.php new file mode 100644 index 0000000..eef6f56 --- /dev/null +++ b/src/Model/VouchersGetResponseBodyGift.php @@ -0,0 +1,534 @@ + + */ +class VouchersGetResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersGetResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/VouchersGetResponseBodyLoyaltyCard.php b/src/Model/VouchersGetResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..8a5fc73 --- /dev/null +++ b/src/Model/VouchersGetResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class VouchersGetResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersGetResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/VouchersGetResponseBodyPublish.php b/src/Model/VouchersGetResponseBodyPublish.php new file mode 100644 index 0000000..f2365db --- /dev/null +++ b/src/Model/VouchersGetResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class VouchersGetResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersGetResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersGetResponseBodyRedemption.php b/src/Model/VouchersGetResponseBodyRedemption.php new file mode 100644 index 0000000..d1f4f44 --- /dev/null +++ b/src/Model/VouchersGetResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class VouchersGetResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersGetResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersImportCreateItemRequestBody.php b/src/Model/VouchersImportCreateItemRequestBody.php new file mode 100644 index 0000000..0842d9f --- /dev/null +++ b/src/Model/VouchersImportCreateItemRequestBody.php @@ -0,0 +1,956 @@ + + */ +class VouchersImportCreateItemRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersImportCreateItemRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'redemption' => '\OpenAPI\Client\Model\VouchersImportCreateItemRequestBodyRedemption', + 'active' => 'bool', + 'metadata' => 'object', + 'category' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'additionalInfo' => 'string', + 'type' => 'string', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'redemption' => null, + 'active' => null, + 'metadata' => null, + 'category' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'additionalInfo' => null, + 'type' => null, + 'gift' => null, + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'redemption' => true, + 'active' => true, + 'metadata' => true, + 'category' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'additionalInfo' => true, + 'type' => true, + 'gift' => false, + 'discount' => 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 = [ + 'code' => 'code', + 'redemption' => 'redemption', + 'active' => 'active', + 'metadata' => 'metadata', + 'category' => 'category', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'additionalInfo' => 'additional_info', + 'type' => 'type', + 'gift' => 'gift', + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'redemption' => 'setRedemption', + 'active' => 'setActive', + 'metadata' => 'setMetadata', + 'category' => 'setCategory', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'additionalInfo' => 'setAdditionalInfo', + 'type' => 'setType', + 'gift' => 'setGift', + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'redemption' => 'getRedemption', + 'active' => 'getActive', + 'metadata' => 'getMetadata', + 'category' => 'getCategory', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'additionalInfo' => 'getAdditionalInfo', + 'type' => 'getType', + 'gift' => 'getGift', + 'discount' => 'getDiscount' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + ]; + } + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('discount', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Value representing the imported code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VouchersImportCreateItemRequestBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VouchersImportCreateItemRequestBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/VouchersImportCreateItemRequestBodyRedemption.php b/src/Model/VouchersImportCreateItemRequestBodyRedemption.php new file mode 100644 index 0000000..a82009b --- /dev/null +++ b/src/Model/VouchersImportCreateItemRequestBodyRedemption.php @@ -0,0 +1,417 @@ + + */ +class VouchersImportCreateItemRequestBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersImportCreateItemRequestBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity' + ]; + + /** + * 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('quantity', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + 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/VouchersImportCreateResponseBody.php b/src/Model/VouchersImportCreateResponseBody.php new file mode 100644 index 0000000..ab71789 --- /dev/null +++ b/src/Model/VouchersImportCreateResponseBody.php @@ -0,0 +1,418 @@ + + */ +class VouchersImportCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersImportCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/VouchersImportCsvCreateResponseBody.php b/src/Model/VouchersImportCsvCreateResponseBody.php new file mode 100644 index 0000000..f5b115e --- /dev/null +++ b/src/Model/VouchersImportCsvCreateResponseBody.php @@ -0,0 +1,418 @@ + + */ +class VouchersImportCsvCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersImportCsvCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/VouchersListResponseBody.php b/src/Model/VouchersListResponseBody.php new file mode 100644 index 0000000..488647b --- /dev/null +++ b/src/Model/VouchersListResponseBody.php @@ -0,0 +1,605 @@ + + */ +class VouchersListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'vouchers' => '\OpenAPI\Client\Model\VoucherWithCategories[]', + 'total' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'vouchers' => null, + 'total' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'vouchers' => true, + 'total' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'vouchers' => 'vouchers', + 'total' => 'total' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'vouchers' => 'setVouchers', + 'total' => 'setTotal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'vouchers' => 'getVouchers', + 'total' => 'getTotal' + ]; + + /** + * 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 OBJECT__LIST = 'list'; + public const DATA_REF_VOUCHERS = 'vouchers'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT__LIST, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataRefAllowableValues() + { + return [ + self::DATA_REF_VOUCHERS, + ]; + } + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'vouchers'); + $this->setIfExists('vouchers', $data ?? [], null); + $this->setIfExists('total', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($this->container['dataRef']) && !in_array($this->container['dataRef'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'dataRef', must be one of '%s'", + $this->container['dataRef'], + 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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of voucher objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getDataRefAllowableValues(); + if (!is_null($dataRef) && !in_array($dataRef, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'dataRef', must be one of '%s'", + $dataRef, + implode("', '", $allowedValues) + ) + ); + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets vouchers + * + * @return \OpenAPI\Client\Model\VoucherWithCategories[]|null + */ + public function getVouchers() + { + return $this->container['vouchers']; + } + + /** + * Sets vouchers + * + * @param \OpenAPI\Client\Model\VoucherWithCategories[]|null $vouchers A dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. + * + * @return self + */ + public function setVouchers($vouchers) + { + if (is_null($vouchers)) { + array_push($this->openAPINullablesSetToNull, 'vouchers'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('vouchers', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['vouchers'] = $vouchers; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Returns how many vouchers in the project meet the limits defined by the query parameter definitions. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + 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/VouchersMetadataUpdateInBulkRequestBody.php b/src/Model/VouchersMetadataUpdateInBulkRequestBody.php new file mode 100644 index 0000000..5f29786 --- /dev/null +++ b/src/Model/VouchersMetadataUpdateInBulkRequestBody.php @@ -0,0 +1,459 @@ + + */ +class VouchersMetadataUpdateInBulkRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersMetadataUpdateInBulkRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'codes' => 'string[]', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'codes' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'codes' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'codes' => 'codes', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'codes' => 'setCodes', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'codes' => 'getCodes', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('codes', $data ?? [], null); + $this->setIfExists('metadata', $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 codes + * + * @return string[]|null + */ + public function getCodes() + { + return $this->container['codes']; + } + + /** + * Sets codes + * + * @param string[]|null $codes An array of voucher codes. + * + * @return self + */ + public function setCodes($codes) + { + if (is_null($codes)) { + array_push($this->openAPINullablesSetToNull, 'codes'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('codes', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['codes'] = $codes; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/VouchersMetadataUpdateInBulkResponseBody.php b/src/Model/VouchersMetadataUpdateInBulkResponseBody.php new file mode 100644 index 0000000..553cb69 --- /dev/null +++ b/src/Model/VouchersMetadataUpdateInBulkResponseBody.php @@ -0,0 +1,418 @@ + + */ +class VouchersMetadataUpdateInBulkResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersMetadataUpdateInBulkResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/VouchersRedemptionGetResponseBody.php b/src/Model/VouchersRedemptionGetResponseBody.php new file mode 100644 index 0000000..73c93ec --- /dev/null +++ b/src/Model/VouchersRedemptionGetResponseBody.php @@ -0,0 +1,660 @@ + + */ +class VouchersRedemptionGetResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersRedemptionGetResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'object' => 'string', + 'url' => 'string', + 'dataRef' => 'string', + 'total' => 'int', + 'redemptionEntries' => '\OpenAPI\Client\Model\RedemptionEntry[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'object' => null, + 'url' => null, + 'dataRef' => null, + 'total' => null, + 'redemptionEntries' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'object' => true, + 'url' => true, + 'dataRef' => true, + 'total' => true, + 'redemptionEntries' => 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'object' => 'object', + 'url' => 'url', + 'dataRef' => 'data_ref', + 'total' => 'total', + 'redemptionEntries' => 'redemption_entries' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'object' => 'setObject', + 'url' => 'setUrl', + 'dataRef' => 'setDataRef', + 'total' => 'setTotal', + 'redemptionEntries' => 'setRedemptionEntries' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'object' => 'getObject', + 'url' => 'getUrl', + 'dataRef' => 'getDataRef', + 'total' => 'getTotal', + 'redemptionEntries' => 'getRedemptionEntries' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('dataRef', $data ?? [], 'redemption_entries'); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('redemptionEntries', $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 = []; + + if ($this->container['redemptionEntries'] === null) { + $invalidProperties[] = "'redemptionEntries' can't be null"; + } + 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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity The maximum number of times a voucher can be redeemed. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity The number of times the voucher was redeemed successfully. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. This object stores information about redemptions in a dictionary. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of `redemption_entries`. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of redemption objects. + * + * @return self + */ + public function setTotal($total) + { + if (is_null($total)) { + array_push($this->openAPINullablesSetToNull, 'total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('total', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets redemptionEntries + * + * @return \OpenAPI\Client\Model\RedemptionEntry[] + */ + public function getRedemptionEntries() + { + return $this->container['redemptionEntries']; + } + + /** + * Sets redemptionEntries + * + * @param \OpenAPI\Client\Model\RedemptionEntry[] $redemptionEntries Contains the array of successful and failed redemption objects. + * + * @return self + */ + public function setRedemptionEntries($redemptionEntries) + { + if (is_null($redemptionEntries)) { + throw new \InvalidArgumentException('non-nullable redemptionEntries cannot be null'); + } + $this->container['redemptionEntries'] = $redemptionEntries; + + 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/VouchersTransactionsExportCreateRequestBody.php b/src/Model/VouchersTransactionsExportCreateRequestBody.php new file mode 100644 index 0000000..d6007b7 --- /dev/null +++ b/src/Model/VouchersTransactionsExportCreateRequestBody.php @@ -0,0 +1,411 @@ + + */ +class VouchersTransactionsExportCreateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersTransactionsExportCreateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'parameters' => '\OpenAPI\Client\Model\VoucherTransactionsExportParameters' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'parameters' => 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 = [ + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'parameters' => 'getParameters' + ]; + + /** + * 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('parameters', $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 parameters + * + * @return \OpenAPI\Client\Model\VoucherTransactionsExportParameters|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\VoucherTransactionsExportParameters|null $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + 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/VouchersTransactionsExportCreateResponseBody.php b/src/Model/VouchersTransactionsExportCreateResponseBody.php new file mode 100644 index 0000000..87cc9ad --- /dev/null +++ b/src/Model/VouchersTransactionsExportCreateResponseBody.php @@ -0,0 +1,838 @@ + + */ +class VouchersTransactionsExportCreateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersTransactionsExportCreateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'object' => 'string', + 'createdAt' => '\DateTime', + 'status' => 'string', + 'channel' => 'string', + 'exportedObject' => 'string', + 'parameters' => '\OpenAPI\Client\Model\VoucherTransactionsFilters', + 'result' => '\OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBodyResult', + 'userId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'object' => null, + 'createdAt' => 'date-time', + 'status' => null, + 'channel' => null, + 'exportedObject' => null, + 'parameters' => null, + 'result' => null, + 'userId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'object' => true, + 'createdAt' => true, + 'status' => true, + 'channel' => true, + 'exportedObject' => true, + 'parameters' => false, + 'result' => true, + 'userId' => true + ]; + + /** + * 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 = [ + 'id' => 'id', + 'object' => 'object', + 'createdAt' => 'created_at', + 'status' => 'status', + 'channel' => 'channel', + 'exportedObject' => 'exported_object', + 'parameters' => 'parameters', + 'result' => 'result', + 'userId' => 'user_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'object' => 'setObject', + 'createdAt' => 'setCreatedAt', + 'status' => 'setStatus', + 'channel' => 'setChannel', + 'exportedObject' => 'setExportedObject', + 'parameters' => 'setParameters', + 'result' => 'setResult', + 'userId' => 'setUserId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'object' => 'getObject', + 'createdAt' => 'getCreatedAt', + 'status' => 'getStatus', + 'channel' => 'getChannel', + 'exportedObject' => 'getExportedObject', + 'parameters' => 'getParameters', + 'result' => 'getResult', + 'userId' => 'getUserId' + ]; + + /** + * 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 OBJECT_EXPORT = 'export'; + public const STATUS_SCHEDULED = 'SCHEDULED'; + public const EXPORTED_OBJECT_VOUCHER_TRANSACTIONS = 'voucher_transactions'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getObjectAllowableValues() + { + return [ + self::OBJECT_EXPORT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_SCHEDULED, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExportedObjectAllowableValues() + { + return [ + self::EXPORTED_OBJECT_VOUCHER_TRANSACTIONS, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'export'); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('status', $data ?? [], 'SCHEDULED'); + $this->setIfExists('channel', $data ?? [], 'API'); + $this->setIfExists('exportedObject', $data ?? [], 'voucher_transactions'); + $this->setIfExists('parameters', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + $this->setIfExists('userId', $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->getObjectAllowableValues(); + if (!is_null($this->container['object']) && !in_array($this->container['object'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'object', must be one of '%s'", + $this->container['object'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($this->container['exportedObject']) && !in_array($this->container['exportedObject'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exportedObject', must be one of '%s'", + $this->container['exportedObject'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['parameters'] === null) { + $invalidProperties[] = "'parameters' can't be null"; + } + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Unique export ID. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of object being represented. This object stores information about the `export`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getObjectAllowableValues(); + if (!is_null($object) && !in_array($object, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'object', must be one of '%s'", + $object, + implode("', '", $allowedValues) + ) + ); + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the export was scheduled in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel through which the export was triggered. + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + array_push($this->openAPINullablesSetToNull, 'channel'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('channel', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets exportedObject + * + * @return string|null + */ + public function getExportedObject() + { + return $this->container['exportedObject']; + } + + /** + * Sets exportedObject + * + * @param string|null $exportedObject The type of exported object. + * + * @return self + */ + public function setExportedObject($exportedObject) + { + if (is_null($exportedObject)) { + array_push($this->openAPINullablesSetToNull, 'exportedObject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('exportedObject', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getExportedObjectAllowableValues(); + if (!is_null($exportedObject) && !in_array($exportedObject, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exportedObject', must be one of '%s'", + $exportedObject, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exportedObject'] = $exportedObject; + + return $this; + } + + /** + * Gets parameters + * + * @return \OpenAPI\Client\Model\VoucherTransactionsFilters + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \OpenAPI\Client\Model\VoucherTransactionsFilters $parameters parameters + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + return $this; + } + + /** + * Gets result + * + * @return \OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBodyResult|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \OpenAPI\Client\Model\VouchersTransactionsExportCreateResponseBodyResult|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + array_push($this->openAPINullablesSetToNull, 'result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['result'] = $result; + + return $this; + } + + /** + * Gets userId + * + * @return string|null + */ + public function getUserId() + { + return $this->container['userId']; + } + + /** + * Sets userId + * + * @param string|null $userId Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`. + * + * @return self + */ + public function setUserId($userId) + { + if (is_null($userId)) { + array_push($this->openAPINullablesSetToNull, 'userId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('userId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['userId'] = $userId; + + 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/VouchersTransactionsExportCreateResponseBodyResult.php b/src/Model/VouchersTransactionsExportCreateResponseBodyResult.php new file mode 100644 index 0000000..4e8dd7a --- /dev/null +++ b/src/Model/VouchersTransactionsExportCreateResponseBodyResult.php @@ -0,0 +1,418 @@ + + */ +class VouchersTransactionsExportCreateResponseBodyResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersTransactionsExportCreateResponseBodyResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'url' => true + ]; + + /** + * 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 = [ + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'url' => 'getUrl' + ]; + + /** + * 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('url', $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 url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersTransactionsListResponseBody.php b/src/Model/VouchersTransactionsListResponseBody.php new file mode 100644 index 0000000..e9f1332 --- /dev/null +++ b/src/Model/VouchersTransactionsListResponseBody.php @@ -0,0 +1,541 @@ + + */ +class VouchersTransactionsListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersTransactionsListResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'dataRef' => 'string', + 'data' => '\OpenAPI\Client\Model\VoucherTransaction[]', + 'hasMore' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'dataRef' => null, + 'data' => null, + 'hasMore' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'dataRef' => true, + 'data' => true, + 'hasMore' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'dataRef' => 'data_ref', + 'data' => 'data', + 'hasMore' => 'has_more' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'dataRef' => 'setDataRef', + 'data' => 'setData', + 'hasMore' => 'setHasMore' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'dataRef' => 'getDataRef', + 'data' => 'getData', + 'hasMore' => 'getHasMore' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('dataRef', $data ?? [], 'data'); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('hasMore', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets dataRef + * + * @return string|null + */ + public function getDataRef() + { + return $this->container['dataRef']; + } + + /** + * Sets dataRef + * + * @param string|null $dataRef Identifies the name of the attribute that contains the array of transaction objects. + * + * @return self + */ + public function setDataRef($dataRef) + { + if (is_null($dataRef)) { + array_push($this->openAPINullablesSetToNull, 'dataRef'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('dataRef', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['dataRef'] = $dataRef; + + return $this; + } + + /** + * Gets data + * + * @return \OpenAPI\Client\Model\VoucherTransaction[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \OpenAPI\Client\Model\VoucherTransaction[]|null $data A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets hasMore + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['hasMore']; + } + + /** + * Sets hasMore + * + * @param bool|null $hasMore As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different page or a different start date filter) to get more records returned in the results. + * + * @return self + */ + public function setHasMore($hasMore) + { + if (is_null($hasMore)) { + array_push($this->openAPINullablesSetToNull, 'hasMore'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('hasMore', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['hasMore'] = $hasMore; + + 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/VouchersUpdateInBulkItemRequestBody.php b/src/Model/VouchersUpdateInBulkItemRequestBody.php new file mode 100644 index 0000000..900d904 --- /dev/null +++ b/src/Model/VouchersUpdateInBulkItemRequestBody.php @@ -0,0 +1,458 @@ + + */ +class VouchersUpdateInBulkItemRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersUpdateInBulkItemRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => true, + 'metadata' => true + ]; + + /** + * 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 = [ + 'code' => 'code', + 'metadata' => 'metadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'metadata' => 'setMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'metadata' => 'getMetadata' + ]; + + /** + * 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('code', $data ?? [], null); + $this->setIfExists('metadata', $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 code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Unique voucher code. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + 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/VouchersUpdateInBulkResponseBody.php b/src/Model/VouchersUpdateInBulkResponseBody.php new file mode 100644 index 0000000..8623fbf --- /dev/null +++ b/src/Model/VouchersUpdateInBulkResponseBody.php @@ -0,0 +1,418 @@ + + */ +class VouchersUpdateInBulkResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersUpdateInBulkResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asyncActionId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asyncActionId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asyncActionId' => true + ]; + + /** + * 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 = [ + 'asyncActionId' => 'async_action_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asyncActionId' => 'setAsyncActionId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asyncActionId' => 'getAsyncActionId' + ]; + + /** + * 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('asyncActionId', $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 asyncActionId + * + * @return string|null + */ + public function getAsyncActionId() + { + return $this->container['asyncActionId']; + } + + /** + * Sets asyncActionId + * + * @param string|null $asyncActionId The ID of the scheduled asynchronous action. + * + * @return self + */ + public function setAsyncActionId($asyncActionId) + { + if (is_null($asyncActionId)) { + array_push($this->openAPINullablesSetToNull, 'asyncActionId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('asyncActionId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['asyncActionId'] = $asyncActionId; + + 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/VouchersUpdateRequestBody.php b/src/Model/VouchersUpdateRequestBody.php new file mode 100644 index 0000000..fa47bba --- /dev/null +++ b/src/Model/VouchersUpdateRequestBody.php @@ -0,0 +1,985 @@ + + */ +class VouchersUpdateRequestBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersUpdateRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => 'string', + 'categoryId' => 'string', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'type' => 'string', + 'loyaltyCard' => '\OpenAPI\Client\Model\SimpleLoyaltyCard', + 'gift' => '\OpenAPI\Client\Model\Gift', + 'discount' => '\OpenAPI\Client\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'categoryId' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'type' => null, + 'loyaltyCard' => null, + 'gift' => null, + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'category' => true, + 'categoryId' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'type' => true, + 'loyaltyCard' => false, + 'gift' => false, + 'discount' => 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 = [ + 'category' => 'category', + 'categoryId' => 'category_id', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'type' => 'type', + 'loyaltyCard' => 'loyalty_card', + 'gift' => 'gift', + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'type' => 'setType', + 'loyaltyCard' => 'setLoyaltyCard', + 'gift' => 'setGift', + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'type' => 'getType', + 'loyaltyCard' => 'getLoyaltyCard', + 'gift' => 'getGift', + 'discount' => 'getDiscount' + ]; + + /** + * 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 VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_LOYALTY_CARD, + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + ]; + } + + /** + * 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('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('discount', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\SimpleLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\SimpleLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + throw new \InvalidArgumentException('non-nullable loyaltyCard cannot be null'); + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\Gift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\Gift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + throw new \InvalidArgumentException('non-nullable gift cannot be null'); + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/VouchersUpdateResponseBody.php b/src/Model/VouchersUpdateResponseBody.php new file mode 100644 index 0000000..8569165 --- /dev/null +++ b/src/Model/VouchersUpdateResponseBody.php @@ -0,0 +1,1601 @@ + + */ +class VouchersUpdateResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersUpdateResponseBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'code' => 'string', + 'campaign' => 'string', + 'campaignId' => 'string', + 'category' => 'string', + 'categoryId' => 'string', + 'type' => 'string', + 'discount' => '\OpenAPI\Client\Model\Discount', + 'gift' => '\OpenAPI\Client\Model\VouchersUpdateResponseBodyGift', + 'loyaltyCard' => '\OpenAPI\Client\Model\VouchersUpdateResponseBodyLoyaltyCard', + 'startDate' => '\DateTime', + 'expirationDate' => '\DateTime', + 'validityTimeframe' => '\OpenAPI\Client\Model\ValidityTimeframe', + 'validityDayOfWeek' => 'int[]', + 'validityHours' => '\OpenAPI\Client\Model\ValidityHours', + 'active' => 'bool', + 'additionalInfo' => 'string', + 'metadata' => 'object', + 'assets' => '\OpenAPI\Client\Model\VoucherAssets', + 'isReferralCode' => 'bool', + 'createdAt' => '\DateTime', + 'updatedAt' => '\DateTime', + 'holderId' => 'string', + 'referrerId' => 'string', + 'object' => 'string', + 'publish' => '\OpenAPI\Client\Model\VouchersUpdateResponseBodyPublish', + 'redemption' => '\OpenAPI\Client\Model\VouchersUpdateResponseBodyRedemption', + 'categories' => '\OpenAPI\Client\Model\Category[]', + 'validationRulesAssignments' => '\OpenAPI\Client\Model\ValidationRulesAssignmentsList' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'code' => null, + 'campaign' => null, + 'campaignId' => null, + 'category' => null, + 'categoryId' => null, + 'type' => null, + 'discount' => null, + 'gift' => null, + 'loyaltyCard' => null, + 'startDate' => 'date-time', + 'expirationDate' => 'date-time', + 'validityTimeframe' => null, + 'validityDayOfWeek' => null, + 'validityHours' => null, + 'active' => null, + 'additionalInfo' => null, + 'metadata' => null, + 'assets' => null, + 'isReferralCode' => null, + 'createdAt' => 'date-time', + 'updatedAt' => 'date-time', + 'holderId' => null, + 'referrerId' => null, + 'object' => null, + 'publish' => null, + 'redemption' => null, + 'categories' => null, + 'validationRulesAssignments' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'code' => true, + 'campaign' => true, + 'campaignId' => true, + 'category' => true, + 'categoryId' => true, + 'type' => true, + 'discount' => false, + 'gift' => true, + 'loyaltyCard' => true, + 'startDate' => true, + 'expirationDate' => true, + 'validityTimeframe' => false, + 'validityDayOfWeek' => true, + 'validityHours' => false, + 'active' => true, + 'additionalInfo' => true, + 'metadata' => true, + 'assets' => false, + 'isReferralCode' => true, + 'createdAt' => true, + 'updatedAt' => true, + 'holderId' => true, + 'referrerId' => true, + 'object' => true, + 'publish' => true, + 'redemption' => true, + 'categories' => true, + 'validationRulesAssignments' => 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 = [ + 'id' => 'id', + 'code' => 'code', + 'campaign' => 'campaign', + 'campaignId' => 'campaign_id', + 'category' => 'category', + 'categoryId' => 'category_id', + 'type' => 'type', + 'discount' => 'discount', + 'gift' => 'gift', + 'loyaltyCard' => 'loyalty_card', + 'startDate' => 'start_date', + 'expirationDate' => 'expiration_date', + 'validityTimeframe' => 'validity_timeframe', + 'validityDayOfWeek' => 'validity_day_of_week', + 'validityHours' => 'validity_hours', + 'active' => 'active', + 'additionalInfo' => 'additional_info', + 'metadata' => 'metadata', + 'assets' => 'assets', + 'isReferralCode' => 'is_referral_code', + 'createdAt' => 'created_at', + 'updatedAt' => 'updated_at', + 'holderId' => 'holder_id', + 'referrerId' => 'referrer_id', + 'object' => 'object', + 'publish' => 'publish', + 'redemption' => 'redemption', + 'categories' => 'categories', + 'validationRulesAssignments' => 'validation_rules_assignments' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'code' => 'setCode', + 'campaign' => 'setCampaign', + 'campaignId' => 'setCampaignId', + 'category' => 'setCategory', + 'categoryId' => 'setCategoryId', + 'type' => 'setType', + 'discount' => 'setDiscount', + 'gift' => 'setGift', + 'loyaltyCard' => 'setLoyaltyCard', + 'startDate' => 'setStartDate', + 'expirationDate' => 'setExpirationDate', + 'validityTimeframe' => 'setValidityTimeframe', + 'validityDayOfWeek' => 'setValidityDayOfWeek', + 'validityHours' => 'setValidityHours', + 'active' => 'setActive', + 'additionalInfo' => 'setAdditionalInfo', + 'metadata' => 'setMetadata', + 'assets' => 'setAssets', + 'isReferralCode' => 'setIsReferralCode', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'holderId' => 'setHolderId', + 'referrerId' => 'setReferrerId', + 'object' => 'setObject', + 'publish' => 'setPublish', + 'redemption' => 'setRedemption', + 'categories' => 'setCategories', + 'validationRulesAssignments' => 'setValidationRulesAssignments' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'code' => 'getCode', + 'campaign' => 'getCampaign', + 'campaignId' => 'getCampaignId', + 'category' => 'getCategory', + 'categoryId' => 'getCategoryId', + 'type' => 'getType', + 'discount' => 'getDiscount', + 'gift' => 'getGift', + 'loyaltyCard' => 'getLoyaltyCard', + 'startDate' => 'getStartDate', + 'expirationDate' => 'getExpirationDate', + 'validityTimeframe' => 'getValidityTimeframe', + 'validityDayOfWeek' => 'getValidityDayOfWeek', + 'validityHours' => 'getValidityHours', + 'active' => 'getActive', + 'additionalInfo' => 'getAdditionalInfo', + 'metadata' => 'getMetadata', + 'assets' => 'getAssets', + 'isReferralCode' => 'getIsReferralCode', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'holderId' => 'getHolderId', + 'referrerId' => 'getReferrerId', + 'object' => 'getObject', + 'publish' => 'getPublish', + 'redemption' => 'getRedemption', + 'categories' => 'getCategories', + 'validationRulesAssignments' => 'getValidationRulesAssignments' + ]; + + /** + * 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 TYPE_GIFT_VOUCHER = 'GIFT_VOUCHER'; + public const TYPE_DISCOUNT_VOUCHER = 'DISCOUNT_VOUCHER'; + public const TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const VALIDITY_DAY_OF_WEEK_0 = 0; + public const VALIDITY_DAY_OF_WEEK_1 = 1; + public const VALIDITY_DAY_OF_WEEK_2 = 2; + public const VALIDITY_DAY_OF_WEEK_3 = 3; + public const VALIDITY_DAY_OF_WEEK_4 = 4; + public const VALIDITY_DAY_OF_WEEK_5 = 5; + public const VALIDITY_DAY_OF_WEEK_6 = 6; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_GIFT_VOUCHER, + self::TYPE_DISCOUNT_VOUCHER, + self::TYPE_LOYALTY_CARD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getValidityDayOfWeekAllowableValues() + { + return [ + self::VALIDITY_DAY_OF_WEEK_0, + self::VALIDITY_DAY_OF_WEEK_1, + self::VALIDITY_DAY_OF_WEEK_2, + self::VALIDITY_DAY_OF_WEEK_3, + self::VALIDITY_DAY_OF_WEEK_4, + self::VALIDITY_DAY_OF_WEEK_5, + self::VALIDITY_DAY_OF_WEEK_6, + ]; + } + + /** + * 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('id', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('campaign', $data ?? [], null); + $this->setIfExists('campaignId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('categoryId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('gift', $data ?? [], null); + $this->setIfExists('loyaltyCard', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('validityTimeframe', $data ?? [], null); + $this->setIfExists('validityDayOfWeek', $data ?? [], null); + $this->setIfExists('validityHours', $data ?? [], null); + $this->setIfExists('active', $data ?? [], null); + $this->setIfExists('additionalInfo', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('assets', $data ?? [], null); + $this->setIfExists('isReferralCode', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('holderId', $data ?? [], null); + $this->setIfExists('referrerId', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'voucher'); + $this->setIfExists('publish', $data ?? [], null); + $this->setIfExists('redemption', $data ?? [], null); + $this->setIfExists('categories', $data ?? [], null); + $this->setIfExists('validationRulesAssignments', $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->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Assigned by the Voucherify API, identifies the voucher. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + array_push($this->openAPINullablesSetToNull, 'code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets campaign + * + * @return string|null + */ + public function getCampaign() + { + return $this->container['campaign']; + } + + /** + * Sets campaign + * + * @param string|null $campaign A unique campaign name, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaign($campaign) + { + if (is_null($campaign)) { + array_push($this->openAPINullablesSetToNull, 'campaign'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign'] = $campaign; + + return $this; + } + + /** + * Gets campaignId + * + * @return string|null + */ + public function getCampaignId() + { + return $this->container['campaignId']; + } + + /** + * Sets campaignId + * + * @param string|null $campaignId Assigned by the Voucherify API, identifies the voucher's parent campaign. + * + * @return self + */ + public function setCampaignId($campaignId) + { + if (is_null($campaignId)) { + array_push($this->openAPINullablesSetToNull, 'campaignId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaignId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaignId'] = $campaignId; + + return $this; + } + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + array_push($this->openAPINullablesSetToNull, 'category'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('category', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets categoryId + * + * @return string|null + */ + public function getCategoryId() + { + return $this->container['categoryId']; + } + + /** + * Sets categoryId + * + * @param string|null $categoryId Unique category ID assigned by Voucherify. + * + * @return self + */ + public function setCategoryId($categoryId) + { + if (is_null($categoryId)) { + array_push($this->openAPINullablesSetToNull, 'categoryId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categoryId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categoryId'] = $categoryId; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Defines the type of the voucher. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets discount + * + * @return \OpenAPI\Client\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \OpenAPI\Client\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets gift + * + * @return \OpenAPI\Client\Model\VouchersUpdateResponseBodyGift|null + */ + public function getGift() + { + return $this->container['gift']; + } + + /** + * Sets gift + * + * @param \OpenAPI\Client\Model\VouchersUpdateResponseBodyGift|null $gift gift + * + * @return self + */ + public function setGift($gift) + { + if (is_null($gift)) { + array_push($this->openAPINullablesSetToNull, 'gift'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('gift', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['gift'] = $gift; + + return $this; + } + + /** + * Gets loyaltyCard + * + * @return \OpenAPI\Client\Model\VouchersUpdateResponseBodyLoyaltyCard|null + */ + public function getLoyaltyCard() + { + return $this->container['loyaltyCard']; + } + + /** + * Sets loyaltyCard + * + * @param \OpenAPI\Client\Model\VouchersUpdateResponseBodyLoyaltyCard|null $loyaltyCard loyaltyCard + * + * @return self + */ + public function setLoyaltyCard($loyaltyCard) + { + if (is_null($loyaltyCard)) { + array_push($this->openAPINullablesSetToNull, 'loyaltyCard'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('loyaltyCard', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['loyaltyCard'] = $loyaltyCard; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime|null $startDate Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + array_push($this->openAPINullablesSetToNull, 'startDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('startDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + array_push($this->openAPINullablesSetToNull, 'expirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets validityTimeframe + * + * @return \OpenAPI\Client\Model\ValidityTimeframe|null + */ + public function getValidityTimeframe() + { + return $this->container['validityTimeframe']; + } + + /** + * Sets validityTimeframe + * + * @param \OpenAPI\Client\Model\ValidityTimeframe|null $validityTimeframe validityTimeframe + * + * @return self + */ + public function setValidityTimeframe($validityTimeframe) + { + if (is_null($validityTimeframe)) { + throw new \InvalidArgumentException('non-nullable validityTimeframe cannot be null'); + } + $this->container['validityTimeframe'] = $validityTimeframe; + + return $this; + } + + /** + * Gets validityDayOfWeek + * + * @return int[]|null + */ + public function getValidityDayOfWeek() + { + return $this->container['validityDayOfWeek']; + } + + /** + * Sets validityDayOfWeek + * + * @param int[]|null $validityDayOfWeek Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday + * + * @return self + */ + public function setValidityDayOfWeek($validityDayOfWeek) + { + if (is_null($validityDayOfWeek)) { + array_push($this->openAPINullablesSetToNull, 'validityDayOfWeek'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validityDayOfWeek', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getValidityDayOfWeekAllowableValues(); + if (!is_null($validityDayOfWeek) && array_diff($validityDayOfWeek, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'validityDayOfWeek', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['validityDayOfWeek'] = $validityDayOfWeek; + + return $this; + } + + /** + * Gets validityHours + * + * @return \OpenAPI\Client\Model\ValidityHours|null + */ + public function getValidityHours() + { + return $this->container['validityHours']; + } + + /** + * Sets validityHours + * + * @param \OpenAPI\Client\Model\ValidityHours|null $validityHours validityHours + * + * @return self + */ + public function setValidityHours($validityHours) + { + if (is_null($validityHours)) { + throw new \InvalidArgumentException('non-nullable validityHours cannot be null'); + } + $this->container['validityHours'] = $validityHours; + + return $this; + } + + /** + * Gets active + * + * @return bool|null + */ + public function getActive() + { + return $this->container['active']; + } + + /** + * Sets active + * + * @param bool|null $active A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher + * + * @return self + */ + public function setActive($active) + { + if (is_null($active)) { + array_push($this->openAPINullablesSetToNull, 'active'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active'] = $active; + + return $this; + } + + /** + * Gets additionalInfo + * + * @return string|null + */ + public function getAdditionalInfo() + { + return $this->container['additionalInfo']; + } + + /** + * Sets additionalInfo + * + * @param string|null $additionalInfo An optional field to keep any extra textual information about the code such as a code description and details. + * + * @return self + */ + public function setAdditionalInfo($additionalInfo) + { + if (is_null($additionalInfo)) { + array_push($this->openAPINullablesSetToNull, 'additionalInfo'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additionalInfo', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additionalInfo'] = $additionalInfo; + + return $this; + } + + /** + * Gets metadata + * + * @return object|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param object|null $metadata The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. + * + * @return self + */ + public function setMetadata($metadata) + { + if (is_null($metadata)) { + array_push($this->openAPINullablesSetToNull, 'metadata'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('metadata', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['metadata'] = $metadata; + + return $this; + } + + /** + * Gets assets + * + * @return \OpenAPI\Client\Model\VoucherAssets|null + */ + public function getAssets() + { + return $this->container['assets']; + } + + /** + * Sets assets + * + * @param \OpenAPI\Client\Model\VoucherAssets|null $assets assets + * + * @return self + */ + public function setAssets($assets) + { + if (is_null($assets)) { + throw new \InvalidArgumentException('non-nullable assets cannot be null'); + } + $this->container['assets'] = $assets; + + return $this; + } + + /** + * Gets isReferralCode + * + * @return bool|null + */ + public function getIsReferralCode() + { + return $this->container['isReferralCode']; + } + + /** + * Sets isReferralCode + * + * @param bool|null $isReferralCode Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. + * + * @return self + */ + public function setIsReferralCode($isReferralCode) + { + if (is_null($isReferralCode)) { + array_push($this->openAPINullablesSetToNull, 'isReferralCode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isReferralCode', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['isReferralCode'] = $isReferralCode; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + array_push($this->openAPINullablesSetToNull, 'createdAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + array_push($this->openAPINullablesSetToNull, 'updatedAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('updatedAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets holderId + * + * @return string|null + */ + public function getHolderId() + { + return $this->container['holderId']; + } + + /** + * Sets holderId + * + * @param string|null $holderId Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. + * + * @return self + */ + public function setHolderId($holderId) + { + if (is_null($holderId)) { + array_push($this->openAPINullablesSetToNull, 'holderId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('holderId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['holderId'] = $holderId; + + return $this; + } + + /** + * Gets referrerId + * + * @return string|null + */ + public function getReferrerId() + { + return $this->container['referrerId']; + } + + /** + * Sets referrerId + * + * @param string|null $referrerId Unique identifier of the referring person. + * + * @return self + */ + public function setReferrerId($referrerId) + { + if (is_null($referrerId)) { + array_push($this->openAPINullablesSetToNull, 'referrerId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('referrerId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['referrerId'] = $referrerId; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented by JSON. Default is `voucher`. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets publish + * + * @return \OpenAPI\Client\Model\VouchersUpdateResponseBodyPublish|null + */ + public function getPublish() + { + return $this->container['publish']; + } + + /** + * Sets publish + * + * @param \OpenAPI\Client\Model\VouchersUpdateResponseBodyPublish|null $publish publish + * + * @return self + */ + public function setPublish($publish) + { + if (is_null($publish)) { + array_push($this->openAPINullablesSetToNull, 'publish'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('publish', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['publish'] = $publish; + + return $this; + } + + /** + * Gets redemption + * + * @return \OpenAPI\Client\Model\VouchersUpdateResponseBodyRedemption|null + */ + public function getRedemption() + { + return $this->container['redemption']; + } + + /** + * Sets redemption + * + * @param \OpenAPI\Client\Model\VouchersUpdateResponseBodyRedemption|null $redemption redemption + * + * @return self + */ + public function setRedemption($redemption) + { + if (is_null($redemption)) { + array_push($this->openAPINullablesSetToNull, 'redemption'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redemption', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redemption'] = $redemption; + + return $this; + } + + /** + * Gets categories + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getCategories() + { + return $this->container['categories']; + } + + /** + * Sets categories + * + * @param \OpenAPI\Client\Model\Category[]|null $categories Contains details about the category. + * + * @return self + */ + public function setCategories($categories) + { + if (is_null($categories)) { + array_push($this->openAPINullablesSetToNull, 'categories'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('categories', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['categories'] = $categories; + + return $this; + } + + /** + * Gets validationRulesAssignments + * + * @return \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null + */ + public function getValidationRulesAssignments() + { + return $this->container['validationRulesAssignments']; + } + + /** + * Sets validationRulesAssignments + * + * @param \OpenAPI\Client\Model\ValidationRulesAssignmentsList|null $validationRulesAssignments validationRulesAssignments + * + * @return self + */ + public function setValidationRulesAssignments($validationRulesAssignments) + { + if (is_null($validationRulesAssignments)) { + throw new \InvalidArgumentException('non-nullable validationRulesAssignments cannot be null'); + } + $this->container['validationRulesAssignments'] = $validationRulesAssignments; + + 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/VouchersUpdateResponseBodyGift.php b/src/Model/VouchersUpdateResponseBodyGift.php new file mode 100644 index 0000000..1697f5e --- /dev/null +++ b/src/Model/VouchersUpdateResponseBodyGift.php @@ -0,0 +1,534 @@ + + */ +class VouchersUpdateResponseBodyGift implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersUpdateResponseBodyGift'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'amount' => 'int', + 'balance' => 'int', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'amount' => null, + 'balance' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'amount' => true, + 'balance' => true, + 'effect' => true + ]; + + /** + * 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 = [ + 'amount' => 'amount', + 'balance' => 'balance', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'amount' => 'setAmount', + 'balance' => 'setBalance', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'amount' => 'getAmount', + 'balance' => 'getBalance', + 'effect' => 'getEffect' + ]; + + /** + * 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 EFFECT_ORDER = 'APPLY_TO_ORDER'; + public const EFFECT_ITEMS = 'APPLY_TO_ITEMS'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_ORDER, + self::EFFECT_ITEMS, + ]; + } + + /** + * 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('amount', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('effect', $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->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + 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 amount + * + * @return int|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param int|null $amount Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + array_push($this->openAPINullablesSetToNull, 'amount'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('amount', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect Defines how the credits are applied to the customer's order. + * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + array_push($this->openAPINullablesSetToNull, 'effect'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('effect', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($effect) && !in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + 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/VouchersUpdateResponseBodyLoyaltyCard.php b/src/Model/VouchersUpdateResponseBodyLoyaltyCard.php new file mode 100644 index 0000000..31bb6dd --- /dev/null +++ b/src/Model/VouchersUpdateResponseBodyLoyaltyCard.php @@ -0,0 +1,541 @@ + + */ +class VouchersUpdateResponseBodyLoyaltyCard implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersUpdateResponseBodyLoyaltyCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'points' => 'int', + 'balance' => 'int', + 'nextExpirationDate' => '\DateTime', + 'nextExpirationPoints' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'points' => null, + 'balance' => null, + 'nextExpirationDate' => 'date', + 'nextExpirationPoints' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'points' => true, + 'balance' => true, + 'nextExpirationDate' => true, + 'nextExpirationPoints' => true + ]; + + /** + * 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 = [ + 'points' => 'points', + 'balance' => 'balance', + 'nextExpirationDate' => 'next_expiration_date', + 'nextExpirationPoints' => 'next_expiration_points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints', + 'balance' => 'setBalance', + 'nextExpirationDate' => 'setNextExpirationDate', + 'nextExpirationPoints' => 'setNextExpirationPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints', + 'balance' => 'getBalance', + 'nextExpirationDate' => 'getNextExpirationDate', + 'nextExpirationPoints' => 'getNextExpirationPoints' + ]; + + /** + * 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('points', $data ?? [], null); + $this->setIfExists('balance', $data ?? [], null); + $this->setIfExists('nextExpirationDate', $data ?? [], null); + $this->setIfExists('nextExpirationPoints', $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 points + * + * @return int|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param int|null $points Total points incurred over the lifespan of the loyalty card. + * + * @return self + */ + public function setPoints($points) + { + if (is_null($points)) { + array_push($this->openAPINullablesSetToNull, 'points'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('points', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['points'] = $points; + + return $this; + } + + /** + * Gets balance + * + * @return int|null + */ + public function getBalance() + { + return $this->container['balance']; + } + + /** + * Sets balance + * + * @param int|null $balance Points available for reward redemption. + * + * @return self + */ + public function setBalance($balance) + { + if (is_null($balance)) { + array_push($this->openAPINullablesSetToNull, 'balance'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('balance', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['balance'] = $balance; + + return $this; + } + + /** + * Gets nextExpirationDate + * + * @return \DateTime|null + */ + public function getNextExpirationDate() + { + return $this->container['nextExpirationDate']; + } + + /** + * Sets nextExpirationDate + * + * @param \DateTime|null $nextExpirationDate The next closest date when the next set of points are due to expire. + * + * @return self + */ + public function setNextExpirationDate($nextExpirationDate) + { + if (is_null($nextExpirationDate)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationDate'] = $nextExpirationDate; + + return $this; + } + + /** + * Gets nextExpirationPoints + * + * @return int|null + */ + public function getNextExpirationPoints() + { + return $this->container['nextExpirationPoints']; + } + + /** + * Sets nextExpirationPoints + * + * @param int|null $nextExpirationPoints The amount of points that are set to expire next. + * + * @return self + */ + public function setNextExpirationPoints($nextExpirationPoints) + { + if (is_null($nextExpirationPoints)) { + array_push($this->openAPINullablesSetToNull, 'nextExpirationPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('nextExpirationPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['nextExpirationPoints'] = $nextExpirationPoints; + + 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/VouchersUpdateResponseBodyPublish.php b/src/Model/VouchersUpdateResponseBodyPublish.php new file mode 100644 index 0000000..25fcd37 --- /dev/null +++ b/src/Model/VouchersUpdateResponseBodyPublish.php @@ -0,0 +1,500 @@ + + */ +class VouchersUpdateResponseBodyPublish implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersUpdateResponseBodyPublish'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'object' => 'string', + 'count' => 'int', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'object' => null, + 'count' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object' => true, + 'count' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'object' => 'object', + 'count' => 'count', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'object' => 'setObject', + 'count' => 'setCount', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'object' => 'getObject', + 'count' => 'getCount', + 'url' => 'getUrl' + ]; + + /** + * 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('object', $data ?? [], 'list'); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('url', $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 object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Publication events counter. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + array_push($this->openAPINullablesSetToNull, 'count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/VouchersUpdateResponseBodyRedemption.php b/src/Model/VouchersUpdateResponseBodyRedemption.php new file mode 100644 index 0000000..b163c59 --- /dev/null +++ b/src/Model/VouchersUpdateResponseBodyRedemption.php @@ -0,0 +1,582 @@ + + */ +class VouchersUpdateResponseBodyRedemption implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'VouchersUpdateResponseBodyRedemption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'quantity' => 'int', + 'redeemedQuantity' => 'int', + 'redeemedPoints' => 'int', + 'object' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'quantity' => null, + 'redeemedQuantity' => null, + 'redeemedPoints' => null, + 'object' => null, + 'url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'quantity' => true, + 'redeemedQuantity' => true, + 'redeemedPoints' => true, + 'object' => true, + 'url' => true + ]; + + /** + * 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 = [ + 'quantity' => 'quantity', + 'redeemedQuantity' => 'redeemed_quantity', + 'redeemedPoints' => 'redeemed_points', + 'object' => 'object', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'quantity' => 'setQuantity', + 'redeemedQuantity' => 'setRedeemedQuantity', + 'redeemedPoints' => 'setRedeemedPoints', + 'object' => 'setObject', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'quantity' => 'getQuantity', + 'redeemedQuantity' => 'getRedeemedQuantity', + 'redeemedPoints' => 'getRedeemedPoints', + 'object' => 'getObject', + 'url' => 'getUrl' + ]; + + /** + * 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('quantity', $data ?? [], null); + $this->setIfExists('redeemedQuantity', $data ?? [], null); + $this->setIfExists('redeemedPoints', $data ?? [], null); + $this->setIfExists('object', $data ?? [], 'list'); + $this->setIfExists('url', $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 quantity + * + * @return int|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param int|null $quantity How many times a voucher can be redeemed. A `null` value means unlimited. + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + array_push($this->openAPINullablesSetToNull, 'quantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('quantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets redeemedQuantity + * + * @return int|null + */ + public function getRedeemedQuantity() + { + return $this->container['redeemedQuantity']; + } + + /** + * Sets redeemedQuantity + * + * @param int|null $redeemedQuantity How many times a voucher has already been redeemed. + * + * @return self + */ + public function setRedeemedQuantity($redeemedQuantity) + { + if (is_null($redeemedQuantity)) { + array_push($this->openAPINullablesSetToNull, 'redeemedQuantity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedQuantity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedQuantity'] = $redeemedQuantity; + + return $this; + } + + /** + * Gets redeemedPoints + * + * @return int|null + */ + public function getRedeemedPoints() + { + return $this->container['redeemedPoints']; + } + + /** + * Sets redeemedPoints + * + * @param int|null $redeemedPoints Total loyalty points redeemed. + * + * @return self + */ + public function setRedeemedPoints($redeemedPoints) + { + if (is_null($redeemedPoints)) { + array_push($this->openAPINullablesSetToNull, 'redeemedPoints'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redeemedPoints', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redeemedPoints'] = $redeemedPoints; + + return $this; + } + + /** + * Gets object + * + * @return string|null + */ + public function getObject() + { + return $this->container['object']; + } + + /** + * Sets object + * + * @param string|null $object The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. + * + * @return self + */ + public function setObject($object) + { + if (is_null($object)) { + array_push($this->openAPINullablesSetToNull, 'object'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('object', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['object'] = $object; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + array_push($this->openAPINullablesSetToNull, 'url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['url'] = $url; + + 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/ObjectSerializer.php b/src/ObjectSerializer.php new file mode 100644 index 0000000..1aafa2d --- /dev/null +++ b/src/ObjectSerializer.php @@ -0,0 +1,567 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (is_subclass_of($openAPIType, '\BackedEnum')) { + $data = $openAPIType::tryFrom($data); + if ($data === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $openAPIType::cases())); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (is_subclass_of($class, '\BackedEnum')) { + $data = $class::tryFrom($data); + if ($data === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $class::cases())); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\OpenAPI\Client\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +} diff --git a/src/Orders.php b/src/Orders.php deleted file mode 100644 index 3866203..0000000 --- a/src/Orders.php +++ /dev/null @@ -1,72 +0,0 @@ -client = $client; - } - - /** - * @param stdClass $order - * - * Create order. - * - * @throws \Voucherify\ClientException - */ - public function create($order) - { - return $this->client->post("/orders/", $order, null); - } - - /** - * @param string $orderId - * - * Get order details. - * - * @throws \Voucherify\ClientException - */ - public function get($orderId) - { - return $this->client->get("/orders/" . rawurlencode($orderId), null); - } - - /** - * @param array|stdClass $order Object with order fields for update - * - * Update order. - * - * @throws \Voucherify\ClientException - */ - public function update($order) - { - $orderId = ""; - - if (is_array($order)) { - $orderId = $order["id"]; - } - elseif (is_object($order)) { - $orderId = $order->id; - } - - return $this->client->put("/orders/" . rawurlencode($orderId), $order, null); - } - - /** - * @throws \Voucherify\ClientException - */ - public function getList() - { - return $this->client->get("/orders/"); - } -} \ No newline at end of file diff --git a/src/Products.php b/src/Products.php deleted file mode 100644 index 1001f2c..0000000 --- a/src/Products.php +++ /dev/null @@ -1,175 +0,0 @@ -client = $client; - } - - /** - * @param array|stdClass $product Product object - * - * Create product. - * - * @throws \Voucherify\ClientException - */ - public function create($product) - { - return $this->client->post("/products/", $product); - } - - /** - * @param string $productId - * - * Get product. - * - * @throws \Voucherify\ClientException - */ - public function get($productId) - { - return $this->client->get("/products/" . rawurlencode($productId)); - } - - /** - * @param array|stdClass $params - * - * List products. - * - * @throws \Voucherify\ClientException - */ - public function getList($params = null) - { - return $this->client->get("/products/", $params); - } - - /** - * @param array|stdClass $product Product object - * - * Update product. - * - * @throws \Voucherify\ClientException - */ - public function update($product) - { - $productId = ""; - - if (is_array($product)) { - $productId = $product["id"]; - unset($product["id"]); - } - elseif (is_object($product)) { - $productId = $product->id; - unset($product->id); - } - - return $this->client->put("/products/" . rawurlencode($productId), $product); - } - - /** - * @param string $productId - * @param boolean|null $force - * - * Delete product. - * - * @throws \Voucherify\ClientException - */ - public function delete($productId, $force = null) - { - $options = (object)[]; - $options->qs = [ "force" => ($force ? "true" : "false") ]; - - return $this->client->delete("/products/" . rawurlencode($productId), null, $options); - } - - /** - * @param string $productId - * @param array|stdClass $sku Sku object - * - * Create product's sku. - * - * @throws \Voucherify\ClientException - */ - public function createSku($productId, $sku) - { - return $this->client->post("/products/" . rawurlencode($productId) . "/skus", $sku); - } - - /** - * @param string $productId - * @param string $skuId - * - * Get product's sku. - * - * @throws \Voucherify\ClientException - */ - public function getSku($productId, $skuId) - { - return $this->client->get("/products/" . rawurlencode($productId) . "/skus/" . rawurlencode($skuId)); - } - - /** - * @param string $productId - * - * List product's skus. - * - * @throws \Voucherify\ClientException - */ - public function getSkus($productId) - { - return $this->client->get("/products/". rawurlencode($productId) . "/skus/"); - } - - /** - * @param string $productId - * @param array|stdClass $sku Product's sku object - * - * Update product's sku. - * - * @throws \Voucherify\ClientException - */ - public function updateSku($productId, $sku) - { - $skuId = ""; - - if (is_array($sku)) { - $skuId = $sku["id"]; - unset($sku["id"]); - } - elseif (is_object($sku)) { - $skuId = $sku->id; - unset($sku->id); - } - - return $this->client->put("/products/" . rawurlencode($productId) . "/skus/" . rawurlencode($skuId), $sku); - } - - /** - * @param string $productId - * @param string $skuId - * @param boolean|null $force - * - * Delete product's sku. - * - * @throws \Voucherify\ClientException - */ - public function deleteSku($productId, $skuId, $force = null) - { - $options = (object)[]; - $options->qs = [ "force" => ($force ? "true" : "false") ]; - - return $this->client->delete("/products/" . rawurlencode($productId) . "/skus/" . rawurlencode($skuId), null, $options); - } -} - - diff --git a/src/PromotionTiers.php b/src/PromotionTiers.php deleted file mode 100644 index 9a57923..0000000 --- a/src/PromotionTiers.php +++ /dev/null @@ -1,105 +0,0 @@ -client = $client; - } - - /** - * @param string $promotionId - * @param array|stdClass $params - * - * Add promotion tier to campaign. - * - * @throws \Voucherify\ClientException - */ - public function create($promotionId, $params) - { - return $this->client->post("/promotions/" . rawurlencode($promotionId) . "/tiers", $params); - } - - /** - * @param string $promotionId - * - * List promotion tiers from campaign. - * - * @throws \Voucherify\ClientException - */ - public function getList($promotionId) - { - return $this->client->get("/promotions/" . rawurlencode($promotionId) . "/tiers", null); - } - - /** - * List available promotion tiers. - * - * @throws \Voucherify\ClientException - */ - public function getAvailable() - { - $params = [ "is_available" => "true" ]; - return $this->client->get("/promotions/tiers", $params); - } - - - - /** - * @param string $promotionTierId - * @param array|stdClass $params - * - * Validate promotion tier. - * - * @throws \Voucherify\ClientException - */ - public function redeem($promotionTierId, $params) - { - return $this->client->post("/promotions/tiers/" . rawurlencode($promotionTierId) . "/redemption/", $params, null); - } - - /** - * @param array|stdClass $params - * - * Update promotion tier. - * - * @throws \Voucherify\ClientException - */ - public function update($params) - { - $promotionTierId = ""; - - if (is_array($params)) { - $promotionTierId = $params["id"]; - } - elseif (is_object($params)) { - $promotionTierId = $params->id; - } - - return $this->client->put("/promotions/tiers/" . rawurlencode($promotionTierId), $params, null); - } - - /** - * @param string $promotionTierId - * - * Delete promotion tier. - * - * @throws \Voucherify\ClientException - */ - public function delete($promotionTierId) - { - return $this->client->delete("/promotions/tiers/" . rawurlencode($promotionTierId), null, null); - } -} - - diff --git a/src/Promotions.php b/src/Promotions.php deleted file mode 100644 index 83e22cd..0000000 --- a/src/Promotions.php +++ /dev/null @@ -1,68 +0,0 @@ -client = $client; - $this->campaigns = $dependencies["campaigns"]; - - // PUBLIC - $this->tiers = $dependencies["promotionTiers"]; - } - - /** - * @param array|stdClass $campaign - * - * Create promotion campaign. - * - * @throws \Voucherify\ClientException - */ - public function create($campaign) - { - if (is_array($campaign)) { - $campaign["campaign_type"] = "PROMOTION"; - } - elseif (is_object($campaign)) { - $campaign->campaign_type = "PROMOTION"; - } - - return $this->campaigns->create($campaign); - } - - /** - * @param array|stdClass $params Params object - * - * Validate promotions. - * - * @throws \Voucherify\ClientException - */ - public function validate($params) - { - return $this->client->post("/promotions/validation", $params); - } -} - - diff --git a/src/Redemptions.php b/src/Redemptions.php deleted file mode 100644 index 31ebd4c..0000000 --- a/src/Redemptions.php +++ /dev/null @@ -1,205 +0,0 @@ -client = $client; - $this->promotions = $dependencies["promotions"]; - } - - /** - * @param array|stdClass $promotionTier - * @param array|stdClass $params - * - * Redeem promotion tier. - * - * @throws \Voucherify\ClientException - */ - private function redeemPromotionTier($promotionTier, $params) - { - $promotionTierId = ""; - - if (is_object($promotionTier)) { - $promotionTierId = $promotionTier->id; - } - elseif (is_array($promotionTier)) { - $promotionTierId = $promotionTier["id"]; - } - - return $this->promotions->tiers->redeem($promotionTierId, $params); - } - - /** - * Voucher code or array with voucher (code), customer profile and order amount - * - * @param string|array $code Voucher code or array with voucher (code), customer profile and order amount - * @param string|null $params Provided tracking id - * - * Redeem voucher. - * - * @throws \Voucherify\ClientException - */ - private function redeemVoucher($code, $params) - { - $payload = null; - $options = null; - - if (is_string($code) && !is_string($params)) { - $payload = $params; - } - - // Backward compatibility - Should always use string code as first param - if (is_array($code)) { - $payload = $code; - $code = $payload["voucher"]; - unset($payload["voucher"]); - } - - // Backward compatibility - Check if params is string -> tracking_id - if (is_string($params)) { - $options = (object)[]; - $options->qs = ["tracking_id" => $params]; - } - - return $this->client->post("/vouchers/" . rawurlencode($code) . "/redemption/", $payload, $options); - } - - /** - * @param string|array|stdClass $params Voucher code, Voucher validation data or Promotion tier data - * @param string|array|stdClass $context Voucher validation context data or Promotion tier validation context data - * - * Validate voucher or promotion tier. - * - * @throws \Voucherify\ClientException - */ - public function redeem($params, $context = null) - { - $redeemPromotionTier = - (is_object($params) || is_array($params)) && - (is_object($context) || is_array($context)); - - if ($redeemPromotionTier) { - return $this->redeemPromotionTier($params, $context); - } - return $this->redeemVoucher($params, $context); - } - - /** - * @param string| $redemptionId - * - * Get redemption. - * - * @throws \Voucherify\ClientException - */ - public function get($redemptionId) - { - return $this->client->get("/redemptions/" . rawurlencode($redemptionId)); - } - - /** - * @param array|stdClass $filter - * - * Get a filtered list of redemptions. The filter can include following properties: - * - limit - number (default 100) - * - page - number (default 0) - * - start_date - string (ISO8601 format, default is the beginning of current month) - * - end_date - string (ISO8601 format, default is the end of current month) - * - result - string (SUCCESS|FAILURE) - * - customer - string - * - * @throws \Voucherify\ClientException - */ - public function getList($filter = null) - { - return $this->client->get("/redemptions/", $filter); - } - - /** - * @param string $code - * - * Get voucher redemption - * - * @throws \Voucherify\ClientException - */ - public function getForVoucher($code) - { - return $this->client->get("/vouchers/" . rawurlencode($code) . "/redemption/", null); - } - - /** - * @param string $redemptionId - * @param string|array|stdClass|null $params - * - * Rollback redemption. This operation creates a rollback entry in voucher's redemption history (`redemption.redemption_entries`) - * and gives 1 redemption back to the pool (decreases `redeemed_quantity` by 1). - * - * @throws \Voucherify\ClientException - */ - public function rollback($redemptionId, $params = null) - { - $payload = null; - $options = (object)[ "qs" => null ]; - - if (is_string($params)) { - $options->qs = (object)[ "reason" => $params ]; - } - elseif (is_object($params)) { - - if (isset($params->reason)) { - if (!isset($options->qs)) { - $options->qs = (object)[]; - } - $options->qs->reason = $params->reason; - } - - if (isset($params->tracking_id)) { - if (!isset($options->qs)) { - $options->qs = (object)[]; - } - $options->qs->tracking_id = $params->tracking_id; - } - - if (isset($params->customer)) { - $payload = (object)[ "customer" => $params->customer ]; - } - } - elseif (is_array($params)) { - - if (isset($params["reason"])) { - if (!isset($options->qs)) { - $options->qs = (object)[]; - } - $options->qs->reason = $params["reason"]; - } - - if (isset($params["tracking_id"])) { - if (!isset($options->qs)) { - $options->qs = (object)[]; - } - $options->qs->tracking_id = $params["tracking_id"]; - } - - if (isset($params["customer"])) { - $payload = (object)[ "customer" => $params["customer"] ]; - } - } - - return $this->client->post("/redemptions/" . rawurlencode($redemptionId) . "/rollback/", $payload, $options); - } -} \ No newline at end of file diff --git a/src/Segments.php b/src/Segments.php deleted file mode 100644 index 2eea840..0000000 --- a/src/Segments.php +++ /dev/null @@ -1,57 +0,0 @@ -client = $client; - } - - /** - * @param array|stdClass $params Params object - * - * Create segment. - * - * @throws \Voucherify\ClientException - */ - public function create($params) - { - return $this->client->post("/segments/", $params); - } - - /** - * @param string $segmentId Segement id. - * - * Get segment. - * - * @throws \Voucherify\ClientException - */ - public function get($segmentId) - { - return $this->client->get("/segments/" . rawurlencode($segmentId)); - } - - /** - * @param string $segmentId Segement id. - * - * Delete segment. - * - * @throws \Voucherify\ClientException - */ - public function delete($segmentId) - { - return $this->client->delete("/segments/" . rawurlencode($segmentId)); - } -} - - diff --git a/src/Utils.php b/src/Utils.php deleted file mode 100644 index 8be02c2..0000000 --- a/src/Utils.php +++ /dev/null @@ -1,27 +0,0 @@ -client = $client; - } - - /** - * @param array|stdClass $params Params object - * - * Create validation rule. - * - * @throws \Voucherify\ClientException - */ - public function create($params) - { - return $this->client->post("/validation-rules/", $params); - } - - /** - * @param string $ruleId Validation rule id. - * - * Get validation rule. - * - * @throws \Voucherify\ClientException - */ - public function get($ruleId) - { - return $this->client->get("/validation-rules/" . rawurlencode($ruleId)); - } - - /** - * @param array|stdClass $params - * - * List validation rules. - * - * @throws \Voucherify\ClientException - */ - public function getList($params = null) - { - return $this->client->get("/validation-rules/", $params); - } - - /** - * @param string $ruleId Validation rule id. - * @param array|stdClass $params Params object - * - * Upadate validation rule. - * - * @throws \Voucherify\ClientException - */ - public function update($rule) - { - $ruleId = ""; - - if (is_array($rule)) { - $ruleId = $rule["id"]; - unset($rule["id"]); - } - elseif (is_object($rule)) { - $ruleId = $rule->id; - unset($rule->id); - } - - return $this->client->put("/validation-rules/" . rawurlencode($ruleId), $rule); - } - - /** - * @param string $ruleId Validation rule id. - * - * Delete validation rule. - * - * @throws \Voucherify\ClientException - */ - public function delete($ruleId) - { - return $this->client->delete("/validation-rules/" . rawurlencode($ruleId)); - } - - /** - * @param array|stdClass $params Params object - * - * Create validation rule assignment - * - * @throws \Voucherify\ClientException - */ - public function createAssignment($ruleId, $assignment) - { - return $this->client->post("/validation-rules/" . rawurlencode($ruleId) . "/assignments", $assignment); - } - - /** - * @param array|stdClass $params - * - * List validation rule assignments - * - * @throws \Voucherify\ClientException - */ - public function getAssignments($ruleId, $params = null) - { - return $this->client->get("/validation-rules/" . rawurlencode($ruleId) . "/assignments", $params); - } - - /** - * @param array|stdClass $params Params object - * - * Delete validation rule assignment - * - * @throws \Voucherify\ClientException - */ - public function deleteAssignment($ruleId, $assignmentId) - { - return $this->client->delete("/validation-rules/" . rawurlencode($ruleId) . "/assignments/" . rawurlencode($assignmentId)); - } -} - - diff --git a/src/Validations.php b/src/Validations.php deleted file mode 100644 index 5da8bff..0000000 --- a/src/Validations.php +++ /dev/null @@ -1,56 +0,0 @@ -client = $client; - $this->promotions = $dependencies["promotions"]; - } - - /** - * @param string $code Voucher code - * @param array|stdClass $params Params object - * - * Validate voucher. - * - * @throws \Voucherify\ClientException - */ - public function validateVoucher($code, $params = null) - { - return $this->client->post("/vouchers/" . rawurlencode($code) . "/validate", $params); - } - - /** - * @param string|array|stdClass $params Voucher code or Promotion data - * @param array|stdClass $context Voucher validation context data - * - * Validate voucher or promotion. - * - * @throws \Voucherify\ClientException - */ - public function validate($params, $context = null) - { - $validatePromotion = is_array($params) || is_object($params); - - if ($validatePromotion) { - return $this->promotions->validate($params); - } - return $this->validateVoucher($params, $context); - } -} \ No newline at end of file diff --git a/src/VoucherBuilder.php b/src/VoucherBuilder.php deleted file mode 100644 index 26c7c10..0000000 --- a/src/VoucherBuilder.php +++ /dev/null @@ -1,143 +0,0 @@ -_voucher = (object)[ - "code_config" => (object)[] - ]; - } - - public function setCode($code) - { - $this->_voucher->code = $code; - return $this; - } - - public function setCodeLength($length) - { - $this->_voucher->code_config->length = $length; - return $this; - } - - public function setCodeCharset($charset) - { - $this->_voucher->code_config->charset = $charset; - return $this; - } - - public function setCodePrefix($prefix) - { - $this->_voucher->code_config->prefix = $prefix; - return $this; - } - - public function setCodePostfix($postfix) - { - $this->_voucher->code_config->postfix = $postfix; - return $this; - } - - public function setCodePattern($pattern) - { - $this->_voucher->code_config->pattern = $pattern; - return $this; - } - - public function setCampaign($campaign) - { - $this->_voucher->campaign = $campaign; - return $this; - } - - public function setCategory($category) - { - $this->_voucher->category = $category; - return $this; - } - - public function setAmountDiscount($amount_off) - { - $this->_voucher->type = "DISCOUNT_VOUCHER"; - $this->_voucher->discount = (object)[ - "type" => "AMOUNT", - "amount_off" => $amount_off * 100 - ]; - return $this; - } - - public function setPercentDiscount($percent_off) - { - $this->_voucher->type = "DISCOUNT_VOUCHER"; - $this->_voucher->discount = (object)[ - "type" => "PERCENT", - "percent_off" => $percent_off - ]; - return $this; - } - - public function setUnitDiscount($unit_off, $unit_type) - { - $this->_voucher->type = "DISCOUNT_VOUCHER"; - $this->_voucher->discount = (object)[ - "type" => "UNIT", - "unit_off" => $unit_off, - "unit_type" => $unit_type - ]; - return $this; - } - - public function setGiftAmount($amount) - { - $this->_voucher->type = "GIFT_VOUCHER"; - $this->_voucher->gift = (object)[ - "amount" => $amount * 100 - ]; - return $this; - } - - public function setStartDate($start_date) - { - if ($start_date instanceof \DateTime) { - $start_date = $start_date->format(\DateTime::ISO8601); - } - $this->_voucher->start_date = $start_date; - return $this; - } - - public function setExpirationDate($expiration_date) - { - if ($expiration_date instanceof \DateTime) { - $expiration_date = $expiration_date->format(\DateTime::ISO8601); - } - $this->_voucher->expiration_date = $expiration_date; - return $this; - } - - public function setRedemptionLimit($redemption_limit) - { - $this->_voucher->redemption = (object)[ - "quantity" => $redemption_limit - ]; - return $this; - } - - public function setActive($active) - { - $this->_voucher->active = $active; - return $this; - } - - public function build() - { - if (isset($this->_voucher->code)) { - unset($this->_voucher->code_config); - } - return $this->_voucher; - } -} diff --git a/src/VoucherifyClient.php b/src/VoucherifyClient.php deleted file mode 100644 index ee9392f..0000000 --- a/src/VoucherifyClient.php +++ /dev/null @@ -1,308 +0,0 @@ -client = new ApiClient($apiId, $apiKey, $apiVersion, $apiUrl, $customHeaders); - $this->promotionTiers = new PromotionTiers($this->client); - - // PUBLIC - $this->campaigns = new Campaigns($this->client); - $this->customers = new Customers($this->client); - $this->distributions = new Distributions($this->client); - $this->orders = new Orders($this->client); - $this->products = new Products($this->client); - $this->promotions = new Promotions($this->client, [ - "campaigns" => $this->campaigns, - "promotionTiers" => $this->promotionTiers - ]); - $this->redemptions = new Redemptions($this->client, [ - "promotions" => $this->promotions - ]); - $this->segments = new Segments($this->client); - $this->validations = new Validations($this->client, [ - "promotions" => $this->promotions - ]); - $this->validationRules = new ValidationRules($this->client); - $this->vouchers = new Vouchers($this->client); - $this->asyncActions = new AsyncActions($this->client); - $this->customEvents = new CustomEvents($this->client); - - /* ********* BACKWARD COMPATIBILITY ********* */ - - $this->customer = $this->customers; - } - - /** - * @param \PsrLogLoggerInterface $logger - */ - public function setLogger($logger) - { - $this->client->setLogger($logger); - } - - /** - * @param array $options - */ - public function setConnectionOptions($options) - { - $this->client->setConnectionOptions($options); - } - - /* ********* BACKWARD COMPATIBILITY ********* */ - - /** - * @var Customer - */ - public $customer; - - /** - * @param string $code - * - * Get voucher details. - * - * @throws \Voucherify\ClientException - */ - public function get($code) - { - return $this->vouchers->get($code); - } - - /** - * @param stdClass $voucher - * - * Create voucher. - * - * @throws \Voucherify\ClientException - */ - public function create($voucher) - { - return $this->vouchers->create($voucher); - } - - /** - * @param stdClass $voucher_update - * - * Update voucher. - * - * @throws \Voucherify\ClientException - */ - public function update($voucher_update) - { - return $this->vouchers->update($voucher_update); - } - - /** - * @param string $code - * - * Enable voucher with given code. - * - * @throws \Voucherify\ClientException - */ - public function enable($code) - { - return $this->vouchers->enable($code); - } - - /** - * @param string $code - * - * Disable voucher with given code. - * - * @throws \Voucherify\ClientException - */ - public function disable($code) - { - return $this->vouchers->disable($code); - } - - /** - * @param $campaignName - * @return mixed - * @internal param string $code Enable voucher with given code.* - * Enable voucher with given code. - * - */ - public function publish($campaignName) - { - return $this->distributions->publish($campaignName); - } - - /** - * @param string $code - * @param boolean|null $force - * - * Delete voucher by code - * - * @throws \Voucherify\ClientException - */ - public function delete($code, $force = null) - { - return $this->vouchers->delete($code, $force); - } - - /** - * @param string $code - * - * Get voucher redemption - * - * @throws \Voucherify\ClientException - */ - public function redemption($code) - { - return $this->redemptions->getForVoucher($code); - } - - /** - * @param string|array $code Voucher code or array with voucher (code), customer profile and order amount - * @param string|null $trackingId Provided tracking id - * - * Redeem voucher - * - * @throws \Voucherify\ClientException - */ - public function redeem($code, $trackingId) - { - return $this->redemptions->redeem($code, $trackingId); - } - - /** - * @param string $redemptionId - * @param string|null $trackingId - * @param string|null $reason - * - * Rollback redemption. This operation creates a rollback entry in voucher's redemption history (`redemption.redemption_entries`) - * and gives 1 redemption back to the pool (decreases `redeemed_quantity` by 1). - * - * @throws \Voucherify\ClientException - */ - public function rollback($redemptionId, $trackingId = null, $reason = null) - { - $params = (object)[]; - $params->tracking_id = $trackingId; - $params->reason = $reason; - - return $this->redemptions->rollback($redemptionId, $params); - } - - /** - * @param array|stdClass $filter - * - * Get a filtered list of vouchers. The filter can include following properties: - * - code_query - string - * - limit - number (default 10) - * - skip - number (default 0) - * - campaign - string - * - category - string - * - customer - string - * - * @throws \Voucherify\ClientException - */ - public function vouchers($filter) - { - return $this->vouchers->getList($filter); - } - - /** - * @param array|stdClass $filter - * - * Get a filtered list of redemptions. The filter can include following properties: - * - limit - number (default 100) - * - page - number (default 0) - * - start_date - string (ISO8601 format, default is the beginning of current month) - * - end_date - string (ISO8601 format, default is the end of current month) - * - result - string (Success|Failure-NotExist|Failure-Inactive) - * - customer - string - * - * @throws \Voucherify\ClientException - */ - public function redemptions($filter) - { - return $this->redemptions->getList($filter); - } -} \ No newline at end of file diff --git a/src/Vouchers.php b/src/Vouchers.php deleted file mode 100644 index a46b397..0000000 --- a/src/Vouchers.php +++ /dev/null @@ -1,150 +0,0 @@ -client = $client; - } - - /** - * @param stdClass $voucher - * - * Create voucher. - * - * @throws \Voucherify\ClientException - */ - public function create($voucher) - { - if (isset($voucher->code)) { - return $this->client->post("/vouchers/" . rawurlencode($voucher->code), $voucher, null); - } - else { - return $this->client->post("/vouchers/", $voucher, null); - } - } - - /** - * @param string $code - * - * Get voucher details. - * - * @throws \Voucherify\ClientException - */ - public function get($code) - { - return $this->client->get("/vouchers/" . rawurlencode($code), null); - } - - /** - * @param array|stdClass $voucher - * - * Update voucher. - * - * @throws \Voucherify\ClientException - */ - public function update($voucher) - { - $code = ""; - - if (is_array($voucher)) { - $code = $voucher["code"]; - } - elseif (is_object($voucher)) { - $code = $voucher->code; - } - - return $this->client->put("/vouchers/" . rawurlencode($code), $voucher, null); - } - - /** - * @param string $code - * @param boolean|null $force - * - * Delete voucher by code. - * - * @throws \Voucherify\ClientException - */ - public function delete($code, $force = null) - { - $options = (object)[]; - $options->qs = [ "force" => ($force ? "true" : "false") ]; - - return $this->client->delete("/vouchers/" . rawurlencode($code), null, $options); - } - - /** - * @param array|stdClass $filter - * - * Get a filtered list of vouchers. The filter can include following properties: - * - limit - number (default 10) - * - page - number (default 0) - * - campaign - string - * - category - string - * - * @throws \Voucherify\ClientException - */ - public function getList($filter = null) - { - return $this->client->get("/vouchers/", $filter); - } - - /** - * @param string $code - * - * Enable voucher with given code. - * - * @throws \Voucherify\ClientException - */ - public function enable($code) - { - return $this->client->post("/vouchers/" . rawurlencode($code) . "/enable", null, null); - } - - /** - * @param string $code - * - * Disable voucher with given code. - * - * @throws \Voucherify\ClientException - */ - public function disable($code) - { - return $this->client->post("/vouchers/" . rawurlencode($code) . "/disable", null, null); - } - - /** - * @param string $code - * - * Increase Gif-Card type voucher's balance. - * - * @throws \Voucherify\ClientException - */ - public function addBalance($code, $balance) - { - $payload = (object)[]; - $payload->amount = $balance; - - return $this->client->post("/vouchers/" . rawurlencode($code) . "/balance", $payload, null); - } - - /** - * @param stdClass[] $vouchers - * - * Import vouchers to the repository. - */ - public function import($vouchers) - { - return $this->client->post("/vouchers/import", $vouchers); - } -} \ No newline at end of file diff --git a/src/autoload.php b/src/autoload.php deleted file mode 100644 index 9993e4f..0000000 --- a/src/autoload.php +++ /dev/null @@ -1,15 +0,0 @@ -get("/async-actions/test-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->asyncActions->get("test-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetList() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/async-actions/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->asyncActions->getList(); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetListByQuery() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/async-actions/") - ->query([ "limit" => 5, "end_date" => "2021-07-16T15:12:43Z" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->asyncActions->getList([ "limit" => 5, "end_date" => "2021-07-16T15:12:43Z" ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - -} \ No newline at end of file diff --git a/test/CampaignsTest.php b/test/CampaignsTest.php deleted file mode 100644 index 3a90814..0000000 --- a/test/CampaignsTest.php +++ /dev/null @@ -1,146 +0,0 @@ -post("/campaigns", [ - "name" => "test campaign" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->campaigns->create((object)[ - "name" => "test campaign" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testAddVoucher() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/campaigns/test%20campaign/vouchers/", [ - "params" => "test-params" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->campaigns->addVoucher("test campaign", (object)[ - "params" => "test-params" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/campaigns/test%20campaign/vouchers/", null) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->campaigns->addVoucher("test campaign"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testAddVoucherWithCode() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/campaigns/test%20campaign/vouchers/test-code", [ - "params" => "test-params" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->campaigns->addVoucherWithCode("test campaign", "test-code", (object)[ - "params" => "test-params" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/campaigns/test%20campaign/vouchers/test-code", null) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->campaigns->addVoucherWithCode("test campaign", "test-code"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testImportVouchers() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/campaigns/test%20campaign/import", [ - [ "code" => "test-code" ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->campaigns->importVouchers("test campaign", (object)[ - [ "code" => "test-code" ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDelete() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/campaigns/test%20campaign") - ->query([ "force" => "false" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->campaigns->delete("test campaign"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDeletePermamently() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/campaigns/test%20campaign") - ->query([ "force" => "true" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->campaigns->delete("test campaign", true); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} \ No newline at end of file diff --git a/test/ClientTest.php b/test/ClientTest.php deleted file mode 100644 index 922626c..0000000 --- a/test/ClientTest.php +++ /dev/null @@ -1,217 +0,0 @@ -assertEquals($e->getMessage(), "ApiId is required"); - } - - try { - $client = new VoucherifyClient(self::$apiId, null); - } - catch (Exception $e) { - $this->assertEquals($e->getMessage(), "ApiKey is required"); - } - } - - public function testCustomApiUrl() - { - $headers = [ - "content-type: application/json", - "x-app-id: " . self::$apiId, - "x-app-token: " . self::$apiKey, - "x-voucherify-channel: PHP-SDK" - ]; - - CurlMock::register("https://api.voucherify.io/v1", $headers) - ->get("/vouchers/test-voucher-1") - ->reply(200, [ "status" => "ok" ]); - - $client = new VoucherifyClient(self::$apiId, self::$apiKey); - - $result = $client->vouchers->get("test-voucher-1"); - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://custom-api.voucherify.io/v1", $headers) - ->get("/vouchers/test-voucher-2") - ->reply(200, [ "status" => "ok" ]); - - $customUrl = "https://custom-api.voucherify.io"; - $client = new VoucherifyClient(self::$apiId, self::$apiKey, null, $customUrl); - - $result = $client->vouchers->get("test-voucher-2"); - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testVersioning() - { - $headers = [ - "content-type: application/json", - "x-app-id: " . self::$apiId, - "x-app-token: " . self::$apiKey, - "x-voucherify-channel: PHP-SDK" - ]; - - CurlMock::register("https://api.voucherify.io/v1", $headers) - ->get("/vouchers/test-voucher-1") - ->reply(200, [ "status" => "ok" ]); - - $client = new VoucherifyClient(self::$apiId, self::$apiKey); - - $result = $client->vouchers->get("test-voucher-1"); - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - $headers = [ - "content-type: application/json", - "x-app-id: " . self::$apiId, - "x-app-token: " . self::$apiKey, - "x-voucherify-channel: PHP-SDK", - "x-voucherify-api-version: v2017-04-05" - ]; - - CurlMock::register("https://api.voucherify.io/v1", $headers) - ->get("/vouchers/test-voucher-2") - ->reply(200, [ "status" => "ok" ]); - - $client = new VoucherifyClient(self::$apiId, self::$apiKey, "v2017-04-05"); - - $result = $client->vouchers->get("test-voucher-2"); - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testCustomHeaders() - { - $headers = [ - "content-type: application/json", - "x-app-id: " . self::$apiId, - "x-app-token: " . self::$apiKey, - "x-voucherify-channel: PHP-SDK", - "x-custom-1: Value-1", - "x-custom-2: Value-2" - ]; - - CurlMock::register("https://api.voucherify.io/v1", $headers) - ->get("/vouchers/test-voucher-1") - ->reply(200, [ "status" => "ok" ]); - - $customHeaders = [ - "x-custom-1" => "Value-1", - "X-CustoM-2" => "Value-2" - ]; - - $client = new VoucherifyClient(self::$apiId, self::$apiKey, null, null, $customHeaders); - - $result = $client->vouchers->get("test-voucher-1"); - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - $headers = [ - "content-type: application/json", - "x-app-id: " . self::$apiId, - "x-app-token: " . self::$apiKey, - "x-voucherify-channel: PHP-SDK-Value-2", - "x-custom-1: Value-1" - ]; - - CurlMock::register("https://api.voucherify.io/v1", $headers) - ->get("/vouchers/test-voucher-2") - ->reply(200, [ "status" => "ok" ]); - - $customHeaders = [ - "x-custom-1" => "Value-1", - "X-Voucherify-ChanneL" => "Value-2" - ]; - - $client = new VoucherifyClient(self::$apiId, self::$apiKey, null, null, $customHeaders); - - $result = $client->vouchers->get("test-voucher-2"); - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - - $headers = [ - "content-type: application/json", - "x-app-id: " . self::$apiId, - "x-app-token: " . self::$apiKey, - "x-voucherify-channel: PHP-SDK-value-2", - "x-custom-1: value-1" - ]; - - CurlMock::register("https://api.voucherify.io/v1", $headers) - ->get("/vouchers/test-voucher-3") - ->reply(200, [ "status" => "ok" ]); - - $customHeaders = [ - "x-custom-1" => "value-1", - "X-VoucherifY-ChanneL" => "value-2" - ]; - - $client = new VoucherifyClient(self::$apiId, self::$apiKey, null, null, $customHeaders); - - $result = $client->vouchers->get("test-voucher-3"); - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testErrorHandling() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/customers/", [ "name" => "customer name" ]) - ->reply(400, [ - "message" => "Duplicate resource key", - "details" => "Campaign with name: test campaign already exists.", - "key" => "duplicate_resource_key" - ]); - - try { - $client = new VoucherifyClient(self::$apiId, self::$apiKey); - $client->customers->create([ "name" => "customer name"]); - } - catch (ClientException $e) { - $this->assertEquals($e, new ClientException([ - "code" => 400, - "message" => "Duplicate resource key", - "details" => "Campaign with name: test campaign already exists.", - "key" => "duplicate_resource_key" - ])); - } - - CurlMock::done(); - } -} \ No newline at end of file diff --git a/test/CustomEventsTest.php b/test/CustomEventsTest.php deleted file mode 100644 index 1beeddf..0000000 --- a/test/CustomEventsTest.php +++ /dev/null @@ -1,54 +0,0 @@ -post("/events/", [ - "event" => "php-event", - "customer" => [ - "source_id" => "php-test-customer" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->customEvents->track("php-event", (object)[ - "source_id" => "php-test-customer" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} diff --git a/test/CustomersTest.php b/test/CustomersTest.php deleted file mode 100644 index 3383267..0000000 --- a/test/CustomersTest.php +++ /dev/null @@ -1,129 +0,0 @@ -post("/customers/", [ - "name" => "customer name" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->customers->create((object)[ - "name" => "customer name" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGet() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/customers/test-customer-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->customers->get("test-customer-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetList() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/customers/") - ->query([ "limit" => 3 ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->customers->getList([ "limit" => 3 ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpdateByObject() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/customers/test-customer-id", [ - "id" => "test-customer-id", - "name" => "customer name" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->customers->update((object)[ - "id" => "test-customer-id", - "name" => "customer name" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpdateByArray() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/customers/test-customer-id", [ - "id" => "test-customer-id", - "name" => "customer name" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->customers->update([ - "id" => "test-customer-id", - "name" => "customer name" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDelete() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/customers/test-customer-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->customers->delete("test-customer-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} diff --git a/test/DistributionsTest.php b/test/DistributionsTest.php deleted file mode 100644 index 1cda84a..0000000 --- a/test/DistributionsTest.php +++ /dev/null @@ -1,159 +0,0 @@ -post("/vouchers/publish", [ - "campaign" => "test-campaign" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->distributions->publish("test-campaign"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testPublishByVoucherObject() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/publish", [ - "campaign" => "test-campaign", - "voucher" => "test-voucher" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->distributions->publish((object)[ - "campaign" => "test-campaign", - "voucher" => "test-voucher" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testPublishByVoucherArray() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/publish", [ - "campaign" => "test-campaign", - "voucher" => "test-voucher" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->distributions->publish([ - "campaign" => "test-campaign", - "voucher" => "test-voucher" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testCreateExport() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/exports/", [ - "exported_object" => "voucher", - "parameters" => "test-object" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->distributions->createExport([ - "exported_object" => "voucher", - "parameters" => "test-object" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetExport() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/exports/test-export-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->distributions->getExport("test-export-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDeleteExport() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/exports/test-export-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->distributions->deleteExport("test-export-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetPublications() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/publications") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->distributions->getPublications(); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetPublicationsByQuery() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/publications") - ->query([ "campaign" => "test-campaign" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->distributions->getPublications([ "campaign" => "test-campaign" ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} diff --git a/test/OrdersTest.php b/test/OrdersTest.php deleted file mode 100644 index b91e095..0000000 --- a/test/OrdersTest.php +++ /dev/null @@ -1,117 +0,0 @@ -post("/orders/", [ - "customer" => [ "name" => "customer name" ], - "amount" => 20050 - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->orders->create((object)[ - "customer" => [ "name" => "customer name" ], - "amount" => 20050 - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGet() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/orders/test-order-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->orders->get("test-order-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpdateByObject() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/orders/test-order-id", [ - "id" => "test-order-id", - "status" => "PAID" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->orders->update((object)[ - "id" => "test-order-id", - "status" => "PAID" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpdateByArray() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/orders/test-order-id", [ - "id" => "test-order-id", - "status" => "PAID" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->orders->update([ - "id" => "test-order-id", - "status" => "PAID" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetList() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/orders/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->orders->getList(); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} diff --git a/test/ProductsTest.php b/test/ProductsTest.php deleted file mode 100644 index 7464b37..0000000 --- a/test/ProductsTest.php +++ /dev/null @@ -1,257 +0,0 @@ -post("/products/", [ - "name" => "test-product" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->create((object)[ - "name" => "test-product" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/products/", [ - "name" => "test-product" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->create([ - "name" => "test-product" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGet() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/products/test-product-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->get("test-product-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetList() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/products/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->getList(); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/products/?limit=10") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->getList([ "limit" => 10 ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpdate() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/products/test-product-id", [ - "name" => "Product Name" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->update([ - "id" => "test-product-id", - "name" => "Product Name" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDelete() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/products/test-product-id") - ->query([ "force" => "false" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->delete("test-product-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDeletePermamently() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/products/test-product-id") - ->query([ "force" => "true" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->delete("test-product-id", true); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testCreateSku() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/products/test-product-id/skus", [ - "sku" => "test-sku" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->createSku("test-product-id", (object)[ - "sku" => "test-sku" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/products/test-product-id/skus", [ - "sku" => "test-sku" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->createSku("test-product-id", [ - "sku" => "test-sku" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetSku() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/products/test-product-id/skus/test-sku-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->getSku("test-product-id", "test-sku-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetSkus() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/products/test-product-id/skus/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->getSkus("test-product-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpdateSku() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/products/test-product-id/skus/test-sku-id", [ - "attributes" => "attributes-object" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->updateSku("test-product-id", (object)[ - "id" => "test-sku-id", - "attributes" => "attributes-object" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/products/test-product-id/skus/test-sku-id", [ - "attributes" => "attributes-object" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->updateSku("test-product-id", [ - "id" => "test-sku-id", - "attributes" => "attributes-object" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDeleteSku() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/products/test-product-id/skus/test-sku-id") - ->query([ "force" => "false" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->deleteSku("test-product-id", "test-sku-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDeleteSkuPermamently() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/products/test-product-id/skus/test-sku-id") - ->query([ "force" => "true" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->products->deleteSku("test-product-id", "test-sku-id", true); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} diff --git a/test/PromotionsTest.php b/test/PromotionsTest.php deleted file mode 100644 index 56d14e3..0000000 --- a/test/PromotionsTest.php +++ /dev/null @@ -1,192 +0,0 @@ -post("/campaigns", [ - "name" => "test campaign", - "campaign_type" => "PROMOTION" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->create((object)[ - "name" => "test campaign" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testValidate() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/promotions/validation", [ - "data" => "test" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->validate((object)[ - "data" => "test" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/promotions/validation", [ - "data" => "test" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->validate([ - "data" => "test" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testTiersCreate() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/promotions/test_promotion/tiers", [ - "name" => "test promotion tier name" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->tiers->create("test_promotion", (object)[ - "name" => "test promotion tier name" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testTiersGetList() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/promotions/test_promotion/tiers") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->tiers->getList("test_promotion"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testTiersGetAvailable() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/promotions/tiers") - ->query([ "is_available" => "true" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->tiers->getAvailable(); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testTierRedeem() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/promotions/tiers/test_promotion/redemption/", [ - "data" => [ - "id" => "test_customer_id" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->tiers->redeem("test_promotion", [ - "data" => [ - "id" => "test_customer_id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testTiersUpdate() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/promotions/tiers/test_tier", [ - "id" => "test_tier", - "name" => "test promotion tier name" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->tiers->update((object)[ - "id" => "test_tier", - "name" => "test promotion tier name" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/promotions/tiers/test_tier", [ - "id" => "test_tier", - "name" => "test promotion tier name" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->tiers->update([ - "id" => "test_tier", - "name" => "test promotion tier name" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testTiersDelete() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/promotions/tiers/test_promotion_tier") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->promotions->tiers->delete("test_promotion_tier"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} \ No newline at end of file diff --git a/test/RedemptionsTest.php b/test/RedemptionsTest.php deleted file mode 100644 index c34cd6b..0000000 --- a/test/RedemptionsTest.php +++ /dev/null @@ -1,325 +0,0 @@ -post("/vouchers/test-code/redemption/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->redeem("test-code"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/redemption/", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->redeem("test-code", (object)[ - "customer" => (object)[ - "id" => "test-customer-id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/redemption/", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->redeem("test-code", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - /** - * DEPRECATED! - */ - public function testRedeemVoucher_deprecated() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/redemption/", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->redeem([ - "voucher" => "test-code", - "customer" => [ - "id" => "test-customer-id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testRedeemVoucherWithTracking() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/redemption/") - ->query([ "tracking_id" => "test-tracking-id" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->redeem("test-code", "test-tracking-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testRedeemPromotionTier() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/promotions/tiers/test-promotion/redemption/", [ - "data" => [ - "id" => "test_customer_id" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->redeem((object)[ - "id" => "test-promotion" - ], (object)[ - "data" => [ - "id" => "test_customer_id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/promotions/tiers/test-promotion/redemption/", [ - "data" => [ - "id" => "test_customer_id" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->redeem([ - "id" => "test-promotion" - ], [ - "data" => [ - "id" => "test_customer_id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGet() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/redemptions/test-redemption-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->get("test-redemption-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetList() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/redemptions/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->getList(); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetListByQuery() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/redemptions/") - ->query([ "limit" => 100 ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->getList([ "limit" => 100 ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetForVoucher() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/vouchers/test-code/redemption/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->getForVoucher("test-code"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testRollbackById() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/redemptions/test-redemption-id/rollback/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->rollback("test-redemption-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testRollbackWithCustomer() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/redemptions/test-redemption-id/rollback/", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->rollback("test-redemption-id", (object)[ - "customer" => (object)[ - "id" => "test-customer-id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/redemptions/test-redemption-id/rollback/", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->rollback("test-redemption-id", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testRollbackWithReason() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/redemptions/test-redemption-id/rollback/") - ->query([ "reason" => "test-reason" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->rollback("test-redemption-id", "test-reason"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testRollbackWithCustomerReasonAndTracking() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/redemptions/test-redemption-id/rollback/", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]) - ->query([ - "reason" => "test-reason", - "tracking_id" => "test-tracking-id" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->rollback("test-redemption-id", (object)[ - "reason" => "test-reason", - "tracking_id" => "test-tracking-id", - "customer" => (object)[ - "id" => "test-customer-id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/redemptions/test-redemption-id/rollback/", [ - "customer" => [ - "id" => "test-customer-id" - ] - ]) - ->query([ - "reason" => "test-reason", - "tracking_id" => "test-tracking-id" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->redemptions->rollback("test-redemption-id", [ - "reason" => "test-reason", - "tracking_id" => "test-tracking-id", - "customer" => [ - "id" => "test-customer-id" - ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} \ No newline at end of file diff --git a/test/SegmentsTest.php b/test/SegmentsTest.php deleted file mode 100644 index f008282..0000000 --- a/test/SegmentsTest.php +++ /dev/null @@ -1,89 +0,0 @@ -post("/segments/", [ - "name" => "test-voucher" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->segments->create((object)[ - "name" => "test-voucher" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/segments/", [ - "name" => "test-voucher" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->segments->create([ - "name" => "test-voucher" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGet() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/segments/test-segment-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->segments->get("test-segment-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDelete() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/segments/test-segement-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->segments->delete("test-segement-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} diff --git a/test/UtilsTest.php b/test/UtilsTest.php deleted file mode 100644 index d078b2e..0000000 --- a/test/UtilsTest.php +++ /dev/null @@ -1,63 +0,0 @@ -assertEquals($result, true); - - // /////////////////////////////////////// HAPPY PATH (OBJECT) - - $signature = "e87e23da6caa7407a6177cc84ba1b26f58e1a68e24f08eba6ee023c8932b111a"; - $data = (object)[ - "item1" => 123, - "item2" => "message", - "item3" => (object)[ - "a" => 1, - "b" => 2 - ], - "item4" => [ "a", "b", "c" ] - ]; - $secretKey = "secret_01234567890_secret"; - - $result = Utils::verifyWebhookSignature($signature, $data, $secretKey); - $this->assertEquals($result, true); - - // /////////////////////////////////////// HAPPY PATH (ARRAY) - - $signature = "62cd3e5dcbce78cbfadc2b8f67cde4d6853b6cea467bbbf37328193662ee040e"; - $data = ["item_a", "item_b", "item_c"]; - $secretKey = "secret_01234567890_secret"; - - $result = Utils::verifyWebhookSignature($signature, $data, $secretKey); - $this->assertEquals($result, true); - - // /////////////////////////////////////// HAPPY PATH (NULL) - - $signature = "6a660d319bc87b480a48b68cd089d3c3f5e2c787a6feeb637cf0d62562560fba"; - $data = NULL; - $secretKey = "secret_01234567890_secret"; - - $result = Utils::verifyWebhookSignature($signature, $data, $secretKey); - $this->assertEquals($result, true); - - // /////////////////////////////////////// UNHAPPY PATH (INVALID SIGNATURE) - - $signature = "invalid_signature"; - $message = "Example test message"; - $secretKey = "secret_01234567890_secret"; - - $result = Utils::verifyWebhookSignature($signature, $message, $secretKey); - - $this->assertEquals($result, false); - } -} \ No newline at end of file diff --git a/test/ValidationRulesTest.php b/test/ValidationRulesTest.php deleted file mode 100644 index 2e02574..0000000 --- a/test/ValidationRulesTest.php +++ /dev/null @@ -1,208 +0,0 @@ -post("/validation-rules/", [ - "voucher_code" => "test-voucher" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->create((object)[ - "voucher_code" => "test-voucher" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/validation-rules/", [ - "voucher_code" => "test-voucher" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->create([ - "voucher_code" => "test-voucher" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGet() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/validation-rules/test-rule-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->get("test-rule-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetList() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/validation-rules/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->getList(); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/validation-rules/?limit=10") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->getList([ "limit" => 10 ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpadate() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/validation-rules/test-rule-id", [ - "campaign" => "test-campaign" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->update((object)[ - "id" => "test-rule-id", - "campaign" => "test-campaign" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/validation-rules/test-rule-id", [ - "campaign" => "test-campaign" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->update([ - "id" => "test-rule-id", - "campaign" => "test-campaign" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDelete() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/validation-rules/test-rule-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->delete("test-rule-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testCreateAssignment() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/validation-rules/test-rule-id/assignments", [ - "name" => "test-assignment", - "voucher" => "test-voucher" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->createAssignment("test-rule-id", (object)[ - "name" => "test-assignment", - "voucher" => "test-voucher" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/validation-rules/test-rule-id/assignments", [ - "name" => "test-assignment", - "voucher" => "test-voucher" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->createAssignment("test-rule-id", [ - "name" => "test-assignment", - "voucher" => "test-voucher" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetAssignments() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/validation-rules/test-rule-id/assignments") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->getAssignments("test-rule-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/validation-rules/test-rule-id/assignments?limit=10") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->getAssignments("test-rule-id", [ "limit" => 10 ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDeleteAssignment() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/validation-rules/test-rule-id/assignments/test-assignment-id") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validationRules->deleteAssignment("test-rule-id", "test-assignment-id"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} diff --git a/test/ValidationsTest.php b/test/ValidationsTest.php deleted file mode 100644 index eec2057..0000000 --- a/test/ValidationsTest.php +++ /dev/null @@ -1,132 +0,0 @@ -post("/vouchers/test-code/validate") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validations->validate("test-code"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/validate", [ - "customer" => "test-customer" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validations->validate("test-code", [ - "customer" => "test-customer" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/validate", [ - "customer" => "test-customer" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validations->validate("test-code", (object)[ - "customer" => "test-customer" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/promotions/validation", [ - "data" => "test" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validations->validate((object)[ - "data" => "test" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/promotions/validation", [ - "data" => "test" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validations->validate([ - "data" => "test" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testValidateVoucher() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/validate") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validations->validateVoucher("test-code"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/validate", [ - "customer" => "test-customer" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validations->validateVoucher("test-code", [ - "customer" => "test-customer" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-code/validate", [ - "customer" => "test-customer" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->validations->validateVoucher("test-code", (object)[ - "customer" => "test-customer" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} diff --git a/test/VouchersTest.php b/test/VouchersTest.php deleted file mode 100644 index 0be065e..0000000 --- a/test/VouchersTest.php +++ /dev/null @@ -1,221 +0,0 @@ -post("/vouchers/test-code", [ - "code" => "test-code", - "type" => "DISCOUNT_VOUCHER" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->create((object)[ - "code" => "test-code", - "type" => "DISCOUNT_VOUCHER" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGet() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/vouchers/test-code") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->get("test-code"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpdateByObject() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/vouchers/test-code", [ - "code" => "test-code", - "type" => "DISCOUNT_VOUCHER" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->update((object)[ - "code" => "test-code", - "type" => "DISCOUNT_VOUCHER" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testUpdateByArray() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->put("/vouchers/test-code", [ - "code" => "test-code", - "type" => "DISCOUNT_VOUCHER" - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->update([ - "code" => "test-code", - "type" => "DISCOUNT_VOUCHER" - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDelete() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/vouchers/test-code") - ->query([ "force" => "false" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->delete("test-code"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDeletePermamently() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->delete("/vouchers/test-code") - ->query([ "force" => "true" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->delete("test-code", true); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetList() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/vouchers/") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->getList(); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testGetListByQuery() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->get("/vouchers/") - ->query([ "campaign" => "test-campaign" ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->getList([ "campaign" => "test-campaign" ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testEnable() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-voucher/enable") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->enable("test-voucher"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testDisable() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-voucher/disable") - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->disable("test-voucher"); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testAddBalance() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/test-voucher/balance", [ - "amount" => 22 - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->addBalance("test-voucher", 22); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } - - public function testImport() - { - CurlMock::register("https://api.voucherify.io/v1", self::$headers) - ->post("/vouchers/import", [ - [ "code" => "test_1234" ], - [ "code" => "test_1243" ], - [ "code" => "test_4321" ] - ]) - ->reply(200, [ "status" => "ok" ]); - - $result = self::$client->vouchers->import([ - [ "code" => "test_1234" ], - [ "code" => "test_1243" ], - [ "code" => "test_4321" ] - ]); - - $this->assertEquals($result, (object)[ "status" => "ok" ]); - - CurlMock::done(); - } -} \ No newline at end of file diff --git a/test/helpers/CurlMock.php b/test/helpers/CurlMock.php deleted file mode 100644 index 58b61d6..0000000 --- a/test/helpers/CurlMock.php +++ /dev/null @@ -1,267 +0,0 @@ -setNamespace($namespace); - - // Build `curl_init` mock - $this->mocks[] = - $builder->setName("curl_init") - ->setFunction(function() { - return $this->_curl_init(); - }) - ->build(); - - // Build `curl_setopt_array` mock - $this->mocks[] = - $builder->setName("curl_setopt_array") - ->setFunction(function($curl, $options) { - return $this->_curl_setopt_array($curl, $options); - }) - ->build(); - - // Build `curl_exec` mock - $this->mocks[] = - $builder->setName("curl_exec") - ->setFunction(function($curl) { - return $this->_curl_exec($curl); - }) - ->build(); - - - // Build `curl_getinfo` mock - $this->mocks[] = - $builder->setName("curl_getinfo") - ->setFunction(function($curl, $param) { - return $this->_curl_getinfo($curl, $param); - }) - ->build(); - - // Build `curl_error` mock - $this->mocks[] = - $builder->setName("curl_error") - ->setFunction(function($curl) { - return $this->_curl_error($curl); - }) - ->build(); - - // Build `curl_close` mock - $this->mocks[] = - $builder->setName("curl_close") - ->setFunction(function($curl) { - return $this->_curl_close($curl); - }) - ->build(); - } - - private function __clone() - { - throw new Exception("Clone is not allowed"); - } - - private function _curl_init() - { - // Return mocked instance (used in other functions) - return (object)[ - "__isMock" => true, - "options" => null, - "reply" => (object)[ - "statusCode" => null, - "payload" => null - ], - "error" => null, - "index" => null, - "request" => null - ]; - } - - private function _curl_setopt_array($curl, $options) - { - if (!is_object($curl) || !isset($curl->__isMock)) { - throw new Exception("Curl must be a mocked object"); - } - $curl->options = $options; - } - - private function _curl_exec($curl) - { - if (!is_object($curl) || !isset($curl->__isMock)) { - throw new \Exception("Curl must be a mocked object"); - } - $url = $curl->options[CURLOPT_URL]; - $headers = $curl->options[CURLOPT_HTTPHEADER]; - $method = $curl->options[CURLOPT_CUSTOMREQUEST]; - $body = $curl->options[CURLOPT_POSTFIELDS]; - $match; - - foreach ($this->requests as $index => $request) { - if ($request->match($url, $headers, $method, $body)) { - $match = (object)[ - "index" => $index, - "request" => $request - ]; - break; - } - } - if (!isset($match)) { - throw new \Exception("Request mock for '" . $method . " " . $url . "' BODY '" . json_encode($body) . "' not found"); - } - - $curl->index = $match->index; - $curl->request = $match->request; - - return $curl->request->getReplyBody(); - } - - private function _curl_getinfo($curl, $param) - { - if (!is_object($curl) || !isset($curl->__isMock)) { - throw new \Exception("Curl must be a mocked object"); - } - if (!isset($curl->request)) { - throw new \Exception("Curl request property is missing"); - } - if ($param != CURLINFO_HTTP_CODE) { - return; - } - - return $curl->request->getReplyStatusCode(); - } - - private function _curl_error($curl) - { - if (!is_object($curl) || !isset($curl->__isMock)) { - throw new \Exception("Curl is not mocked object"); - } - if (!isset($curl->request)) { - throw new \Exception("Curl request property is missing"); - } - - return $curl->request->getError(); - } - - private function _curl_close($curl) - { - if (!is_object($curl) || !isset($curl->__isMock)) { - throw new \Exception("Curl is not mocked object"); - } - if (!isset($curl->request)) { - throw new \Exception("Curl request property is missing"); - } - - $curl->request->done(); - } - - public function enableMock() - { - if (!$this->enabled) { - // Enable all mocks - $this->enabled = true; - - foreach ($this->mocks as $name => $mock) { - $mock->enable(); - } - } - return $this; - } - - public function disableMock() - { - if ($this->enabled) { - // Disable all mocks - $this->enabled = false; - - foreach ($this->mocks as $name => $mock) { - $mock->disable(); - } - } - return $this; - } - - public function registerRequest($baseUrl, $headers) - { - $request = new CurlRequest($baseUrl, $headers); - - // Add request to queue - $this->requests[] = $request; - - return $request; - } - - public function allDone() - { - $undone = 0; - - foreach($this->requests as $request) { - if (!$request->isDone()) { - $undone++; - $request->done(); - } - } - - if ($undone > 0) { - throw new \Exception("Not handled request exists (" . $undone . ")"); - } - } - - /** - * Get / initialize default instance - */ - public static function getInstance() - { - if (!isset(self::$instance)) { - self::$instance = new self(); - } - return self::$instance; - } - - /** - * Enable default instance - */ - public static function enable() - { - return self::getInstance()->enableMock(); - } - - /** - * Disable default instance - */ - public static function disable() - { - return self::getInstance()->disableMock(); - } - - /** - * Register curl request mock - */ - public static function register($baseUrl, $headers) - { - return self::getInstance()->registerRequest($baseUrl, $headers); - } - - public static function done() - { - return self::getInstance()->allDone(); - } -} diff --git a/test/helpers/CurlRequest.php b/test/helpers/CurlRequest.php deleted file mode 100644 index 9e15496..0000000 --- a/test/helpers/CurlRequest.php +++ /dev/null @@ -1,179 +0,0 @@ -reqBaseUrl = $baseUrl; - $this->reqHeaders = $headers; - } - - public function setHeaders($headers) - { - $this->reqHeaders = $headers; - - return $this; - } - - public function setRequest($method, $path = null, $body = null) - { - $this->reqMethod = $method; - $this->reqPath = $path; - $this->reqBody = $body; - - return $this; - } - - public function query($qs) - { - $this->reqParams = $qs; - - return $this; - } - - public function get($path) - { - return $this->setRequest("GET", $path); - } - - public function post($path, $body = null) - { - return $this->setRequest("POST", $path, $body); - } - - public function put($path, $body = null) - { - return $this->setRequest("PUT", $path, $body); - } - - public function delete($path, $body = null) - { - return $this->setRequest("DELETE", $path, $body); - } - - public function reply($statusCode, $body = null) - { - $this->reqReply = (object)[ - "statusCode" => $statusCode, - "body" => $body - ]; - - return $this; - } - - public function replyWithError($error) - { - $this->reqError = $error; - - return $this; - } - - private function encodeParams($params) - { - if (!is_array($params) && !is_object($params)) { - return $params; - } - - $result = array(); - foreach ($params as $key => $value) { - if (is_null($value)) { - continue; - } - $result[] = rawurlencode($key) . "=" . rawurlencode($value); - } - return implode("&", $result); - } - - private function ensureObject($value) - { - if (is_object($value)) { - return $value; - } - if (is_array($value)) { - $obj = new \stdClass; - foreach ($value as $k => $v) { - if (strlen($k)) { - if (is_array($v)) { - $obj->{$k} = $this->ensureObject($v); - } else { - $obj->{$k} = $v; - } - } - } - return $obj; - } - return $value; - } - - public function match($url, $headers, $method, $body = null) - { - if ($this->reqIsDone === true) { - return false; - } - - $reqParams = ($this->reqParams ? "?" . $this->encodeParams($this->reqParams) : ""); - $reqUrl = $this->reqBaseUrl . $this->reqPath . $reqParams; - $body = $body ? json_decode($body) : null; - - if ($reqUrl != $url) { - return false; - } - if ($this->reqMethod != $method) { - return false; - } - if ($this->ensureObject($this->reqHeaders) != $this->ensureObject($headers)) { - return false; - } - - if ($this->ensureObject($this->reqBody) != $this->ensureObject($body)) { - return false; - } - - return true; - } - - public function getReplyBody() - { - if (isset($this->reqError)) { - return false; - } - if (!isset($this->reqReply)) { - return; - } - return json_encode($this->reqReply->body); - } - - public function getReplyStatusCode() - { - if (!isset($this->reqReply)) { - return; - } - return $this->reqReply->statusCode; - } - - public function getError() - { - return $this->reqError; - } - - public function done() - { - $this->reqIsDone = true; - } - - public function isDone() - { - return $this->reqIsDone === true; - } -} \ No newline at end of file